Implementing a SHAP explanation using the MLflow artifact logging API
MLflow has a generic tracking API that can log any artifact: mlflow.log_artifact
. However, the examples given in the MLflow documentation usually use scikit-learn and tabular numerical data for training, testing, and explaining. Here, we want to show how to use mlflow.log_artifact
for an NLP sentimental DL model to log relevant artifacts, such as Shapley value arrays and Shapley value bar plots. You can check out the Python VS Code notebook, shap_mlflow_log_artifact.py
, in this chapter's GitHub repository (https://github.com/PacktPublishing/Practical-Deep-Learning-at-Scale-with-MLFlow/blob/main/chapter10/notebooks/shap_mlflow_log_artifact.py) to follow along with the steps:
- Make sure you have the prerequisites, including a local full-fledged MLflow server and the conda virtual environment, ready. Follow the instructions in the
README.md
(https://github.com/PacktPublishing/Practical-Deep-Learning-at-Scale...