bartz.grove.traverse_forest

bartz.grove.traverse_forest(X, var_trees, split_trees, *, index_type)[source]

Find the leaves where points falls into for each tree in a set.

Parameters:
  • X (UInt[Array, 'p n']) – The coordinates to evaluate the trees at.

  • var_trees (UInt[Array, '*forest_shape max_num_leaves']) – The decision axes of the trees.

  • split_trees (UInt[Array, '*forest_shape max_num_leaves']) – The decision boundaries of the trees.

  • index_type (Literal['heap', 'chain']) – The convention of the returned index: ‘heap’ for the index of the leaf node in the heap, ‘chain’ for the index of its value in TreeHeaps.leaf_tree, see node_to_leaf_index.

Returns:

UInt[Array, '*forest_shape n'] – The indices of the leaves, in the smallest unsigned integer type that fits them.