pub struct EarlyStopper { /* private fields */ }
Expand description
Early stopping state tracker
Implementations§
Source§impl EarlyStopper
impl EarlyStopper
pub fn new(config: EarlyStoppingConfig) -> Self
Sourcepub fn should_stop(
&mut self,
current_metrics: &TrainingMetrics,
network: &LSTMNetwork,
) -> (bool, bool)
pub fn should_stop( &mut self, current_metrics: &TrainingMetrics, network: &LSTMNetwork, ) -> (bool, bool)
Check if training should stop based on current metrics Returns (should_stop, is_best_score)
Sourcepub fn stopped_epoch(&self) -> Option<usize>
pub fn stopped_epoch(&self) -> Option<usize>
Get the epoch where training was stopped
Sourcepub fn best_score(&self) -> f64
pub fn best_score(&self) -> f64
Get the best score achieved
Sourcepub fn restore_best_weights(
&self,
network: &mut LSTMNetwork,
) -> Result<(), String>
pub fn restore_best_weights( &self, network: &mut LSTMNetwork, ) -> Result<(), String>
Restore the best weights to the network if available
Trait Implementations§
Source§impl Clone for EarlyStopper
impl Clone for EarlyStopper
Source§fn clone(&self) -> EarlyStopper
fn clone(&self) -> EarlyStopper
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 EarlyStopper
impl RefUnwindSafe for EarlyStopper
impl Send for EarlyStopper
impl Sync for EarlyStopper
impl Unpin for EarlyStopper
impl UnwindSafe for EarlyStopper
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