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 "name".

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

Details and OptionsDetails and Options

  • Predict can be used on many types of data, including numerical, textual, sounds and images, as well as combinations of these.
  • Each inputi can be a single data element, a list of data elements, an association of data elements or a Dataset object. In Predict[training,], training can be a Dataset object.
  • 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[]; they include:
  • "Decision"best prediction according to distribution and utility function
    "Distribution"distribution of value conditioned on input
    "Properties"list of all properties available
  • Examples of built-in predictor functions include:
  • "NameAge"age of a person, given their first name
  • The following options can be given:
  • FeatureExtractor"Identity"how to extract features from which to learn
    FeatureNamesAutomaticfeature names to assign for input data
    FeatureTypesAutomaticfeature types to assume for input data
    IndeterminateThreshold0below what probability density to return Indeterminate
    MethodAutomaticwhich regression algorithm to use
    PerformanceGoalAutomaticaspects of performance to try to optimize
    UtilityFunctionAutomaticutility as function of actual and predicted value
    ValidationSetAutomaticdata on which to validate the model generated
  • Possible settings for PerformanceGoal include:
  • "Memory"minimize storage requirements of the predictor
    "Quality"maximize accuracy of the predictor
    "Speed"maximize speed of the predictor
    "TrainingSpeed"minimize time spent producing the predictor
    Automaticautomatic tradeoff among speed, accuracy, and memory
  • PerformanceGoal{goal1,goal2,} will automatically combine goal1, goal2, etc.
  • Possible settings for Method include:
  • "LinearRegression"predict from linear combinations of features
    "NearestNeighbors"predict from nearest neighboring examples
    "NeuralNetwork"predict using an artificial neural network
    "RandomForest" predict from BreimanCutler ensembles of decision trees
    "GaussianProcess"predict using a Gaussian process prior over functions
  • Predict[{assoc1,assoc2,}"key",] can be used to specify that the output is given by the value of "key" in each association associ.
  • Predict[{list1,list2,}n,] can be used to specify that the output is given by the value of part n in each list listi.
  • Predict[Dataset[]part,] can be used to specify that the outputs are given by the value of part of each row of the dataset.

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)
| Updated in 2016
(10.4)
Translate this page: