v2026.6.4
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.

CrossValidation

Cross-validation utilities for model evaluation

Operations

KFold # native

Splits data into K folds for cross-validation

function : native : KFold(data:Float[,], k:Int) ~ Vector[]<IntRef>

Parameters

NameTypeDescription
dataFloatinput matrix
kIntnumber of folds

Return

TypeDescription
Vectorarray of K fold indices

TrainTestSplit # native

Splits data into training and test sets

function : native : TrainTestSplit(data:Float[,], test_ratio:Float) ~ FloatMatrixRef[]

Parameters

NameTypeDescription
dataFloatinput matrix
test_ratioFloatpercentage of data for testing (0.0 to 1.0)

Return

TypeDescription
FloatMatrixRefarray with [training_data, test_data]