plot_shap_force

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_force(shap_values: ndarray, features: ndarray, sample_index: int, *, feature_names: Sequence[str] | None = None, base_value: float = 0.0, title: str | None = None)[source]

Static matplotlib force plot for one sample.

Interactive JS/HTML force plots are not returned – this is the print-safe matplotlib=True form.

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

  • features – Feature matrix aligned with shap_values.

  • sample_index – Row to explain.

  • feature_names – Optional column names.

  • base_value – Explainer base value (positive class).

  • title – Optional figure title.

Returns:

The matplotlib Figure.