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

Creates table summarizing the top_k positive and top_k negative contributing features to the prediction of a single datapoint.

XGBoost models and CatBoost multiclass classifiers are not currently supported.

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

  • input_features (pd.DataFrame) – Dataframe of features - needs to correspond to data the pipeline was fit on.

  • top_k (int) – How many of the highest/lowest features to include in the table.

  • training_data (pd.DataFrame) – Training data the pipeline was fit on. This is required for non-tree estimators because we need a sample of training data for the KernelSHAP algorithm.

  • include_shap_values (bool) – Whether the SHAP values should be included in an extra column in the output. Default is False.

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


str or dict - A report explaining the most positive/negative contributing features to the predictions.