klyn.math.nn.Sequential.fit
method
public fit(notnull features as NDArray<T>, notnull targets as NDArray<T>, epochs as Long = 5l, batchSize as Long = 64l, shuffle as Boolean = true, seed as Long = 12345l, verbose as Int = 1, validationData as Tuple<NDArray<T>, NDArray<T>> = null) as TrainingHistory
Description

Trains on same-precision floating targets using the configured regression loss. Targets match the model output shape; [samples] is accepted for [samples, 1] outputs. Progress/history expose loss and optional val_loss, never classification accuracy. Batch reuse, shuffling, validation and Float16 loss scaling follow the classification fit contract.

Parameters
ParameterDescription
featuresBatched inputs, retained only for this call.
targetsFinite floating expected values in T.
epochsPositive number of passes.
batchSizeMaximum observations per batch.
shuffleShuffle sample indices without modifying either input.
seedLocal seed in [1, 2147483646].
verbose0 silent, 1 batch progress, 2 epoch summaries.
validationDataOptional independent floating-target validation split.
Returns

Sample-weighted, loss-only history.

Throws
  • ValueException for invalid options, targets, shapes or non-finite values.
  • NullException if features, targets is null at runtime; statically null arguments are rejected with TypeError.
Example

history = model.fit(xTrain, yTrain, epochs=20, validationData=(xTest, yTest))