shap.utils.partition_tree_shuffle

shap.utils.partition_tree_shuffle(indexes, index_mask, partition_tree)

Randomly shuffle the indexes in a way that is consistent with the given partition tree.

Parameters:
indexes: np.array

The output location of the indexes we want shuffled. Note that len(indexes) should equal index_mask.sum().

index_mask: np.array

A bool mask of which indexes we want to include in the shuffled list.

partition_tree: np.array

The partition tree we should follow.