This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Class: ClassificationDiscriminant

Compact discriminant analysis classifier


cobj = compact(obj)


cobj = compact(obj) creates a compact version of obj.

Input Arguments


Discriminant analysis classifier created using fitcdiscr.

Output Arguments


Compact classifier. cobj has class CompactClassificationDiscriminant. You can predict classifications using cobj exactly as you can using obj. However, since cobj does not contain training data, you cannot perform some actions, such as cross validation.


Compare the size of the discriminant analysis classifier for Fisher's iris data to the compact version of the classifier:

load fisheriris
fullobj = fitcdiscr(meas,species);
cobj = compact(fullobj);
b = whos('fullobj'); % b.bytes = size of fullobj
c = whos('cobj'); % c.bytes = size of cobj
[b.bytes c.bytes] % shows cobj uses 60% of the memory

ans =
       18578       11498