margin
Classification margins
Syntax
m = margin(obj,X,Y)
Description
returns the classification margins for the matrix of predictors m
= margin(obj
,X
,Y
)X
and
class labels Y
. For the definition, see More About.
Input Arguments
|
Discriminant analysis classifier of class |
|
Matrix where each row represents an observation, and each column
represents a predictor. The number of columns in |
|
Class labels, with the same data type as exists in |
Output Arguments
|
Numeric column vector of length |
Examples
Compute the classification margin for the Fisher iris data, trained on its first two columns of data, and view the last 10 entries:
load fisheriris X = meas(:,1:2); obj = fitcdiscr(X,species); M = margin(obj,X,species); M(end-10:end) ans = 0.6551 0.4838 0.6551 -0.5127 0.5659 0.4611 0.4949 0.1024 0.2787 -0.1439 -0.4444
The classifier trained on all the data is better:
obj = fitcdiscr(meas,species); M = margin(obj,meas,species); M(end-10:end) ans = 0.9983 1.0000 0.9991 0.9978 1.0000 1.0000 0.9999 0.9882 0.9937 1.0000 0.9649
More About
Extended Capabilities
See Also
ClassificationDiscriminant
| fitcdiscr
| edge
| loss
| predict