Main Content

resubMargin

Resubstitution classification margins for discriminant analysis classifier

    Description

    example

    M = resubMargin(mdl) returns resubstitution classification margins for mdl.

    Examples

    collapse all

    Find the margins for a discriminant analysis classifier for Fisher's iris data by resubstitution. Examine several entries.

    Load Fisher's iris data set.

    load fisheriris

    Train a discriminant analysis classifier.

    Mdl = fitcdiscr(meas,species);

    Compute the resubstitution margins, and display several of them.

    m = resubMargin(Mdl);
    m(1:25:end)
    ans = 6×1
    
        1.0000
        1.0000
        0.9998
        0.9998
        1.0000
        0.9946
    
    

    Input Arguments

    collapse all

    Trained discriminant analysis classifier, specified as a ClassificationDiscriminant model object. To create a discriminant analysis classifier, use fitcdiscr.

    Output Arguments

    collapse all

    Classification margins, returned as a numeric column vector of length size(mdl.X,1).

    More About

    collapse all

    Margin

    The classification margin is the difference between the classification score for the true class and maximal classification score for the false classes.

    The classification margin is a column vector with the same number of rows as in the matrix X. A high value of margin indicates a more reliable prediction than a low value.

    Score

    For discriminant analysis, the score of a classification is the posterior probability of the classification. For the definition of posterior probability in discriminant analysis, see Posterior Probability.

    Version History

    Introduced in R2011b

    expand all