www.gusucode.com > stats 源码程序 matlab案例代码 > stats/PruneADecisionTreeExample.m

    %% Prune a Decision Tree
%%
% Display the full tree for Fisher's iris data:

% Copyright 2015 The MathWorks, Inc.

load fisheriris;
t1 = classregtree(meas,species,...
                  'names',{'SL' 'SW' 'PL' 'PW'},...
                  'minparent',5)
view(t1)
%%
% Display the next largest tree from the optimal pruning sequence:
t2 = prune(t1,'level',1)
view(t2)