XGBoost feature importance - only shows two features

I would like to see all of the features in the set I am sending to the XGBoost model in-terms of importance. I seem to only ever see two. The good news is it does look like 2 of the set that should be identified as important. However, I would really like to see all of the features. There are a total of 20 features in the training set. Any help would be greatly appreciated.

import shap
import numpy as np
import matplotlib.pylab as pl

xgb.plot_importance(model,max_num_features=None)
pl.title("xgboost.plot_importance(model)")
pl.show()

When I look at the tuples or booster.get_scores from the model I see the same two:

{'locations': 80, 'avg_loc_dist': 20}

Most likely only these two features are being used in the splits. You can verify this by running xgb.dump_model() to get the text representation of the model.

1 Like