Skip to content

Branch

A generic tree branch.

Parameters

  • children

    Child branches and/or leaves.

Attributes

  • height

    Distance to the deepest descendant.

  • n_branches

    Number of branches, including thyself.

  • n_leaves

    Number of leaves.

  • n_nodes

    Number of descendants, including thyself.

  • repr_split

    String representation of the split.

Methods

clone

Return a fresh estimator with the same parameters.

The clone has the same parameters but has not been updated with any data. This works by looking at the parameters from the class signature. Each parameter is either - recursively cloned if it's a River classes. - deep-copied via copy.deepcopy if not. If the calling object is stochastic (i.e. it accepts a seed parameter) and has not been seeded, then the clone will not be idempotent. Indeed, this method's purpose if simply to return a new instance with the same input parameters.

iter_bfs

Iterate over nodes in breadth-first order.

iter_branches

Iterate over branches in depth-first order.

iter_dfs

Iterate over nodes in depth-first order.

iter_edges

Iterate over edges in depth-first order.

iter_leaves

Iterate over leaves from the left-most one to the right-most one.

most_common_path

Return a tuple with the branch index and the child node related to the most traversed path.

Used in case the split feature is missing from an instance.

next

Move to the next node down the tree.

Parameters

  • x
to_dataframe

Build a DataFrame containing one record for each node.

traverse

Return the leaf corresponding to the given input.

Parameters

  • x
  • until_leaf – defaults to True
walk

Iterate over the nodes of the path induced by x.

Parameters

  • x
  • until_leaf – defaults to True