represents a function generated by Predict that predicts numerical values from data.

Details and Options

  • PredictorFunction works like Function.
  • PredictorFunction[][data] attempts to predict the value associated with data.
  • PredictorFunction[][{data1,data2,}] attempts to predict all the datai.
  • PredictorFunction[][data,prop] gives the specified property of the prediction associated with data.
  • Possible properties applicable to all methods include:
  • "Decision"best prediction according to the distribution and the utility function
    "Distribution"distribution of value conditioned on input
    "SHAPValues"Shapley additive feature explanations for each example
    "Properties"list of all properties available
  • "SHAPValues" assesses the contribution of features by comparing predictions with different sets of features removed and then synthesized. The option MissingValueSynthesis can be used to specify how the missing features are synthesized. SHAP explanations are given as deviation from the training output mean. "SHAPValues"n can be used to control the number of samples used for the numeric estimations of SHAP explanations.
  • PredictorFunction[][data,,opts] specifies that the predictor should use the options opts when applied to data.
  • Possible options are:
  • IndeterminateThreshold Automaticbelow what probability density to return Indeterminate
    PerformanceGoal Automaticwhich aspect of performance to optimize
    MissingValueSynthesis Automatichow to synthesize missing values
    RecalibrationFunction Automatichow to post-process predicted value
    TargetDevice "CPU"the target device on which to perform training
    UtilityFunction Automaticutility expressed as a function of actual and predicted value
  • A PredictorFunction[] trained in an older version of the Wolfram Language will still work in the current version.
  • Predict[FittedModel[]] can be used to convert a fitted model into a PredictorFunction[].
  • Predict[PredictorFunction[],opts] can be used to update the values of PerformanceGoal, IndeterminateThreshold, UtilityFunction or FeatureExtractor of the classifier.
  • In Predict[PredictorFunction[],FeatureExtractorfe], the FeatureExtractorFunction[] fe will be prepended to the existing feature extractor.
  • Information[PredictorFunction[]] generates an information panel about the classifier and its estimated performances.
  • Information[PredictorFunction[],prop] can be used to obtain specific properties.
  • Information of a PredictorFunction[] may include the following properties:
  • "BatchEvaluationTime"marginal time to predict one example when a batch is given
    "EvaluationTime"time needed to predict one example
    "ExampleNumber"number of training examples
    "FeatureTypes"feature types of the predictor input
    "FunctionMemory"memory needed to store the predictor
    "FunctionProperties"all prediction properties available for this predictor
    "IndeterminateThreshold"value of IndeterminateThreshold used by the predictor
    "LearningCurve"performance as function of training set size
    "MaxTrainingMemory"maximum memory used during training
    "MeanCrossEntropy"estimated mean cross entropy of the predictor
    "Method"value of Method used by the predictor
    "MethodDescription"summary of the method
    "MethodOption"full method option to be reused in a new training
    "MethodParameters"parameter settings of the method
    "Properties"all information properties available for this predictor
    "StandardDeviation"estimated standard deviation of the predictor
    "FeatureExtractor"feature extractor as FeatureExtractorFunction
    "TrainingLabelMean"mean label value seen during training
    "TrainingTime"time used by Predict to generate the predictor
    "UtilityFunction"value of UtilityFunction used by the predictor
  • Information properties also include all method suboptions.


open allclose all

Basic Examples  (2)

Train a PredictorFunction:

Use the trained PredictorFunction to predict an output, given some feature:

Predict multiple examples:

Calculate the probability distribution of the predicted value:

Generate a PredictorFunction using multiple features:

Use the function on a new example:

Predict an example that has missing features:

Obtain general information about the predictor:

Scope  (6)

Train a PredictorFunction on textual data:

Predict the values of new examples:

Train a PredictorFunction to recognize the frequency of SawtoothWave sounds:

Predict the values of new examples:

Train a PredictorFunction:

Generate a PredictorMeasurementsObject of the function applied to a test set:

Get the standard deviation of the residuals of the function on the test set:

Visualize the scatter plot of the test values as a function of the predicted values:

Generate a predictor function whose input is an association:

Use the function on an example:

Predict examples containing missing features:

Construct a Dataset with a list of associations:

Train a PredictorFunction to predict the feature "age" as function of the other features:

Once the PredictorFunction is trained, any input format can be used. Predict an example formatted as an association:

Find out the order of the features, and classify an example formatted as a list:

Classify examples in a Dataset:

Load a dataset of wine quality as a function of the wines' physical properties:

Train a predictor to estimate wine quality:

Examine an example bottle:

Predict the example bottle's quality:

Calculate how much higher or lower this bottle's predicted quality is than the mean:

Get an estimation for how much each feature impacted the predictor's output for this bottle:

Visualize these feature impacts:

Confirm that the Shapley values fully explain the predicted quality:

Learn a distribution of the data that treats each feature as independent:

Estimate SHAP value feature importance for 100 bottles of wine, using 5 samples for each estimation:

Calculate how important each feature is to the model:

Visualize the model's feature importance:

Visualize a nonlinear relationship between a feature's value and its impact on the model's prediction:

Options  (7)

IndeterminateThreshold  (1)

Train a PredictorFunction:

Visualize the probability density for a given example:

The value with the highest probability density is predicted:

No prediction is made if the maximum probability density is below a specified threshold:

Update the value of the threshold permanently:

MissingValueSynthesis  (1)

Train a predictor with two input features:

Get the prediction for an example that has a missing value:

Set the missing value synthesis to replace missing variables with their most likely value given known values (which is the default behavior):

Replace missing variables with random samples conditioned on known values:

Averaging over many random imputations is usually the best strategy and allows obtaining the uncertainty caused by the imputation:

Specify a learning method during training to control how the distribution of data is learned:

Predict an example with missing values using the "KernelDensityEstimation" distribution to condition values:

Provide an existing LearnedDistribution at training to use it when imputing missing values during training and later evaluations:

Specify an existing LearnedDistribution to synthesize missing values for an individual evaluation:

Control both the learning method and the evaluation strategy by passing an association at training:

RecalibrationFunction  (2)

Train a predictor:

Compute the prediction:

Compute the predictive distribution:

Temporarily set a recalibration function to apply to the prediction:

Compute the predictive distribution with this new recalibration:

Load the Boston Homes dataset:

Train a predictor with model calibration:

Visualize the comparison plot on a test set:

Remove the recalibration function from the predictor:

Visualize the new comparison plot:

TargetDevice  (1)

Train a predictor using a neural network:

Evaluate the resulting predictor on system's default GPU and look at its AbsoluteTiming:

Compare the previous timing with the one achieved by using the default CPU computation:

UtilityFunction  (1)

Train a predictor function:

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's being smaller than the actual value:

Plot this function for a given actual value:

The predictor decision is now changed despite the probability density's being unchanged:

Update the value of the utility function permanently:

PerformanceGoal  (1)

Obtain the built-in PredictorFunction "NameAge":

Set a custom utility function to use with this predictor:

Compute the time required to use an example with this utility function:

Use PerformanceGoal to use a faster but less accurate result:

Wolfram Research (2014), PredictorFunction, Wolfram Language function, (updated 2021).


Wolfram Research (2014), PredictorFunction, Wolfram Language function, (updated 2021).


Wolfram Language. 2014. "PredictorFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021.


Wolfram Language. (2014). PredictorFunction. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_predictorfunction, author="Wolfram Research", title="{PredictorFunction}", year="2021", howpublished="\url{}", note=[Accessed: 13-July-2024 ]}


@online{reference.wolfram_2024_predictorfunction, organization={Wolfram Research}, title={PredictorFunction}, year={2021}, url={}, note=[Accessed: 13-July-2024 ]}