This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Class: ClassificationDiscriminant

Predict resubstitution response of classifier


label = resubPredict(obj)
[label,posterior] = resubPredict(obj)
[label,posterior,cost] = resubPredict(obj)


label = resubPredict(obj) returns the labels obj predicts for the data obj.X. label is the predictions of obj on the data that fitcdiscr used to create obj.

[label,posterior] = resubPredict(obj) returns the posterior class probabilities for the predictions.

[label,posterior,cost] = resubPredict(obj) returns the predicted misclassification costs per class for the resubstituted data.

Input Arguments


Discriminant analysis classifier, produced using fitcdiscr.

Output Arguments


Response obj predicts for the training data. label is the same data type as the training response data obj.Y. The predicted class labels are those with minimal expected misclassification cost; see Prediction Using Discriminant Analysis Models.


N-by-K matrix of posterior probabilities for classes obj predicts, where N is the number of observations and K is the number of classes.


N-by-K matrix of predicted misclassification costs. Each cost is the average misclassification cost with respect to the posterior probability.


Find the total number of misclassifications of the Fisher iris data for a discriminant analysis classifier:

load fisheriris
obj = fitcdiscr(meas,species);
Ypredict = resubPredict(obj); % the predictions
Ysame = strcmp(Ypredict,species); % true when ==
sum(~Ysame) % how many are different?

ans =


expand all

Was this topic helpful?