www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ViewTrainedRegressionTreeExample.m
%% View Trained Regression Tree % View textual and graphical displays of a trained regression tree. %% % Load the |carsmall| data set. Consider a model that explains a car's % fuel economy (|MPG|) using its weight (|Weight|) and number of cylinders % (|Cylinders|). load carsmall X = [Weight Cylinders]; Y = MPG; %% % Train a regression tree using all measurements. Mdl = fitrtree(X,Y); %% % View textual display of the trained regression tree. view(Mdl) %% % View graphical display of the trained regression tree. view(Mdl,'Mode','graph');