Main Content

predictorImportance

Estimates of predictor importance for classification ensemble of decision trees

Description

example

imp = predictorImportance(ens) 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.

example

[imp,ma] = predictorImportance(ens) additionally returns a P-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.

Input Arguments

expand all

Full classification ensemble model, specified as a ClassificationEnsemble model object trained with fitcensemble, or a CompactClassificationEnsemble model object created with compact.

Output Arguments

expand all

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, with 0 representing the smallest possible importance.

Predictive measures of association, returned as a P-by-P matrix of Predictive Measure of Association values for P predictors. 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. predictorImportance averages this predictive measure of association over all trees in the ensemble.

Examples

expand all

Estimate the predictor importance for all variables in the Fisher iris data.

Load Fisher"s iris data set.

load fisheriris

Train a classification ensemble using AdaBoostM2. Specify tree stumps as the weak learners.

t = templateTree(MaxNumSplits=1);
ens = fitcensemble(meas,species,Method="AdaBoostM2",Learners=t);

Estimate the predictor importance for all predictor variables.

imp = predictorImportance(ens)
imp = 1×4

    0.0004    0.0016    0.1266    0.0324

The first two predictors are not very important in the ensemble.

Estimate the predictor importance for all variables in the Fisher iris data for an ensemble where the trees contain surrogate splits.

Load Fisher's iris data set.

load fisheriris

Grow an ensemble of 100 classification trees using AdaBoostM2. Specify tree stumps as the weak learners, and also identify surrogate splits.

t = templateTree('MaxNumSplits',1,'Surrogate','on');
ens = fitcensemble(meas,species,'Method','AdaBoostM2','Learners',t);

Estimate the predictor importance and predictive measures of association for all predictor variables.

[imp,ma] = predictorImportance(ens)
imp = 1×4

    0.0674    0.0417    0.1582    0.1537

ma = 4×4

    1.0000         0         0         0
    0.0115    1.0000    0.0022    0.0054
    0.3186    0.2137    1.0000    0.6391
    0.0392    0.0073    0.1137    1.0000

The first two predictors show much more importance than the analysis in Estimate Predictor Importance.

More About

expand all

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 predictor j, 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