Back to Mlflow

SHAP Examples

examples/shap/README.md

3.12.01.3 KB
Original Source

SHAP Examples

Examples demonstrating use of the mlflow.shap APIs for model explainability.

FileTaskDescription
regression.pyRegressionLog explanations for a LinearRegression model
binary_classification.pyBinary classificationLog explanations for a binary RandomForestClassifier model
multiclass_classification.pyMulticlass classificationLog explanations for a multiclass RandomForestClassifier model

Prerequisites

Run the following command to install required packages:

pip install mlflow scikit-learn shap matplotlib

How to run the scripts

bash
python <script_name>

How to view the logged explanations:

  • Run mlflow server to launch the MLflow UI.
  • Open http://127.0.0.1:5000 on your browser.
  • Click the latest run in the runs table.
  • Scroll down to the artifact viewer.
  • Open a folder named model_explanations_shap.