Skip to content
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

"invalid value encountered in true_divide" Warning on Dependence plot #2647

Open
rflameiro opened this issue Aug 16, 2022 · 1 comment
Open
Labels
stale Indicates that there has been no recent activity on an issue

Comments

@rflameiro
Copy link

I saw this Warning when creating a Dependence plot. The plot still shows, I just thought someone might want to look into it, as it seems to be a "Division by zero" Warning.

import sklearn  # version 1.1.2
import shap  # version 0.41.0
import xgboost  # version 1.5.1

X, y = shap.datasets.iris()
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size=0.2, random_state=0)
model = xgboost.XGBClassifier(use_label_encoder=False).fit(X_train, y_train)
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)
shap.dependence_plot(2, 
                     shap_values[0], 
                     X_test.values, 
                     feature_names=X_test.columns)
Copy link

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.

@github-actions github-actions bot added the stale Indicates that there has been no recent activity on an issue label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Indicates that there has been no recent activity on an issue
Projects
None yet
Development

No branches or pull requests

1 participant