Which of the following MLflow operations can be used to automatically calculate and log a Shapley feature importance plot?
Which of the following MLflow operations can be used to automatically calculate and log a Shapley feature importance plot?
The correct operation to use in MLflow for automatically calculating and logging a Shapley feature importance plot is mlflow.shap.log_explanation. This function computes and logs explanations of an ML model’s output using SHAP (SHapley Additive exPlanations), which includes generating and logging the SHAP summary bar plot showing the average impact of each feature on the model output.
Answer A. https://mlflow.org/docs/latest/python_api/mlflow.shap.html#mlflow.shap.log_explanation "... computes and logs explanations of an ML model’s output. Explanations are logged as a directory of artifacts containing the following items generated by SHAP (SHapley Additive exPlanations). - Base values - SHAP values (computed using shap.KernelExplainer) - Summary bar plot (shows the average impact of each feature on model output)"
C is partially correct. However, going with A since it contains the method itself. Using mlflow.shap.log_explanation, you can automatically calculate and log Shapley feature importance plots, providing insights into the importance of different features in the model's predictions.
mlflow.shap: Automatically calculates and logs Shapley feature importance plots. # Generate and log SHAP plot for first 5 records mlflow.shap.log_explanation(rf.predict, X_train[:5])
C. mlflow.shap