stable_cart.split_feature_paths

stable_cart.split_feature_paths(model, X)[source]

Return the feature sequence each row is tested against on its way to a leaf.

This is the explanation an individual case receives — “you were declined because of X, then Y” — so it is the right unit when the audience is the subject of a decision rather than the modeler.

Parameters

model

A fitted tree.

X

Rows to route through the tree.

Returns

list[tuple[int, …]]

One tuple of feature indices per row.

Raises

TypeError

If no readable tree structure can be found on the object.

Parameters:
  • model (Any)

  • X (NDArray[floating])

Return type:

list[tuple[int, …]]