predict
Classify observations using ensemble of classification models
Description
uses
additional options specified by one or more labels
= predict(Mdl
,X
,Name,Value
)Name,Value
pair
arguments.
[
also returns a matrix of classification scores
(labels
,scores
]
= predict(___)scores
), indicating the likelihood that a label comes from
a particular class, using any of the input arguments in the previous syntaxes. For
each observation in X
, the predicted class label corresponds to
the maximum score among all classes.
Input Arguments
|
A classification ensemble created by |
|
Predictor data to be classified, specified as a numeric matrix or table. Each row of
|
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
|
Indices of weak learners Default: |
|
A logical matrix of size When Default: |
| Indication to perform inference in parallel, specified as Default: |
Output Arguments
|
Vector of classification labels. The |
|
A matrix with one row per observation and one column per class. For each observation and each class, the score represents the confidence that the observation originates from that class. A higher score indicates a higher confidence. For more information, see Score (ensemble). |
Examples
More About
Alternative Functionality
Simulink Block
To integrate the prediction of an ensemble into Simulink®, you can use the ClassificationEnsemble Predict block in the Statistics and Machine Learning Toolbox™ library or a MATLAB® Function block with the predict
function. For
examples, see Predict Class Labels Using ClassificationEnsemble Predict Block and Predict Class Labels Using MATLAB Function Block.
When deciding which approach to use, consider the following:
If you use the Statistics and Machine Learning Toolbox library block, you can use the Fixed-Point Tool (Fixed-Point Designer) to convert a floating-point model to fixed point.
Support for variable-size arrays must be enabled for a MATLAB Function block with the
predict
function.If you use a MATLAB Function block, you can use MATLAB functions for preprocessing or post-processing before or after predictions in the same MATLAB Function block.
Extended Capabilities
Version History
Introduced in R2011a