We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Linear explainer with Impute masker will fail due to dimension misalignment in the transform matrices.
To reproduce error:
from shap import Explainer from shap.datasets import iris from sklearn.linear_model import LogisticRegression model = LogisticRegression(max_iter=1000) model.fit(*iris()) masker = shap.maskers.Impute(data=X_test) explainer = shap.Explainer( model, masker=masker, feature_names=X_train.columns, algorithm="linear" )
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-15-82cb4b1256dc> in <module> 9 10 explainer = shap.Explainer( ---> 11 model, masker=masker, feature_names=X_train.columns, algorithm="linear" 12 ) ~/anaconda3/lib/python3.7/site-packages/shap/explainers/_explainer.py in __init__(self, model, masker, link, algorithm, output_names, feature_names, **kwargs) 165 elif algorithm == "linear": 166 self.__class__ = explainers.Linear --> 167 explainers.Linear.__init__(self, self.model, self.masker, link=self.link, feature_names=self.feature_names, **kwargs) 168 else: 169 raise Exception("Unknown algorithm type passed: %s!" % algorithm) ~/anaconda3/lib/python3.7/site-packages/shap/explainers/_linear.py in __init__(self, model, masker, link, nsamples, feature_perturbation, **kwargs) 145 self.mean = self.mean[self.valid_inds] 146 self.cov = self.cov[:,self.valid_inds][self.valid_inds,:] --> 147 self.coef = self.coef[self.valid_inds] 148 149 # group perfectly redundant variables together IndexError: index 3 is out of bounds for axis 0 with size 3
The text was updated successfully, but these errors were encountered:
This issue has been inactive for two years, so it's been automatically marked as 'stale'.
We value your input! If this issue is still relevant, please leave a comment below. This will remove the 'stale' label and keep it open.
If there's no activity in the next 90 days the issue will be closed.
Sorry, something went wrong.
This issue has been automatically closed due to lack of recent activity.
Your input is important to us! Please feel free to open a new issue if the problem persists or becomes relevant again.
No branches or pull requests
Linear explainer with Impute masker will fail due to dimension misalignment in the transform matrices.
To reproduce error:
The text was updated successfully, but these errors were encountered: