predictorImportance - Estimates of predictor importance for regression ensemble of decision
trees - MATLAB ([original](http://www.mathworks.com/help/stats/classreg.learning.regr.compactregressionensemble.predictorimportance.html)) ([raw](?raw))
Estimates of predictor importance for regression ensemble of decision trees
Syntax
Description
[imp](#mw%5Fc1ea792c-76e6-4c65-b566-198de5337a50) = predictorImportance([ens](#bst1m5s-1%5Fsep%5Fmw%5Fb869adce-d5c8-4b82-a9d5-6d59e93f9a76))
computes estimates of predictor importance for ens
by summing the estimates over all weak learners in the ensemble.imp
has one element for each input predictor in the data used to train the ensemble. A high value indicates that the predictor is important for ens
.
[[imp](#mw%5Fc1ea792c-76e6-4c65-b566-198de5337a50),[ma](#mw%5Fcd132d9f-8240-41d9-ba72-c4fd4959b921)] = predictorImportance([ens](#bst1m5s-1%5Fsep%5Fmw%5Fb869adce-d5c8-4b82-a9d5-6d59e93f9a76))
additionally returns aP
-by-P
matrix with predictive measures of association ma
for P
predictors, when the learners in ens
contain surrogate splits. For more information, see Predictor Importance.
Examples
Estimate the predictor importance for all predictor variables in the data.
Load the carsmall
data set.
Grow an ensemble of 100 regression trees for MPG
using Acceleration
, Cylinders
, Displacement
, Horsepower
, Model_Year
, and Weight
as predictors. Specify tree stumps as the weak learners.
X = [Acceleration Cylinders Displacement Horsepower Model_Year Weight]; t = templateTree(MaxNumSplits=1); ens = fitrensemble(X,MPG,Method="LSBoost",Learners=t);
Estimate the predictor importance for all predictor variables.
imp = predictorImportance(ens)
imp = 1×6
0.0150 0 0.0066 0.1111 0.0437 0.5181
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
.
Estimate the predictor importance for all variables in the data and where the regression tree ensemble contains surrogate splits.
Load the carsmall
data set.
Grow an ensemble of 100 regression trees for MPG
using Acceleration
, Cylinders
, Displacement
, Horsepower
, Model_Year
, and Weight
as predictors. Specify tree stumps as the weak learners, and also identify surrogate splits.
X = [Acceleration Cylinders Displacement Horsepower Model_Year Weight]; t = templateTree(MaxNumSplits=1,Surrogate="on"); ens = fitrensemble(X,MPG,Method="LSBoost",Learners=t);
Estimate the predictor importance and predictive measures of association for all predictor variables.
[imp,ma] = predictorImportance(ens)
imp = 1×6
0.2141 0.3798 0.4369 0.6498 0.3728 0.5700
ma = 6×6
1.0000 0.0098 0.0102 0.0098 0.0033 0.0067
0 1.0000 0 0 0 0
0.0056 0.0084 1.0000 0.0078 0.0022 0.0084
0.3537 0.4769 0.5834 1.0000 0.1612 0.5827
0.0061 0.0070 0.0063 0.0064 1.0000 0.0056
0.0154 0.0296 0.0533 0.0447 0.0070 1.0000
Comparing imp
to the results in Estimate Predictor Importance, Horsepower
has the greatest impact on mileage, with Weight
having the second greatest impact.
Input Arguments
Output Arguments
Predictor importance estimates, returned as a numeric row vector with the same number of elements as the number of predictors (columns) in ens.X
. The entries are the estimates of Predictor Importance, with0
representing the smallest possible importance.
Predictive measures of association, returned as aP
-by-P
matrix ofPredictive Measure of Association values forP
predictors. Elementma(I,J)
is the predictive measure of association averaged over surrogate splits on predictorJ
for which predictorI
is the optimal split predictor.predictorImportance
averages this predictive measure of association over all trees in the ensemble.
More About
predictorImportance
estimates predictor importance for each tree learner in the ensemble ens
and returns the weighted average imp
computed usingens.TrainedWeight
. The outputimp
has one element for each predictor.
predictorImportance
computes importance measures of the predictors in a tree by summing changes in the node risk due to splits on every predictor, and then dividing the sum by the total number of branch nodes. The change in the node risk is the difference between the risk for the parent node and the total risk for the two children. For example, if a tree splits a parent node (for example, node 1) into two child nodes (for example, nodes 2 and 3), then predictorImportance
increases the importance of the split predictor by
(R1 –R2 –R3)/_N_branch,
where Ri is node risk of node_i_, and _N_branch is the total number of branch nodes. A node risk is defined as a node error weighted by the node probability:
Ri =Pi Ei,
where Pi is the node probability of node i, and Ei is the mean squared error of node i.
The estimates of predictor importance depend on whether you use surrogate splits for training.
- If you use surrogate splits,
predictorImportance
sums the changes in the node risk over all splits at each branch node, including surrogate splits. If you do not use surrogate splits, then the function takes the sum over the best splits found at each branch node. - Estimates of predictor importance do not depend on the order of predictors if you use surrogate splits, but do depend on the order if you do not use surrogate splits.
The predictive measure of association is a value that indicates the similarity between decision rules that split observations. Among all possible decision splits that are compared to the optimal split (found by growing the tree), the best surrogate decision split yields the maximum predictive measure of association. The second-best surrogate split has the second-largest predictive measure of association.
Suppose xj and xk are predictor variables j and k, respectively, and j ≠ k. At node t, the predictive measure of association between the optimal split xj < u and a surrogate split xk < v is
- PL is the proportion of observations in node t, such that xj < u. The subscript L stands for the left child of node t.
- PR is the proportion of observations in node t, such that xj ≥ u. The subscript R stands for the right child of node t.
- PLjLk is the proportion of observations at node t, such that xj < u and xk < v.
- PRjRk is the proportion of observations at node t, such that xj ≥ u and xk ≥ v.
- Observations with missing values for xj or xk do not contribute to the proportion calculations.
λjk is a value in (–∞,1]. If λjk > 0, then xk < v is a worthwhile surrogate split for xj < u.
Algorithms
Element ma(i,j)
is the predictive measure of association averaged over surrogate splits on predictor j
for which predictor i
is the optimal split predictor. This average is computed by summing positive values of the predictive measure of association over optimal splits on predictor i
and surrogate splits on predictorj
, and dividing by the total number of optimal splits on predictor i
, including splits for which the predictive measure of association between predictors i
and j
is negative.
Extended Capabilities
Version History
Introduced in R2011a