SequentialTrainer

class SequentialTrainer(val network: SequentialNetwork, val cases: List<Exercise>, val lossFunction: LossFunction, val optimizer: Optimizer, val statistics: Statistics, acceptableError: Double = 0.001) : Trainer

A trainer for a SequentialNetwork using a list of Exercise instances to evaluate against the given lossFunction, updating the model parameters using the provided optimizer.

The optimizer controls how data is sampled from the given cases as well as how the network parameters are updated during training.

Sampling - Some optimizers may use all cases for each epoch, while others may sample a subset of cases. Iterations - Some optimizers may update parameters multiple times per epoch, while others may only update once.

Parameters

acceptableError

Once the network reaches this level, it will stop training.

Constructors

Link copied to clipboard
constructor(network: SequentialNetwork, cases: List<Exercise>, lossFunction: LossFunction, optimizer: StatisticalOptimizer)
constructor(network: SequentialNetwork, cases: List<Exercise>, lossFunction: LossFunction, optimizer: Optimizer, statistics: Statistics, acceptableError: Double = 0.001)

Properties

Link copied to clipboard
Link copied to clipboard
val lossFunction: LossFunction
Link copied to clipboard
val network: SequentialNetwork
Link copied to clipboard
Link copied to clipboard
open override val snapshot: StateFlow<Snapshot>

Exposes the latest state of training.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun train(iterations: Int): Int

Train the model for a number of iterations, a.k.a. epochs.