bartz.grove.traverse_tree

bartz.grove.traverse_tree(x, var_tree, split_tree, *, index_type)[source]

Find the leaf where a point falls into.

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

  • var_tree (UInt[Array, 'max_num_leaves']) – The decision axes of the tree.

  • split_tree (UInt[Array, 'max_num_leaves']) – The decision boundaries of the tree.

  • 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, ''] – The index of the leaf, in the smallest unsigned integer type that fits it.