margin
Classification margins
Description
returns the classification margins for the table of predictors
m
= margin(tree
,TBL
,ResponseVarName
)TBL
and class labels TBL.ResponseVarName
.
For the definition, see Margin.
Input Arguments
Output Arguments
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);
tree = fitctree(X,species);
M = margin(tree,X,species);
M(end-10:end)
ans = 0.1111 0.1111 0.1111 -0.2857 0.6364 0.6364 0.1111 0.7500 1.0000 0.6364 0.2000
The classification tree trained on all the data is better.
tree = fitctree(meas,species); M = margin(tree,meas,species); M(end-10:end)
ans = 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565 0.9565