iterateDataset

abstract suspend fun iterateDataset(name: String = "Dataset iteration", dataset: TrainSet<Input, InputLabel> = this@StageScope.dataset, customMetricsToRecord: List<Metric>? = null, failureRateThreshold: Double = 0.9, earlyStop: (TrainSetItem<Input, InputLabel>) -> PrematureExecutionStopDecision = { PrematureExecutionStopDecision(false) { "Unreachable: this training never stops prematurely" } }, processItem: suspend StageScope<Input, Output, InputLabel>.(TrainSetItem<Input, InputLabel>) -> Unit): StageRecord

Iterates over the dataset, processing each item as a substage. Uses dataset-specific metrics (solved rate, item counts, agent run stats).

Parameters

name

A custom name for the dataset iteration stage. Useful if you need multiple dataset iterations.

dataset

The dataset to iterate over. Default: the entire training dataset.

customMetricsToRecord

A list of custom metrics to aggregate from dataset item stages.

failureRateThreshold

If the failure rate exceeds this value, the entire dataset iteration will be marked as failed (but it will NOT throw).

earlyStop

A lambda that checks if the dataset iteration can be stopped prematurely.