linkedin / FastTreeSHAP

Fast SHAP value computation for interpreting tree-based models
BSD 2-Clause "Simplified" License
512 stars 31 forks source link

cannot slice shap values like SHAP package #35

Open chinaidf opened 4 months ago

chinaidf commented 4 months ago

Hi, I am using fasttreeshap v0.1.6 package to calculate the shap values of my random forest model. It really accelerate the shap value calculation substantially. However, when I tried to produce the scatter or dependence plots, I cannot extract a single column of the shap values (e.g., shap_values[:, 0] or shap_values[:, feature1]). I got an IndexError: index 1 is out of bounds for axis 1 with size 1.

chinaidf commented 4 months ago

I have re-created the shap Explanation object and I found the base_values array is a 2-dimensional array but the SHAP-generated base_values is a 1-dimensional array. I have squeezed the base_values array and the error is corrected.