AppliedDataSciencePartners / xgboostExplainer

An R package that makes xgboost models fully interpretable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to calculate weights for individual observations.

jakobgerstenlauer opened this issue · comments

I just observed that in the example code given on the medium.com blog, you calculated individual weights by simply calling rowSums(pred.breakdown) on the data set containing the feature contributions.
I think this is not correct because adding negative and positive feature contributions may cancel out effects.

Shouldn't it be s.th like:

weights = apply(pred.breakdown,1,function(x) sum(abs(x)))

I was referring to this blog:
https://medium.com/applied-data-science/new-r-package-the-xgboost-explainer-51dd7d1aa211