Skip to content

Instantly share code, notes, and snippets.

@joshreini1
Last active April 11, 2023 19:46
Show Gist options
  • Save joshreini1/cd70b5203206e8b7a2f526dacab4454e to your computer and use it in GitHub Desktop.
Save joshreini1/cd70b5203206e8b7a2f526dacab4454e to your computer and use it in GitHub Desktop.
# import trushap, and optionally alias as shap to preserve your SHAP code.
from truera.client.experimental.trushap import trushap as shap
# Initialize the explainer.
# Include TruEra authentication (optional) to add the model to your TruEra deployment.
explainer = shap.Explainer(model, connection_string = CONNECTION_STRING, token = TOKEN)
# Calculate shapley values AND add data split to your TruEra deployment.
shap_values = explainer(X, id_col_name = "id")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment