Predict

Predict[{in1out1,in2out2,}]
generates a PredictorFunction[] based on the example input-output pairs given.

Predict[{in1,in2,}{out1,out2,}]
generates the same result.

Predict[training,input]
attempts to predict the output associated with input from the training examples given.

Predict["name",input]
uses the built-in predictor function represented by .

Predict["name",input,prop]
gives the specified property of the prediction associated with input.

Details and OptionsDetails and Options

  • Predict works for a variety of data types, including numerical, textual, sound, and image.
  • Each can be a single feature, a list of features, or an association of features. When is a list of features, all must have the same dimensions.
  • Predict[training] returns a PredictorFunction[] that can then be applied to specific data.
  • In Predict[,input], input can be a single item or a list of items.
  • In Predict[,input,prop], properties are as given in PredictorFunction[].
  • Examples of built-in predictor functions include:
  • "NameAge"age of a person, given their first name
  • The following options can be given:
  • IndeterminateThreshold0below what probability density to return Indeterminate
    MethodAutomaticwhich regression algorithm to use
    NominalVariablesAutomaticwhich features should be considered categorical
    PerformanceGoalAutomaticfavor algorithms with specific advantages
    UtilityFunctionAutomaticutility expressed as a function of actual and predicted value
    ValidationSetAutomaticdata on which to validate the model generated
  • Possible settings for PerformanceGoal include:
  • "Memory"minimize the storage requirements of the predictor
    "Quality"maximize the accuracy of the predictor
    "Speed"maximize the speed of the predictor
    "TrainingSpeed"minimize the time spent producing the predictor
  • PerformanceGoal->{goal1,goal2,} will automatically combine , , etc.
  • Possible settings for Method include:
  • "LinearRegression"predict from linear combinations of features
    "NearestNeighbors"predict from nearest neighboring examples
    "RandomForest"predict from BreimanCutler ensembles of decision trees

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Train a predictor function on a set of examples:

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

Predict the value of a new example, given its feature:

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

Get the conditional distribution of the value, given the example feature:

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

Plot this distribution:

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

Predict multiple examples:

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

Plot the predicted values as a function of the feature value and show the training examples:

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

Train a predictor on a dataset with multiple features:

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

Predict the value of a new example, given its features:

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

Predict the value of a new example that has a missing feature:

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