Documentation |
m = margin(mdl,X,Y)
m = margin(mdl,X,Y) returns the classification margins for the matrix of predictors X and class labels Y. For the definition, see Margin.
m |
Numeric column vector of length size(X,1). Each entry in m represents the margin for the corresponding rows of X and (true class) Y, computed using mdl. |
The classification margin is the difference between the classification score for the true class and maximal classification score for the false classes.
The score of a classification is the posterior probability of the classification. The posterior probability is the number of neighbors that have that classification, divided by the number of neighbors. For a more detailed definition that includes weights and prior probabilities, see Posterior Probability.