stable_cart.split_features

stable_cart.split_features(model, max_depth=3)[source]

Return the multiset of features tested down to a given depth.

A multiset rather than a set: a feature tested at three different nodes is a more central part of the explanation than one tested once, and collapsing that to a set would hide it.

Parameters

model

A fitted tree.

max_depth

Deepest level to include; the root is level 0.

Returns

Counter

Feature index -> number of nodes testing it.

Parameters:
Return type:

Counter