Study interactive :: Progress tools open in the Study Hub reader.

All lessons in this module

Previous lesson. Model Explainability Project Tutorial

Model Explainability Quick Reference

Quick reference for model explainability.

SHAP

import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)
shap.summary_plot(shap_values, X_test)

LIME

from lime import lime_tabular
explainer = LimeTabularExplainer(X_train.values, feature_names=feature_names)
explanation = explainer.explain_instance(X_test.iloc[0].values, model.predict_proba)

Try next: Pick the top three important features and write why each could be causal or merely correlated.

All lessons in this module

Previous lesson. Model Explainability Project Tutorial