"Quantity" (Comparison Method)
Details
- The "Quantity" comparison method considers two quantities to be equivalent if they do not differ beyond a given tolerance.
- All specified quantities must have compatible units.
- This tolerance should be expressed as any Quantity consistent with the answer key and is set using the Tolerance option in AssessmentFunction.
- The default tolerance has a zero magnitude.
- By default, the comparison between the answer key and the answer is computed as the absolute difference. The DistanceFunction option can be used to specify a custom distance metric.
- When multiple values in the answer key are within the tolerance range of an answer, the closest value is selected.
Examples
open allclose allBasic Examples (2)
Create an AssessmentFunction for a distance quantity question with a tolerance:
Use it to assess answers specified in any compatible unit:
Assess the distance from the Earth to the Sun, allowing a 10% margin of error:
Provide an answer computed based on the time for light to reach Earth:
Scope (1)
Generate building height data for use in an answer key:
Create an assessment using the data with multiple scores and a tolerance:
Verify all the values and scores in the answer key:
Assess an answer and retrieve the score directly. The score corresponds to the closest answer key given the tolerance:
Applications (1)
Retrieve hydrogen spectra wavelengths and combine values within an angstom:
Create a QuestionObject for reading a spectrum diagram:
Properties & Relations (2)
The "Quantity" comparison method will be automatically inferred if all the answer keys are Quantity expressions:
Otherwise the fallback "Expression" comparison method will be inferred:
The "Quantity" comparison always automates unit conversion:
To prevent unit conversion and require that answers exactly match the answer key, use a different method like "Number" or "Expression":