shap.utils.hclust_ordering

shap.utils.hclust_ordering(X: ndarray[tuple[Any, ...], dtype[Any]], metric: str = 'sqeuclidean', anchor_first: bool = False) ndarray[tuple[Any, ...], dtype[Any]]

A leaf ordering is under-defined, this picks the ordering that keeps nearby samples similar.