Create a Compact Classification Tree
Compare the size of the classification tree for Fisher's iris data to the compact version of the tree.
load fisheriris fulltree = fitctree(meas,species); ctree = compact(fulltree); b = whos('fulltree'); % b.bytes = size of fulltree c = whos('ctree'); % c.bytes = size of ctree [b.bytes c.bytes] % shows ctree uses half the memory
ans = 1×2 11931 5266
ctree — Compact decision tree
Compact decision tree, returned as a
You can predict classifications using
ctree exactly as you can
tree. However, since
ctree does not contain
training data, you cannot perform some actions, such as cross validation.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Introduced in R2011a