oa::CbCheckpoint

oa::CbCheckpoint keras modelCheckpoint(save_freq="epoch") + EarlyStopping's restore_best_weights, on top of oa::CheckpointManager. Every epoch end writes a resumable rotating checkpoint. Pass SaveEvery > 0 to add mid-epoch checkpoints every N completed optimizer steps. The master model is updated only on improvement. at each epoch end it prints a TF-style mini summary: epoch 3: cross_entropy improved from 0.4056 to 0.3486 — saving model epoch 4: cross_entropy did not improve from 0.3486 at train end, if RestoreBest is set and the best epoch wasn't the last one, the best checkpoint is loaded back into model + optimizer — you always walk away with the best weights, not whatever the final (possibly degraded) epoch produced. Monitored value: inMetric->result() when provided (e.g. a val_loss metric), otherwise the epoch mean train loss. Better/worse direction comes from the manager's lowerIsBetter config.

Inheritance

public CbTraining · public Callback

Public Methods

oa::I64 oa::CbCheckpoint::bestEpoch()
oa::Status oa::CbCheckpoint::getStatus()
void oa::CbCheckpoint::onEpochEnd(oa::ItTraining & inIter)
void oa::CbCheckpoint::onStepEnd(oa::ItTraining & inIter)
void oa::CbCheckpoint::onTrainEnd(oa::ItTraining & inIter)

Constructor & Destructor Documentation

oa::CbCheckpoint::CbCheckpoint( oa::CheckpointManager & inMgr, oa::Module & inModel, oa::Optimizer & inOpt, oa::I64 inSaveEvery = 0, oa::Metric * inMetric = nullptr, bool inRestoreBest = true, bool inVerbose = true )
No public source comment is attached to this declaration.

Parameters

inMgr
oa::CheckpointManager &

inModel
oa::Module &

inOpt
oa::Optimizer &

inSaveEvery
oa::I64

Default: 0

inMetric
oa::Metric *

Default: nullptr

inRestoreBest
bool

Default: true

inVerbose
bool

Default: true

Public Method Documentation

oa::I64 oa::CbCheckpoint::bestEpoch()
No public source comment is attached to this declaration.

Returns

oa::I64

The declared return value.

oa::Status oa::CbCheckpoint::getStatus()
No public source comment is attached to this declaration.

Returns

oa::Status

The declared return value.

void oa::CbCheckpoint::onEpochEnd( oa::ItTraining & inIter )
No public source comment is attached to this declaration.

Parameters

inIter
oa::ItTraining &

Returns

void

The declared return value.

void oa::CbCheckpoint::onStepEnd( oa::ItTraining & inIter )
No public source comment is attached to this declaration.

Parameters

inIter
oa::ItTraining &

Returns

void

The declared return value.

void oa::CbCheckpoint::onTrainEnd( oa::ItTraining & inIter )
No public source comment is attached to this declaration.

Parameters

inIter
oa::ItTraining &

Returns

void

The declared return value.