Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

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.

DetailsDetails

  • 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.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Train a classifier:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

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

In[5]:=
Click for copyable input
Out[5]=

The decision utility can be specified in the classifier:

In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=

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

In[8]:=
Click for copyable input
Out[8]=

Train a predictor:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Visualize the probability density for a given example:

In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=

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

In[5]:=
Click for copyable input
Out[5]=

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

In[6]:=
Click for copyable input

Use this utility to predict the example:

In[7]:=
Click for copyable input
Out[7]=

The default utility function is the Dirac delta:

In[8]:=
Click for copyable input
Out[8]=
Introduced in 2014
(10.0)