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.

example

[[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

collapse all

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

collapse all

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

expand all

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.

Model Type Model Objects Object Functions
Discriminant analysis classification model ClassificationDiscriminant resubEdge, resubLoss, resubMargin, resubPredict
ClassificationPartitionedModel kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
Ensemble of discriminant analysis learners for classification ClassificationEnsemble resubEdge, resubLoss, resubMargin, resubPredict
ClassificationPartitionedEnsemble kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
Gaussian kernel classification model ClassificationPartitionedKernel kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
ClassificationPartitionedKernelECOC kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
Linear classification model ClassificationPartitionedLinear kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
ClassificationPartitionedLinearECOC kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
Neural network classification model ClassificationNeuralNetwork resubEdge, resubLoss, resubMargin, resubPredict
ClassificationPartitionedModel kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict
Support vector machine (SVM) classification model ClassificationSVM resubEdge, resubLoss, resubMargin, resubPredict
ClassificationPartitionedModel kfoldEdge, kfoldLoss, kfoldMargin, kfoldPredict

In previous releases, the software omitted observations with missing predictor values from the resubstitution and cross-validation computations.