DavidR
DavidR

Reputation: 6972

XGBoost model tree value insight

I have created an XGBoost model in Python and been using following code to understand the model better:

xgb.plot_importance(model)

or

xgb.plot_importance(model, importance_type="gain")

I can get an understanding of what parameters had the most value but it seems quite lacking in telling me what those values are.

Suppose I'm trying to determine how many people will rent bikes on a given day. Running the two plot_importance methods above may tell me that 'temperature' and 'day of week' are the most important parameters in determining bike ride amount. What I want to know though is what of those values determined high bike ride count and what values determined low bike ride count.

Upvotes: 0

Views: 225

Answers (1)

Lukasz Tracewski
Lukasz Tracewski

Reputation: 11407

I guess what you're attempting to do is visualise and debug what the algorithm is doing at prediction. For that, I'd recommend checking out ELI5, specifically the part that covers working with XGBoost. For comprehensive example on how to use ELI5 with XGBoost on Titanic data set, check out this link.

In order to explain prediction do the following:

from eli5 import show_prediction
show_prediction(moel, your_prediction, show_feature_values=True)

Upvotes: 1

Related Questions