"Date" (Comparison Method)

Compare two dates based on a time tolerance.

Details

  • The "Date" comparison method considers two date objects to be equivalent if they do not differ by a given amount of time.
  • This allowed time difference should be given as a time Quantity using the Tolerance option in AssessmentFunction. The default tolerance is zero seconds.
  • By default, the date comparison between the answer key and the answer is computed using the DateDifference function. The DistanceFunction option can be used to specify a custom temporal distance metric.
  • Using the default distance function DateDifference, when the granularities are not consistent, assessment is based on the smallest granularity and the starting points of dates with larger granularities.
  • When multiple values in the answer key are within the tolerance range of an answer, the closest value is selected.
  • For convenience, vectors with multiple components are also accepted as input and treated as arguments to DateObject.

Examples

open allclose all

Basic Examples  (1)

Create an AssessmentFunction for a date question with a tolerance:

Use it to assess an answer:

Scope  (2)

Create an assessment with multiple possible answers at different time scales with custom scores:

Assess an answer and retrieve the score:

Assess and retrieve the score when the exact date is given:

The dates do not need to be defined at the same time granularity:

Generalizations & Extensions  (1)

Any valid input for DateObject is supported when the "Date" method is explicitly specified:

See the answer key containing standardized dates:

Applications  (1)

Create a QuestionObject using "Date" interpretation on the inputs:

Properties & Relations  (1)

Create a QuestionObject treating years as numbers:

Using "Date" comparison with interpretation allows all common date forms:

Possible Issues  (2)

Answers with smaller granularities than the answer key are compared to the starting point of the key and may have nonzero distances:

Create a custom distance function conforming the answer to match the granularity of the answer key:

Any value within the answer key date is marked correct:

The date comparison method will be automatically inferred only if the answer key is a DateObject:

Other date specifications will not automatically be treated as dates:

Specify the method explicitly: