I am developing a credit probability of default model in python and would like to use shap values for generating reasons codes which the worst 3 reason codes.
I found this very useful article on how to do that. It uses ndarray datasets. https://medium.com/@wenzhang.ds/create-reason-code-via-shap-value-for-gmb-model-2e150837c8fe However, the code is giving me error for the pandas data frame I am using and I dont know how to modify the code to ingest pandas data frame. It is failing in this line.
sorted_feature_names = [feature_names[i] for i in sorted_indices]
Feature names I have is a list and it is not indexed.
Can you please help?