margin
Classification margins for discriminant analysis classifier
Syntax
Description
Examples
Classification Margin
Compute the classification margin for the Fisher iris data.
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
Compute the classification margin for the Fisher iris data, trained on its first two columns of data, and view the last 10 entries:
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
Input Arguments
mdl
— Trained discriminant analysis classifier
ClassificationDiscriminant
model object | CompactClassificationDiscriminant
model object
Trained discriminant analysis classifier, specified as a ClassificationDiscriminant
or CompactClassificationDiscriminant
model object trained with fitcdiscr
.
X
— Predictor data
matrix
Predictor data to classify, specified as a matrix. Each row of the matrix represents an
observation, and each column represents a predictor. The number of columns in
X
must equal the number of predictors in
mdl
.
Y
— Class labels
same data type as in mdl
Class labels, specified with the same data type as data in mdl
.
The number of elements of Y
must equal the number of rows of
X
.
Output Arguments
More About
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 (discriminant analysis)
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.
Extended Capabilities
Tall Arrays
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
Version History
Introduced in R2011b
See Also
Classes
Functions
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)