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 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:
  • FeatureExtractorIdentityhow 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
    TimeGoalAutomatichow long to spend training the classifier
    TrainingProgressReportingAutomatichow to report progress during training
    RandomSeeding1234what seeding of pseudorandom generators should be done internally
    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
    {goal1,goal2,}automatically combine goal1, goal2, etc.
  • Possible settings for Method include:
  • "DecisionTree"predict using a decision tree
    "GradientBoostedTrees"predict using an ensemble of trees trained with gradient boosting
    "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
  • The following settings for TrainingProgressReporting can be used:
  • "Panel"show a dynamically updating graphical panel
    "Print"periodically report information using Print
    "ProgressIndicator"show a simple ProgressIndicator
    "SimplePanel"dynamically updating panel without learning curves
    Nonedo not report any information
  • Possible settings for RandomSeeding include:
  • Automaticautomatically reseed every time the function is called
    Inheriteduse externally seeded random numbers
    seeduse an explicit integer or strings as a seed
  • 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.
  • Predict[,FeatureExtractor"Minimal"] indicates that the internal preprocessing should be as simple as possible.

Examples

open allclose all

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]=

Scope  (8)

Options  (17)

Applications  (4)

Properties & Relations  (1)

Possible Issues  (1)

Neat Examples  (2)

See Also

PredictorFunction  PredictorMeasurements  PredictorInformation  Classify  ActivePrediction  SequencePredict  Interpolation  FindFit  Nearest  DimensionReduce  FindFormula  BayesianMinimization

Introduced in 2014
(10.0)
| Updated in 2017
(11.2)