The Node class#
These are the collection of different implemented Nodes used by the DecisionTree.
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
|
LeafNode #
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 |
LinearPolynomialLeafNode #
LinearPolynomialLeafNode(id, indices, depth, impurity, weighted_samples, value, parent, theta0, theta1, theta2)
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 |
theta0
|
float
|
theta0 parameter corresponding to intercept term |
required |
theta1
|
float
|
theta1 parameter correponding to linear term |
required |
theta2
|
float
|
theta2 parameter correponding to quadratic term |
required |
Node #
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 |