v2026.11.2
All Bundles
Bundle

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.

Stopwatch

A wall-clock stopwatch with sub-millisecond resolution, for training time.

Accumulates across Start/Stop pairs until Reset. Built on System.Time.Timer, which measures elapsed (wall-clock) time on every platform.

Example

sw := Stopwatch->New();
sw->Start();
model->Fit(train_x, train_y);
ms := sw->Stop();
"fit took {$ms} ms"->PrintLine();

Operations

GetElapsedMs #

Total elapsed milliseconds, including the interval still running.

method : public : GetElapsedMs() ~ Float

Return

TypeDescription
Floatmilliseconds

GetElapsedSeconds #

Total elapsed seconds, including the interval still running.

method : public : GetElapsedSeconds() ~ Float

Return

TypeDescription
Floatseconds

IsRunning #

Whether Start has been called without a matching Stop.

method : public : IsRunning() ~ Bool

Return

TypeDescription
Booltrue while timing

New # constructor

Constructor; the stopwatch is stopped at zero.

New()

Reset #

Stops and clears the total.

method : public : Reset() ~ Nil

Start #

Starts timing. Starting a running stopwatch has no effect.

method : public : Start() ~ Nil

Stop #

Stops timing and adds the interval to the total.

method : public : Stop() ~ Float

Return

TypeDescription
Floatthe total elapsed milliseconds so far