Mrinal Mahajan
Mrinal Mahajan

Reputation: 23

gradient boosting- features contribution

Is there a way in python by which I can get contribution of each feature in probability predicted by my gradient boosting classification model for each test observation. Can anyone give actual mathematics behind probability prediction in gradient boosting classification model and how can it be implemented in Python.

Upvotes: 1

Views: 1726

Answers (3)

Pradeep Mahato
Pradeep Mahato

Reputation: 51

Try Shapley values. There is a python package as well which does the approximation and should provide you a detailed breakdown.

Upvotes: 0

bbennett36
bbennett36

Reputation: 6345

Here you go bud, this is exactly what you're looking for :)
https://github.com/slundberg/shap

One note though, you mention you want to see how each feature contributed to a probability which is going to be very hard to do since it's usually a combination of features that is determining the probability. Either way, I think the package above will show you what you want to see.

Upvotes: 0

Binyamin Even
Binyamin Even

Reputation: 3382

Use the feature_importances_ property. Very easy.

Upvotes: 1

Related Questions