UtilityFunction

UtilityFunction

is an option for Predict, Classify, and related functions that specifies the utility value to assign to each possible pairing of actual and predicted values.

Details

  • With UtilityFunctionf, the utility value assigned to actual value va and predicted value vp is taken to be f[va,vp].
  • In the case of Classify, f is typically an association of associations, of the form <|class1<|class1u11,class2u12|>,|>. Here uij is the utility matrix, with i being the actual class and j the predicted class.

Examples

open allclose all

Basic Examples  (2)

Train a classifier:

For a new example, the most probable class is predicted:

Set the decision utility to penalize misclassification of class "diseased":

The decision utility can be specified in the classifier:

Use a utility function that includes an Indeterminate decision possibility (independently of the option IndeterminateThreshold):

Train a predictor:

Visualize the probability density for a given example:

By default, the value with the highest probability density is predicted:

Define a utility function that penalizes the predicted value being smaller than the actual value:

Use this utility to predict the example:

The default utility function is the Dirac delta:

Applications  (1)

Load the training set and test set of the "Mushroom" dataset:

Train a classifier on a part of the training set:

Visualize the confusion matrix of the classifier on the test set:

Visualize the confusion matrix obtained when the classifier has a different value of UtilityFunction:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_utilityfunction, author="Wolfram Research", title="{UtilityFunction}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/UtilityFunction.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_utilityfunction, organization={Wolfram Research}, title={UtilityFunction}, year={2014}, url={https://reference.wolfram.com/language/ref/UtilityFunction.html}, note=[Accessed: 22-November-2024 ]}