Main Content

compact

Reduce size of discriminant analysis classifier

Description

CMdl = compact(Mdl) returns a CompactClassificationDiscriminant version of the trained discriminant analysis classifier Mdl.

You can predict classifications using the CompactClassificationDiscriminant object CMdl in the same way as when you use Mdl. However, because CMdl does not contain training data, you cannot perform some actions, such as cross-validation.

example

Examples

collapse all

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

Input Arguments

collapse all

Full discriminant analysis classifier, specified as a ClassificationDiscriminant model object trained with fitcdiscr.

Version History

Introduced in R2011b