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.
- 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.
Examplesopen allclose all
Basic Examples (2)
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):
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:
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.
Wolfram Language. 2014. "UtilityFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UtilityFunction.html.
Wolfram Language. (2014). UtilityFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UtilityFunction.html