Problem
When executing the AutoML-generated code in a notebook, the SHAP figure does not appear in the artifacts after running the mflow.evaluate()
call under the Define an objective function UI section, despite setting log_model_explainability = True
.
You receive the following error message.
<date-timestamp> WARNING mlflow.models.evaluation.default_evaluator: Skip logging model explainability insights because the shap explainer None requires all feature values to be numeric, and each feature column must only contain scalar values.
Cause
The SHAP explainer requires all feature values to be numeric, and each feature column must only contain scalar values. If any categorical or non-scalar features are present, the SHAP figure generation is skipped.
Solution
Ensure that all features are in the expected format and re-run the call.
- Convert categorical features to numerical values using encoding techniques. Two common examples are One-Hot encoding or Ordinal encoding.
- Ensure that each feature column contains only scalar values.
- After preparing your data, run the
mflow.evaluate()
call again withlog_model_explainability = True
. - Verify the SHAP figure is now generated in the artifacts.