evalml.model_understanding.prediction_explanations.explain_predictions

evalml.model_understanding.prediction_explanations.explain_predictions(pipeline, input_features, training_data=None, top_k_features=3, include_shap_values=False, output_format='text')[source]

Creates a report summarizing the top contributing features for each data point in the input features.

XGBoost models and CatBoost multiclass classifiers are not currently supported.

Parameters
  • pipeline (PipelineBase) – Fitted pipeline whose predictions we want to explain with SHAP.

  • input_features (ww.DataTable, pd.DataFrame) – Dataframe of input data to evaluate the pipeline on.

  • training_data (ww.DataTable, pd.DataFrame) – Dataframe of data the pipeline was fit on. This can be omitted for pipelines with tree-based estimators.

  • top_k_features (int) – How many of the highest/lowest contributing feature to include in the table for each data point.

  • include_shap_values (bool) – Whether SHAP values should be included in the table. Default is False.

  • output_format (str) – Either “text” or “dict”. Default is “text”.

Returns

str or dict - A report explaining the top contributing features to each prediction for each row of input_features.

The report will include the feature names, prediction contribution, and SHAP Value (optional).