# How is gain computed in XGBoost regressor?

When you train your XGBoost regression model, you can obtain feature importances by using:

model.get_score(importance_type="gain")


Although I tried to reconstruct the value and have done some research on it, I am still struggling to figure out, how gain is computed in XGBoost?

It is partially explained here: Relative variable importance for Boosting

But this is focused on classification. And even though there is a link saying that squared error with Friedman's improvement score is used, I have not reached the same numbers.

• I need to edit that answer of mine. In fact, regression trees are always used in boosting. So it is subtly incorrect. – Matthew Drury Sep 7 '17 at 14:42