New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'Explanation' object has no attribute '_old_format' #1526
Comments
I am receiving the same error, has this been addressed? |
I ran into the same issue as well when using |
Also getting the same error with scikit catboost model. localExplainer = shap.PermutationExplainer(bestModel["m"].predict,transformedMatrix.iloc[:,0:2214])# masker, link=CPUDispatcher()) localExplainer.shap_values(transformedMatrix.iloc[1:2,0:2214]) File "", line 1, in File "C:\Users\Thomas Wolf\anaconda3\envs\ChemPipeline\lib\site-packages\shap\explainers_permutation.py", line 155, in shap_values AttributeError: 'Explanation' object has no attribute '_old_format' |
Same error here... My code: Error: c:\python38\lib\site-packages\shap\explainers_permutation.py in shap_values(self, X, npermutations, main_effects, error_bounds, batch_evals, silent) AttributeError: 'Explanation' object has no attribute '_old_format' If you are using RandomForest as model, inside a pipeline, like me, this could help: |
I removed the method ._old_format() and that solved the problem so it looks like
|
For
|
Replacing with the code above, you will get an explanation with this format as .base_values = .data = then use |
Thanks for the code. My only question would be how do i set the npermutations to a different value here ? |
hi I got same question, and I'm not sure how to remove the methon. Would you mind to explain a little more specific? T.T |
Hit an error while testing shap:
Code:
Causes:
Error at line:
https://github.com/slundberg/shap/blob/491d46a540d16fb5a9868de6be2913599c850167/shap/explainers/_permutation.py#L135
The text was updated successfully, but these errors were encountered: