PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
892 stars 165 forks source link

Error while using Custom prediction #187

Closed brrbaral closed 2 years ago

brrbaral commented 2 years ago

Hi. I've got this error "IndexError('index 14 is out of bounds for axis 0 with size 14')". I tried using custom prediction function using keras model with reference to : https://colab.research.google.com/github/pair-code/what-if-tool/blob/master/WIT_COMPAS_with_SHAP.ipynb Here is my code: https://colab.research.google.com/drive/1rgmiCySj2UkwRuitrf0M6SIgfXINx1lp?usp=sharing Thanks.

jameswex commented 2 years ago

Thx for sharing the code. It seems that from a quick look it might be the case that your target column is being stripped out by the witwidget logic before sending the examples to the custom predict function, so you don't need the code in your custom predict fn to delete columns not used by model. Let me know if that helps.

brrbaral commented 2 years ago

Thanks, James for your response. It really worked.