ConjugateGradient<P extends VectorSample> class

Nonlinear Conjugate Gradient (Fletcher–Reeves, with restarts + line search).

Inheritance

Constructors

ConjugateGradient(ANN<double, Float32x4, SignalFloat32x4, Scale<double>> ann, SamplesSet<P> samplesSet, {double fdEpsilon = 1e-4, String? subject})

Properties

algorithmName String
The training algorithm name.
finalinherited
ann ANN<double, Float32x4, SignalFloat32x4, Scale<double>>
The ANN to train.
finalinherited
bestTrainingError double
The lowest training error seen by checkBestTrainingError since the last resetBestTraining.
no setterinherited
elapsedTime Duration?
no setterinherited
enableSelectInitialANN bool
If true will select the initial ANN calling selectInitialANN.
getter/setter pairinherited
endTime DateTime?
The end time of the last training session or null if not finished yet.
no setterinherited
fdEpsilon double
Finite-difference step.
finalinherited
globalError double
Returns the current training global error (set by train).
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
initialAnnEpochs int
Number of epochs to perform in the ANNs in the selection pool.
getter/setter pairinherited
initialAnnPoolSize int
The initial ANN pool size.
getter/setter pairinherited
lastGlobalError double
no setterinherited
logEnabled bool
If true logging will be enabled.
getter/setter pairinherited
logger TrainingLogger
finalinherited
logProgressEnabled bool
If true logging of progress will be enabled.
getter/setter pairinherited
parameters String
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
samples List<P>
Returns the samples of samplesSet
no setterinherited
samplesSet SamplesSet<P>
The samples set for training.
finalinherited
samplesSubject String
Returns the subject of samplesSet
no setterinherited
startTime DateTime?
The start time of the last training session or null if reset.
no setterinherited
subject String
The training subject. Defaults to samplesSet.subject.
finalinherited
totalFailedEpochs int
no setterinherited
totalTrainedEpochs int
Returns the total number of epochs of all the training session. A call to reset won't reset this value.
no setterinherited
totalTrainingActivations int
Returns the total number of activations of all the training session. A call to reset won't reset this value.
no setterinherited
trainedEpochs int
Returns the number of epochs of the last training session.
no setterinherited
trainingActivations int
Returns the number of activations of the last training session.
no setterinherited
trainingSamplesSize int
no setterinherited
weights List<double>
getter/setter pairinherited

Methods

checkBestTrainingError(double trainingError) → void
inherited
computeGlobalError(List<P> samples) double
inherited
gradient() List<double>
Central-difference gradient of objective w.r.t. every weight.
inherited
initializeParameters() → void
Initialize training parameters.
inherited
initializeTraining() → void
inherited
jacobian() List<List<double>>
Central-difference Jacobian of residuals (rows = residuals, cols = weights).
inherited
learn(List<P> samples, double targetGlobalError) bool
Learn the training of sample. Called by train.
override
lineSearch(List<double> base, List<double> direction, double f0, List<double> grad, {double alpha0 = 1.0}) double
Backtracking (Armijo) line search along direction from base; returns the step size. Leaves the weights set to base on exit.
inherited
logError(String message, [dynamic error, StackTrace? stackTrace]) → void
inherited
logInfo(String message) → void
inherited
logProgress(String message) → void
inherited
logWarn(String message) → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
objective() double
Scalar objective (mean squared error over all samples).
inherited
recordTrainingBlock(double globalError, int epochs) → void
Records the outcome of an externally-driven training block (e.g. the async WebGPU trainers, which run epochs off the synchronous _trainImpl loop) so the public bookkeeping getters (globalError, trainedEpochs, totalTrainedEpochs, trainingActivations) reflect it. Also updates the best-training snapshot via checkBestTrainingError.
inherited
reset() → void
Reset this instance for a future training sessions.
override
resetBestTraining() → void
Discards the best weights/error tracked by checkBestTrainingError.
inherited
residuals() List<double>
Per-sample per-output residuals output − target (for Levenberg–Marquardt).
inherited
selectInitialANN(List<P> samples, double targetGlobalError, [Random? random]) → void
Selects the initial ANN.
inherited
toString() String
A string representation of this object.
inherited
train(int epochs, double targetGlobalError) double
Train the samples for n epochs and returns the last global error.
inherited
trainUntilGlobalError({double? targetGlobalError, int epochsBlock = 50, int maxEpochs = 1000000, double maxEpochsLimitRatio = 3, int maxRetries = 5, double retryIncreaseMaxEpochsRatio = 1.50, Random? random}) bool
Train the ann until targetGlobalError, with maxEpochs per training session and a maxRetries when a training session can't reach the target global error.
inherited
updateParameters() → void
Update training parameters.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited