Interpreting XGB feature importance and SHAP values

Viewed 543

For a particular prediction problem, I observed that a certain variable ranks high in the XGBoost feature importance that gets generated (on the basis of Gain) while it ranks quite low in the SHAP output.

How to interpret this? As in, is the variable highly important or not that important for our prediction problem?

1 Answers

Impurity-based importances (such as sklearn and xgboost built-in routines) summarize the overall usage of a feature by the tree nodes. This naturally gives more weight to high cardinality features (more feature values yield more possible splits), while gain may be affected by tree structure (node order matters even though predictions may be same). There may be lots of splits with little effect on the prediction or the other way round (many splits diluting the average importance) - see https://towardsdatascience.com/interpretable-machine-learning-with-xgboost-9ec80d148d27 and https://www.actuaries.digital/2019/06/18/analytics-snippet-feature-importance-and-the-shap-approach-to-machine-learning-models/ for various mismatch examples.

In an oversimplified way:

  • impurity-base importance explains the feature usage for generalizing on the train set;
  • permutation importance explains the contribution of a feature to the model accuracy;
  • SHAP explains how much would changing a feature value affect the prediction (not necessarily correct).
Related