AssessmentFunction

AssessmentFunction[key]

represents a tool for assessing whether answers are correct according to the key.

AssessmentFunction[key,method]

uses the specified answer comparison method.

AssessmentFunction[key,f]

uses the function f to compare answers with the key.

AssessmentFunction[key,comp]

performs assessment using the custom assessment defined in the Association comp.

AssessmentFunction[] [answer]

gives an AssessmentResultObject representing the correctness of answer.

Details and Options

  • The key accepts the following forms:
  • ansanswer matches the pattern ans
    {ans1,ans2,}answer is any of the ansi
    {{a1,a2,}}answer is the list {a1,a2,}
    AnySubset[{ans1,ans2,}]answer is any subset of the ansi
  • Each possible answer ansi can have the following forms:
  • pattpattern matching all correct responses
    pattscorepattern and corresponding score to be awarded
    pattansspecAssociation containing a complete answer specification
  • Using pattscore is equivalent to patt<|"Score"score|>.
  • The score should have either Boolean or numeric values. True and positive numeric scores denote correct answers, while False, zero and negative scores are incorrect.
  • The patti can be exact answer values or patterns against which the values of answer are compared.
  • The full answer specification ansspec accepts the following keys:
  • "Score" (required)award given for matching answers
    "Correct"whether the ans is considered correct
    "Category"category corresponding to the answer for sorting questions
    "Explanation"text to be provided to the user
  • Answer comparison methods supported in AssessmentFunction[key,"method"] include:
  • "Number"scalar numeric values
    "String"strings
    "Item"any expression
    "DateObject"dates
    "GeoPosition"geographic locations
    "Point"geometric Point values
    "List"an ordered list
    "UnorderedList"list where ordering is not important
  • In AssessmentFunction[key,comp], comp is an Association. The accepted keys are:
  • "Comparator"function to compare provided answer to each pattern in key
    "Selector"function to select matching pattern for provided answer
    "ElementwiseAssessment"whether list answers should be assessed elementwise with partial credit
    "ScoreCombiner"function to combine elementwise "Score" values
    "AnswerCorrectCombiner"function to combine elementwise "AnswerCorrect" values
  • AssessmentFunction[key,f] for a function f is equivalent to AssessmentFunction[key,<|"Comparator"f|>].
  • Only one of "Comparator" or "Selector" should be provided. Using "Comparator"compf computes compf[answer, patt] for each ans in the key in order and chooses the first ans to give True. Common comparators include MatchQ, Greater, StringMatchQ and SameQ.
  • A custom comparator that takes only the user's answer as input can be used without specifying a key. In this case, Automatic is accepted as a key.
  • Using "Selector"selectf computes selectf[{patt1,patt2,},answer] and returns the patt corresponding to the selected ans. Common selectors include SelectFirst, Composition[First,Nearest] and Composition[First,TakeLargestBy].
  • By default, the answer is assessed as a single complete answer. Using "ElementwiseAssessment"True assesses listed answers one element at a time. The "Score" and "AnswerCorrect" results for each element are combined using the "ScoreCombiner" and "AnswerCorrectCombiner" function, respectively. The "ScoreCombiner" and "AnswerCorrectCombiner" functions are only applied when "ElementwiseAssessment" is True.
  • AssessmentFunction accepts the following options:
  • DistanceFunctionAutomaticdistance metric to use
    ToleranceAutomaticdistance to accept when matching answers
    MaxItemsInfinitylimit on number of elements in elementwise assessment
  • AssessmentFunction[key] is equivalent to AssessmentFunction[key,Automatic] and infers an answer comparison type from key.
  • Each answer comparison type corresponds to a predefined comparator or selector function. Usually, when no built-in notion of distance exists for the comparison type a "Comparator" of MatchQ is used.
  • When a notion of distance does exist for a comparison type, AssessmentFunction uses a "Selector" of First@*Nearest and accepts Tolerance and DistanceFunction options.
  • For elementwise assessment, "AnswerCorrectCombiner" should take a list of Booleans representing the correctness of each element and return a single Boolean for the overall correctness of the answer. The default depends on the comparison method. The most common default value is AllTrue[#,TrueQ]&.
  • For elementwise assessment, "ScoreCombiner" should take a list of numeric values representing the score of each element and return a total numeric score for the answer. The default depends on the comparison method. The most common default value is Total.
  • When performing elementwise assessment, if the number of elements given is greater than the value of MaxItems, AssessmentFunction gives a Failure.
  • Information works on AssessmentFunction and accepts the following prop values:
  • "AnswerComparisonMethod"expected type for the values (i.e. "Number", "GeoPosition")
    "Key"key used to assess answers
  • Information[AssessmentFunction[],"Properties"] provides a full list of available prop values.

Examples

open allclose all

Basic Examples  (1)

Create an assessment function that will check for the answer "Dog":

Scope  (15)

Create an assessment function that awards two points for an even number:

Apply the assessment to an answer:

Create an assessment function that accepts any of a list of values:

Apply the assessment function:

See the results:

Assign scores for each available answer:

Negative scores are considered incorrect:

Specify answer information using an Association:

See the full assessment information:

Create an assessment that checks for a list of values as a single item:

Elements of the list are incorrect answers:

Only the full list will match:

Create an assessment function for a sorting question:

The provided answer and category must match to get a correct assessment:

Create an assessment for a question like "Name some Pokémon":

Any valid subset gives a correct answer with a score of one:

Use elementwise assessment to award points for each correct answer:

The score represents the number of correct answers:

Specific an answer comparison method:

Specify a comparator function to create a spelling test:

Specify a comparator function to create an assessment for geo locations near cities:

Assess a location and see the full assessment:

Define an assessment that depends only on the answer by giving Automatic as the key.

Define a selector function for the question "Name a city with a population closer to that of St. Louis than that of Chicago or Indianapolis":

Use elementwise assessment to assign partial credit:

Apply the assessment function to a list of values to assess each element:

The assessment contains information on each element:

Define custom combining functions for elementwise assessment:

Apply the assessment function to a list of values to assess each element:

The assessment contains information on each element:

Options  (3)

DistanceFunction  (1)

Define an assessment function for a question about the distance of the Sun:

The tolerance is applied linearly:

Specify a DistanceFunction to apply the tolerance logarithmically:

MaxItems  (1)

Elementwise assessment computes the assessment for each element in the answer; this can be slow for some comparators:

Limit the number of elements to assess with MaxItems:

Tolerance  (1)

Create an assessment function asking to name the value of Pi:

Approximate answers are marked as incorrect:

Use the Tolerance option to allow approximate answers:

The answer is marked as correct:

Properties & Relations  (3)

Answers not included in the key are considered incorrect:

Zero points are awarded:

Answer keys support patterns:

See the assessment results:

Extract information about an AssessmentFunction using Information:

Retrieve specific values:

Wolfram Research (2020), AssessmentFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/AssessmentFunction.html.

Text

Wolfram Research (2020), AssessmentFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/AssessmentFunction.html.

BibTeX

@misc{reference.wolfram_2020_assessmentfunction, author="Wolfram Research", title="{AssessmentFunction}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/AssessmentFunction.html}", note=[Accessed: 14-May-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_assessmentfunction, organization={Wolfram Research}, title={AssessmentFunction}, year={2020}, url={https://reference.wolfram.com/language/ref/AssessmentFunction.html}, note=[Accessed: 14-May-2021 ]}

CMS

Wolfram Language. 2020. "AssessmentFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AssessmentFunction.html.

APA

Wolfram Language. (2020). AssessmentFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AssessmentFunction.html