PredictorFunction
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 Automatic below what probability density to return Indeterminate PerformanceGoal Automatic which aspect of performance to optimize MissingValueSynthesis Automatic how to synthesize missing values RecalibrationFunction Automatic how to post-process predicted value TargetDevice "CPU" the target device on which to perform training UtilityFunction Automatic utility 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.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Train a PredictorFunction:

https://wolfram.com/xid/01yyovh5nrm-b9dzea

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

https://wolfram.com/xid/01yyovh5nrm-53n8


https://wolfram.com/xid/01yyovh5nrm-e7w6ph

Calculate the probability distribution of the predicted value:

https://wolfram.com/xid/01yyovh5nrm-bgouui

Generate a PredictorFunction using multiple features:

https://wolfram.com/xid/01yyovh5nrm-6d3z0t

Use the function on a new example:

https://wolfram.com/xid/01yyovh5nrm-q87iwn

Predict an example that has missing features:

https://wolfram.com/xid/01yyovh5nrm-pjaio8

Obtain general information about the predictor:

https://wolfram.com/xid/01yyovh5nrm-8y8yu

Scope (6)Survey of the scope of standard use cases
Train a PredictorFunction on textual data:

https://wolfram.com/xid/01yyovh5nrm-spf589

Predict the values of new examples:

https://wolfram.com/xid/01yyovh5nrm-sprc02

Train a PredictorFunction to recognize the frequency of SawtoothWave sounds:

https://wolfram.com/xid/01yyovh5nrm-dwor9v

Predict the values of new examples:

https://wolfram.com/xid/01yyovh5nrm-jad4yg

https://wolfram.com/xid/01yyovh5nrm-d4rhlb

Train a PredictorFunction:

https://wolfram.com/xid/01yyovh5nrm-vvh6kg

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

https://wolfram.com/xid/01yyovh5nrm-duh5q9

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

https://wolfram.com/xid/01yyovh5nrm-cbhd3s

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

https://wolfram.com/xid/01yyovh5nrm-4pfth2

Generate a predictor function whose input is an association:

https://wolfram.com/xid/01yyovh5nrm-pl8yra

Use the function on an example:

https://wolfram.com/xid/01yyovh5nrm-10r04a

Predict examples containing missing features:

https://wolfram.com/xid/01yyovh5nrm-deouc6

Construct a Dataset with a list of associations:

https://wolfram.com/xid/01yyovh5nrm-lhnxnd

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

https://wolfram.com/xid/01yyovh5nrm-f4tpwu

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

https://wolfram.com/xid/01yyovh5nrm-rae3u3

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

https://wolfram.com/xid/01yyovh5nrm-ccc6wd


https://wolfram.com/xid/01yyovh5nrm-q5c13d

Classify examples in a Dataset:

https://wolfram.com/xid/01yyovh5nrm-cbsemz


https://wolfram.com/xid/01yyovh5nrm-csehx0

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

https://wolfram.com/xid/01yyovh5nrm-0262ca
Train a predictor to estimate wine quality:

https://wolfram.com/xid/01yyovh5nrm-ytl4j2


https://wolfram.com/xid/01yyovh5nrm-8yv81b

Predict the example bottle's quality:

https://wolfram.com/xid/01yyovh5nrm-rfe9mh

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

https://wolfram.com/xid/01yyovh5nrm-lqdk3d

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

https://wolfram.com/xid/01yyovh5nrm-m7t0n8

Visualize these feature impacts:

https://wolfram.com/xid/01yyovh5nrm-7d1qat

Confirm that the Shapley values fully explain the predicted quality:

https://wolfram.com/xid/01yyovh5nrm-08373t


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

https://wolfram.com/xid/01yyovh5nrm-ddmot3

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

https://wolfram.com/xid/01yyovh5nrm-euwga

Calculate how important each feature is to the model:

https://wolfram.com/xid/01yyovh5nrm-otiw08

Visualize the model's feature importance:

https://wolfram.com/xid/01yyovh5nrm-wsqujs

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

https://wolfram.com/xid/01yyovh5nrm-mmlrh3

Options (7)Common values & functionality for each option
IndeterminateThreshold (1)
Train a PredictorFunction:

https://wolfram.com/xid/01yyovh5nrm-xir5ql

Visualize the probability density for a given example:

https://wolfram.com/xid/01yyovh5nrm-d9c02p


https://wolfram.com/xid/01yyovh5nrm-jqvr

The value with the highest probability density is predicted:

https://wolfram.com/xid/01yyovh5nrm-e1alw5

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

https://wolfram.com/xid/01yyovh5nrm-mwd55p

Update the value of the threshold permanently:

https://wolfram.com/xid/01yyovh5nrm-qxqkw4


https://wolfram.com/xid/01yyovh5nrm-rscqal

MissingValueSynthesis (1)
Train a predictor with two input features:

https://wolfram.com/xid/01yyovh5nrm-uarmq6

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

https://wolfram.com/xid/01yyovh5nrm-00e8xt

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

https://wolfram.com/xid/01yyovh5nrm-e03411

Replace missing variables with random samples conditioned on known values:

https://wolfram.com/xid/01yyovh5nrm-od0kq

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

https://wolfram.com/xid/01yyovh5nrm-fqeata

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

https://wolfram.com/xid/01yyovh5nrm-lyqv3u

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

https://wolfram.com/xid/01yyovh5nrm-hwf88u

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

https://wolfram.com/xid/01yyovh5nrm-8ni5d


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

https://wolfram.com/xid/01yyovh5nrm-z7m9zi

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

https://wolfram.com/xid/01yyovh5nrm-ktalq9

RecalibrationFunction (2)

https://wolfram.com/xid/01yyovh5nrm-ff009l


https://wolfram.com/xid/01yyovh5nrm-06cdnh

Compute the predictive distribution:

https://wolfram.com/xid/01yyovh5nrm-544r1e

Temporarily set a recalibration function to apply to the prediction:

https://wolfram.com/xid/01yyovh5nrm-db93uv

Compute the predictive distribution with this new recalibration:

https://wolfram.com/xid/01yyovh5nrm-n4azvd

Load the Boston Homes dataset:

https://wolfram.com/xid/01yyovh5nrm-w7tgbo
Train a predictor with model calibration:

https://wolfram.com/xid/01yyovh5nrm-zudagx

Visualize the comparison plot on a test set:

https://wolfram.com/xid/01yyovh5nrm-4mjeut

Remove the recalibration function from the predictor:

https://wolfram.com/xid/01yyovh5nrm-hdakmq

Visualize the new comparison plot:

https://wolfram.com/xid/01yyovh5nrm-8q81c8

TargetDevice (1)
Train a predictor using a neural network:

https://wolfram.com/xid/01yyovh5nrm-gnlysk
Evaluate the resulting predictor on system's default GPU and look at its AbsoluteTiming:

https://wolfram.com/xid/01yyovh5nrm-4fgmey
Compare the previous timing with the one achieved by using the default CPU computation:

https://wolfram.com/xid/01yyovh5nrm-g2ypu8
UtilityFunction (1)

https://wolfram.com/xid/01yyovh5nrm-i5mnof

https://wolfram.com/xid/01yyovh5nrm-j1o7u

Visualize the probability density for a given example:

https://wolfram.com/xid/01yyovh5nrm-jft9ef


https://wolfram.com/xid/01yyovh5nrm-1n0gd

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

https://wolfram.com/xid/01yyovh5nrm-he3t82

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

https://wolfram.com/xid/01yyovh5nrm-0p1sgu
Plot this function for a given actual value:

https://wolfram.com/xid/01yyovh5nrm-ygfxmi

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

https://wolfram.com/xid/01yyovh5nrm-9k8mb

Update the value of the utility function permanently:

https://wolfram.com/xid/01yyovh5nrm-klr3i4


https://wolfram.com/xid/01yyovh5nrm-hc8qpk

PerformanceGoal (1)
Obtain the built-in PredictorFunction "NameAge":

https://wolfram.com/xid/01yyovh5nrm-2qwl8m

Set a custom utility function to use with this predictor:

https://wolfram.com/xid/01yyovh5nrm-uk9vmz
Compute the time required to use an example with this utility function:

https://wolfram.com/xid/01yyovh5nrm-4jrefl

Use PerformanceGoal to use a faster but less accurate result:

https://wolfram.com/xid/01yyovh5nrm-2gqueu

Wolfram Research (2014), PredictorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/PredictorFunction.html (updated 2021).
Text
Wolfram Research (2014), PredictorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/PredictorFunction.html (updated 2021).
Wolfram Research (2014), PredictorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/PredictorFunction.html (updated 2021).
CMS
Wolfram Language. 2014. "PredictorFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/PredictorFunction.html.
Wolfram Language. 2014. "PredictorFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/PredictorFunction.html.
APA
Wolfram Language. (2014). PredictorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PredictorFunction.html
Wolfram Language. (2014). PredictorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PredictorFunction.html
BibTeX
@misc{reference.wolfram_2025_predictorfunction, author="Wolfram Research", title="{PredictorFunction}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/PredictorFunction.html}", note=[Accessed: 30-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_predictorfunction, organization={Wolfram Research}, title={PredictorFunction}, year={2021}, url={https://reference.wolfram.com/language/ref/PredictorFunction.html}, note=[Accessed: 30-May-2025
]}