Experiment support for a parameter sweep: a deterministic stratified hold-out split, class-ratio resampling of the training half against a fixed test set, a wall-clock stopwatch and label helpers. Compile with -lib ml,ml_lab,csv,json, or with the ai alias group. Design: docs/ML_LAB_SUPPORT_DESIGN.md.
TrialResult
What one trial of a sweep produced: predictions on the training and test sets, the labels they are scored against, the fit time, and optionally a per-epoch training loss.
Both label arrays travel with the predictions because a trial may have resampled its own training set (the class-imbalance sweep), so the runner cannot assume one y.
Operations
GetFitMs #
Fit time.
method : public : GetFitMs() ~ FloatReturn
| Type | Description |
|---|---|
| Float | wall-clock milliseconds |
GetLoss #
Training loss per epoch, when the trial recorded one.
method : public : GetLoss() ~ Float[]Return
| Type | Description |
|---|---|
| Float | the curve, or Nil |
GetTestLabels #
True test labels.
method : public : GetTestLabels() ~ Bool[]Return
| Type | Description |
|---|---|
| Bool | one label per test row |
GetTestPredictions #
Predicted test labels.
method : public : GetTestPredictions() ~ Bool[]Return
| Type | Description |
|---|---|
| Bool | one label per test row |
GetTrainLabels #
True training labels.
method : public : GetTrainLabels() ~ Bool[]Return
| Type | Description |
|---|---|
| Bool | one label per training row |
GetTrainPredictions #
Predicted training labels.
method : public : GetTrainPredictions() ~ Bool[]Return
| Type | Description |
|---|---|
| Bool | one label per training row |
New # constructor
Constructor
New(train_pred:Bool[], train_y:Bool[], test_pred:Bool[], test_y:Bool[], fit_ms:Float)Parameters
| Name | Type | Description |
|---|---|---|
| train_pred | Bool | predicted labels on the training set |
| train_y | Bool | true labels of the training set |
| test_pred | Bool | predicted labels on the test set |
| test_y | Bool | true labels of the test set |
| fit_ms | Float | wall-clock milliseconds the fit took |
New # constructor
Constructor with a training-loss curve.
New(train_pred:Bool[], train_y:Bool[], test_pred:Bool[], test_y:Bool[], fit_ms:Float, loss:Float[])Parameters
| Name | Type | Description |
|---|---|---|
| train_pred | Bool | predicted labels on the training set |
| train_y | Bool | true labels of the training set |
| test_pred | Bool | predicted labels on the test set |
| test_y | Bool | true labels of the test set |
| fit_ms | Float | wall-clock milliseconds the fit took |
| loss | Float | training loss per epoch |