www.gusucode.com > stats 源码程序 matlab案例代码 > stats/EstimatePredictorImportanceEnsExample.m
%% Estimate Predictor Importance % Estimate the predictor importance for all predictor variables in the % data. %% % Load the |carsmall| data set. load carsmall %% % Grow an ensemble of 100 regression trees for |MPG| using |Acceleration|, |Cylinders|, % |Displacement|, |Horsepower|, |Model_Year|, and |Weight| as predictors. X = [Acceleration Cylinders Displacement Horsepower Model_Year Weight]; ens = fitensemble(X,MPG,'LSBoost',100,'Tree'); %% % Estimate the predictor importance for all predictor variables. imp = predictorImportance(ens) %% % |Weight|, the last predictor, has the most impact on mileage. The second % predictor has importance 0, which means that the number of cylinders has % no impact on predictions made with |ens|.