resubPredict - Classify observations in discriminant analysis classifier by
resubstitution - MATLAB ([original](http://www.mathworks.com/help/stats/classificationdiscriminant.resubpredict.html)) ([raw](?raw))
Classify observations in discriminant analysis classifier by resubstitution
Syntax
Description
[label](#mw%5Fdcd832a3-fe3b-4cd1-b904-81674cb37b47) = resubPredict([Mdl](#mw%5Fbb1be037-930e-4f8d-870a-db3c2573e3de))
returns a vector of predicted class labels for the trained discriminant analysis classifierMdl
using the predictor data stored in Mdl.X
.label
has the same data type as the training response dataMdl.Y
, and the same number of entries as the number of rows inMdl.X
.
[[label](#mw%5Fdcd832a3-fe3b-4cd1-b904-81674cb37b47),[posterior](#mw%5F15db536c-dcea-43c8-ae06-04db6cbcfc77)] = resubPredict([Mdl](#mw%5Fbb1be037-930e-4f8d-870a-db3c2573e3de),___)
also returns the posterior class probabilities for the predictors.
[[label](#mw%5Fdcd832a3-fe3b-4cd1-b904-81674cb37b47),[posterior](#mw%5F15db536c-dcea-43c8-ae06-04db6cbcfc77),[cost](#mw%5F54014010-5e10-4786-a09d-b2a2f7b8b0dc)] = resubPredict([Mdl](#mw%5Fbb1be037-930e-4f8d-870a-db3c2573e3de))
also returns the predicted misclassification costs per class for the resubstituted data.
Examples
Find the total number of misclassifications of the Fisher iris data for a discriminant analysis classifier.
Create a classification model for the Fisher iris data.
load fisheriris Mdl = fitcdiscr(meas,species);
Predict resubstitution labels of the model.
Ypredict = resubPredict(Mdl);
Find the total number of different misclassifications.
Ysame = strcmp(Ypredict,species); % true when == sum(~Ysame) % how many are different?
Input Arguments
Output Arguments
Predicted class labels, returned as a categorical or character array, logical or numeric vector, or cell array of character vectors.
label
has the same data type asMdl.ClassNames
and the same number of rows asMdl.X
. The predicted class labels are those with minimal expected misclassification cost. See Prediction Using Discriminant Analysis Models.
Posterior probabilities for classes predicted by Mdl
, returned as an N
-by-K
matrix. N
is the number of observations, and K
is the number of classes.
Predicted misclassification costs, returned as anN
-by-K
matrix. N
is the number of observations, and K
is the number of classes. Each cost is the average misclassification cost with respect to the posterior probability.
Version History
Introduced in R2011b
Starting in R2023b, the following classification model object functions use observations with missing predictor values as part of resubstitution ("resub") and cross-validation ("kfold") computations for classification edges, losses, margins, and predictions.
In previous releases, the software omitted observations with missing predictor values from the resubstitution and cross-validation computations.