v2026.8.3
All Bundles
Bundle Core machine learning types: the seedable Random generator, Matrix2D linear algebra and activations, matrix reference holders, the NeuralNetwork and CSV-backed MatrixReader. Compile with -lib ml.

TreeNode

A node in a DecisionTree: either a leaf carrying a boolean prediction, or an internal node that branches on a boolean feature (false -> left, true -> right).

Operations

NewInternal # function

Creates an internal split node.

function : NewInternal(feature:Int) ~ TreeNode

Parameters

NameTypeDescription
featureIntfeature index to branch on

Return

TypeDescription
TreeNodeinternal node

NewLeaf # function

Creates a leaf node.

function : NewLeaf(prediction:Bool) ~ TreeNode

Parameters

NameTypeDescription
predictionBoolclass the leaf predicts

Return

TypeDescription
TreeNodeleaf node