stable_cart.explanation_instability

stable_cart.explanation_instability(models, max_depth=3)[source]

How much the structure changes across independently fitted trees.

The headline number is the mean pairwise Jaccard distance between the multisets of features tested down to max_depth: 0 when every fit reads the same, 1 when no two fits share a single tested feature.

Parameters

models

Fitted trees, each from a different training sample. At least two.

max_depth

Deepest level to include; the root is level 0.

Returns

dict[str, float]

jaccard_mean and jaccard_max over all pairs, and distinct_structures — the number of distinct feature multisets seen, divided by the number of fits.

Raises

ValueError

If fewer than two models are supplied.

Parameters:
Return type:

dict[str, float]