0

I am using XGBClassifier with

GridSearchCV(cv=KFold(n_splits=5, random_state=42, shuffle=True))

I want to explore variable importance.

Why does

model.best_estimator_.feature_importances_

give different values compared to the values returned from

model.best_estimator_.get_booster().get_score(importance_type='type')

for any type ['gain', 'weight', 'cover'] of feature importance used?

I would expect that the former uses one of the 3 types and thus in one case results overlap.

Flavia Giammarino
  • 7,987
  • 11
  • 30
  • 40
Vicky
  • 33
  • 5

0 Answers0