shap.utils.approximate_interactions

shap.utils.approximate_interactions(index: str | int, shap_values: ndarray[tuple[Any, ...], dtype[Any]], X: ndarray[tuple[Any, ...], dtype[Any]] | DataFrame, feature_names: list[str] | ndarray[tuple[Any, ...], dtype[Any]] | Index | None = None) ndarray[tuple[Any, ...], dtype[Any]]

Order other features by how much interaction they seem to have with the feature at the given index.

This just bins the SHAP values for a feature along that feature’s value. For true Shapley interaction index values for SHAP see the interaction_contribs option implemented in XGBoost.