Skip to content

Instantly share code, notes, and snippets.

@oegedijk
Created February 17, 2021 12:41
Show Gist options
  • Save oegedijk/6a1c157c019f7eb8afecf1382d7a8cad to your computer and use it in GitHub Desktop.
Save oegedijk/6a1c157c019f7eb8afecf1382d7a8cad to your computer and use it in GitHub Desktop.
import shap
model = RandomForestClassifier().fit(X_train, y_train)
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment