Discriminant Analysis Classification
Discriminant analysis is a classification method. It assumes that different classes generate data based on different Gaussian distributions.
To train (create) a classifier, the fitting function estimates the parameters of a Gaussian distribution for each class (see Creating Discriminant Analysis Model).
To predict the classes of new data, the trained classifier finds the class with the smallest misclassification cost (see Prediction Using Discriminant Analysis Models).
Linear discriminant analysis is also known as the Fisher discriminant, named for its inventor, Sir R. A. Fisher [1].
Create Discriminant Analysis Classifiers
This example shows how to train a basic discriminant analysis classifier to classify irises in Fisher's iris data.
Load the data.
load fisheriris
Create a default (linear) discriminant analysis classifier.
MdlLinear = fitcdiscr(meas,species);
To visualize the classification boundaries of a 2-D linear classification of the data, see Create and Visualize Discriminant Analysis Classifier.
Classify an iris with average measurements.
meanmeas = mean(meas); meanclass = predict(MdlLinear,meanmeas)
meanclass = 1x1 cell array
{'versicolor'}
Create a quadratic classifier.
MdlQuadratic = fitcdiscr(meas,species,'DiscrimType','quadratic');
To visualize the classification boundaries of a 2-D quadratic classification of the data, see Create and Visualize Discriminant Analysis Classifier.
Classify an iris with average measurements using the quadratic classifier.
meanclass2 = predict(MdlQuadratic,meanmeas)
meanclass2 = 1x1 cell array
{'versicolor'}
References
[1] Fisher, R. A. "The Use of Multiple Measurements in Taxonomic Problems." Annals of Eugenics, Vol. 7, pp. 179–188, 1936. Available at https://digital.library.adelaide.edu.au/dspace/handle/2440/15227.