Skip to content

Node

Module: strata.tree • Kind: struct • Traits: Copyable, Movable
Source: strata/tree/tree.mojo

struct Node(Copyable, Movable)
from strata.tree import Node

A single split or leaf node in a decision tree.


def __init__(out self)
def __init__(
out self,
value_reg: Float64,
impurity: Float64,
n_node_samples: Int,
)

Constructs a regression leaf node.

Argument Type Description
value_reg Float64 —
impurity Float64 —
n_node_samples Int —
def __init__(
out self,
var class_counts: List[Int],
var class_probabilities: List[Float64],
impurity: Float64,
n_node_samples: Int,
)

Constructs a classification leaf node.

Argument Type Description
impurity Float64 —
n_node_samples Int —
def __init__(
out self,
feature_idx: Int,
threshold: Float64,
left_child: Int,
right_child: Int,
impurity: Float64,
n_node_samples: Int,
value_reg: Float64 = 0.0,
var class_counts: List[Int] = List[Int](),
var class_probabilities: List[Float64] = List[Float64](),
)

Constructs an internal decision split node.

Argument Type Description
feature_idx Int —
threshold Float64 —
left_child Int —
right_child Int —
impurity Float64 —
n_node_samples Int —
value_reg Float64 —