"Date" (比較法)
"Date" (比較法)
2つの日付を時間の許容範囲に基づいて比較する.
詳細
- "Date"比較法は,2つの日付オブジェクトに指定された時間量の違いがないとき,両者を等しいとみなす.
- 時間量の違いは,AssessmentFunctionのToleranceオプションを使った時間Quantityとして与えられなければならない.
- デフォルトで,解答集と答の間の日付の比較はDateDifference関数を使って行われる.DistanceFunctionオプションを使ってカスタムの時間距離測度が指定できる.
- デフォルトの距離関数DateDifferenceを使うとき,粒度が揃っていない場合の評価は,最小粒度と粒度がより粗いものの日付の開始日に基づいて行われる.
- 解答集に答の許容範囲内の複数の値があるときは,最近値が選ばれる.
- 便宜上,複数の成分を持つベクトルも入力として受容され,DateObjectの引数として扱われる.
例題
すべて開く すべて閉じる例 (1)
許容範囲付きの日付問題用のAssessmentFunctionを作成する:
dateaf = AssessmentFunction[DateObject[{2024, 6, 1}], "Date", Tolerance -> Quantity[3, "Days"]]dateaf[DateObject[{2024, 5, 29}]]スコープ (2)
カスタムスコアを使用して,異なる時間スケールで複数の可能な答を含む評価を作成する:
dday = Entity["MilitaryConflict", "NormandyLandings"]["StartDate"]ddaytest = AssessmentFunction[{DateObject[dday, "Year"] -> 1, DateObject[dday, "Month"] -> 5, DateObject[dday, "Day"] -> 20}]result = ddaytest[{1944}]result["Score"]ddaytest["June 6 1944"]["Score"]keydate = DateObject[{2024, 6, 1, 8}]dayhour = AssessmentFunction[keydate, "Date", Tolerance -> Quantity[12, "Hours"] ]dayhour[DateObject[{2024, 6, 1}]]一般化と拡張 (1)
DateObjectの任意の有効な入力は,"Date"法で明示的に指定されている場合にサポートされる:
vectordate = AssessmentFunction[{{2024, 1}, "Feb. 8th, 2022", 3926653555}, "Date"]Information[vectordate, "Key"]アプリケーション (1)
入力に"Date"解釈を使ってQuestionObjectを作成する:
QuestionObject[QuestionInterface["ShortAnswer", <|"Prompt" -> "When did the Battle of Hastings begin?", "Interpreter" -> "Date"|>], AssessmentFunction[ Entity["MilitaryConflict", "BattleOfHastings"]["StartDate"], Tolerance -> Quantity[1, "Century"]]]特性と関係 (1)
年を数として扱ってQuestionObjectを作成する:
QuestionObject["Within fifty, in what year did Genghis Khan die?", AssessmentFunction[Entity["Person", "GenghisKhan::3256b"][EntityProperty["Person", "DeathDate"]]["Year"], "Number", Tolerance -> 50]]解釈をともなう"Date"比較を使うと,一般的な日付形式がすべて使える:
QuestionObject[QuestionInterface["ShortAnswer", <|"Prompt" -> "Within fifty years, when did Genghis Khan die?", "Interpreter" -> "Date"|>], AssessmentFunction[Entity["Person", "GenghisKhan::3256b"][EntityProperty["Person", "DeathDate"]], "Date", Tolerance -> Quantity[50, "Years"]]]考えられる問題 (2)
解答集よりも粒度が細かい答は,解答集の開始点と比較され,距離がゼロ以外になることもある:
daygranularity = AssessmentFunction[DateObject[{2024, 6, 1}], "Date"]daygranularity[DateObject[{2024, 6, 1, 10, 0, 0}]]matchgranularity = AssessmentFunction[DateObject[{2024, 6, 1}], "Date", DistanceFunction -> (Abs@DateDifference[DateObject[#1, "Day"], #2]&)]matchgranularity[DateObject[{2024, 6, 1, 10, 0, 0}]]日付比較法は,解答集がDateObjectの場合にのみ,自動的に推測される:
AssessmentFunction[DateObject[{2024, 1}]]AssessmentFunction[{{2024, 1}}]AssessmentFunction[{{2024, 1}}, "Date"]関連項目
AssessmentFunction QuestionObject DateDifference DateObject
質問インターフェースタイプ: ShortAnswer MultipleShortAnswers
関連するガイド
-
▪
- 質問と評価