evalml.pipelines.prediction_explanations.explain_prediction

evalml.pipelines.prediction_explanations.explain_prediction(pipeline, input_features, top_k=3, training_data=None, include_shap_values=False)[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.

Parameters
  • 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.

Returns

Table

Return type

str