Skip to content

The Node class#

These are the collection of different implemented Nodes used by the DecisionTree.

Node #

Node(indices, depth, impurity)

The base Node from which all other nodes must inherit.

Parameters:

Name Type Description Default
indices ndarray

indices in node

required
depth int

depth of node

required
impurity float

impurity of node

required

LeafNode #

LeafNode(id, indices, depth, impurity, weighted_samples, value, parent)

Parameters:

Name Type Description Default
id int

unique identifier of leaf node

required
indices ndarray

indices in leaf node

required
depth int

depth of leaf node

required
impurity float

impurity of leaf node

required
weighted_samples float

summed weight of all samples in leaf node

required
value ndarray

value of leaf node (depends on LeafBuilder)

required
parent DecisionNode

parent node

required

DecisionNode #

DecisionNode(indices, depth, impurity, threshold, split_idx, left_child=None, right_child=None, parent=None)

Parameters:

Name Type Description Default
indices ndarray

indices in node

required
depth int

depth of node

required
impurity float

impurity in node

required
threshold float

threshold value of a split

required
split_idx int

feature index to split on

required
left_child DecisionNode | LeafNode | None

left child

None
right_child DecisionNode | LeafNode | None

right child

None
parent DecisionNode | None

parent node

None