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

NameValue Arguments
Specify optional
commaseparated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.

Indices of weak learners Default: 

A logical matrix of size When Default: 
Output Arguments

Vector of classification labels. 

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 FixedPoint Tool (FixedPoint Designer) to convert a floatingpoint model to fixed point.
Support for variablesize 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 postprocessing before or after predictions in the same MATLAB Function block.
Extended Capabilities
See Also
ClassificationBaggedEnsemble
 CompactClassificationEnsemble
 ClassificationEnsemble
 fitcensemble
 margin
 edge
 loss