SHAP figure not appearing in the artifacts after running the mflow.evaluate() call, despite setting log_model_explainability = True

Ensure that all features are in the expected format and re-run the call.

Written by Guilherme Leite

Last published at: April 24th, 2025

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. 

  1. Convert categorical features to numerical values using encoding techniques. Two common examples are One-Hot encoding or Ordinal encoding. 
  2. Ensure that each feature column contains only scalar values.
  3. After preparing your data, run the mflow.evaluate() call again with log_model_explainability = True
  4. Verify the SHAP figure is now generated in the artifacts.