pub struct TrainingState {Show 14 fields
pub epoch: usize,
pub batch: usize,
pub total_batches: usize,
pub current_lr: f32,
pub best_val_loss: f32,
pub epochs_without_improvement: usize,
pub momentum_buffer: Vec<f32>,
pub adam_m: Vec<f32>,
pub adam_v: Vec<f32>,
pub adam_t: usize,
pub train_loss_history: Vec<f32>,
pub val_loss_history: Vec<f32>,
pub train_acc_history: Vec<f32>,
pub val_acc_history: Vec<f32>,
}Expand description
Training state for tracking optimizer momentum and history
Fields§
§epoch: usizeCurrent epoch
batch: usizeCurrent batch within epoch
total_batches: usizeTotal batches processed
current_lr: f32Current learning rate
best_val_loss: f32Best validation loss seen
epochs_without_improvement: usizeEpochs since improvement (for early stopping)
momentum_buffer: Vec<f32>Momentum buffer for SGD with momentum
adam_m: Vec<f32>First moment estimate for Adam (m)
adam_v: Vec<f32>Second moment estimate for Adam (v)
adam_t: usizeAdam timestep
train_loss_history: Vec<f32>Training loss history
val_loss_history: Vec<f32>Validation loss history
train_acc_history: Vec<f32>Training accuracy history
val_acc_history: Vec<f32>Validation accuracy history
Implementations§
Source§impl TrainingState
impl TrainingState
Sourcepub fn update_learning_rate(
&mut self,
base_lr: f32,
schedule: &LearningRateSchedule,
total_epochs: usize,
)
pub fn update_learning_rate( &mut self, base_lr: f32, schedule: &LearningRateSchedule, total_epochs: usize, )
Updates learning rate based on schedule
Sourcepub fn should_stop(&self, config: &Option<EarlyStopping>) -> bool
pub fn should_stop(&self, config: &Option<EarlyStopping>) -> bool
Checks if early stopping should trigger
Sourcepub fn update_early_stopping(
&mut self,
val_loss: f32,
config: &Option<EarlyStopping>,
)
pub fn update_early_stopping( &mut self, val_loss: f32, config: &Option<EarlyStopping>, )
Updates early stopping state based on validation loss
Trait Implementations§
Source§impl Clone for TrainingState
impl Clone for TrainingState
Source§fn clone(&self) -> TrainingState
fn clone(&self) -> TrainingState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TrainingState
impl RefUnwindSafe for TrainingState
impl Send for TrainingState
impl Sync for TrainingState
impl Unpin for TrainingState
impl UnsafeUnpin for TrainingState
impl UnwindSafe for TrainingState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more