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)[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 (pd.DataFrame) – Dataframe of input data to evaluate the pipeline on.

  • training_data (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.

Returns

str - A report with the pipeline name and parameters and a table for each row of input_features.

The table will have the following columns: Feature Name, Contribution to Prediction, SHAP Value (optional), and each row of the table will be a feature.