plot_shap_summary

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

plot_shap_summary(shap_values: ndarray, features: ndarray, *, feature_names: Sequence[str] | None = None, title: str = 'SHAP summary', max_display: int = 20)[source]

Beeswarm-style SHAP summary for one attribution matrix.

Parameters:
  • shap_values – Attribution matrix of shape (n_samples, n_features).

  • features – Feature matrix aligned with shap_values.

  • feature_names – Optional column names (ASCII-sanitised on draw).

  • title – Figure title (sanitised).

  • max_display – Maximum number of features to show.

Returns:

The matplotlib Figure.

Raises:

HABITAPIError – When shapes disagree or shap is not installed.