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:

Introduced in 2014
 (10.0)