pub struct EarlyStoppingMonitor { /* private fields */ }Expand description
The early stopping monitor.
Tracks a single metric over epochs and decides when to stop training based on patience, minimum delta, baseline, and minimum epoch constraints.
Implementations§
Source§impl EarlyStoppingMonitor
impl EarlyStoppingMonitor
Sourcepub fn new(config: EarlyStoppingConfig) -> Self
pub fn new(config: EarlyStoppingConfig) -> Self
Create a new monitor with the given configuration.
Sourcepub fn with_default() -> Self
pub fn with_default() -> Self
Create a new monitor with default configuration.
Sourcepub fn step(&mut self, metric_value: f64) -> EarlyStoppingDecision
pub fn step(&mut self, metric_value: f64) -> EarlyStoppingDecision
Report the metric for the current epoch and return a decision.
This advances the epoch counter, records the metric value, and evaluates whether training should continue or stop.
Sourcepub fn should_stop(&self) -> bool
pub fn should_stop(&self) -> bool
Check if training should stop (without advancing epoch).
Sourcepub fn best_value(&self) -> Option<f64>
pub fn best_value(&self) -> Option<f64>
Best metric value seen so far.
Sourcepub fn best_epoch(&self) -> usize
pub fn best_epoch(&self) -> usize
Epoch at which the best value was seen.
Sourcepub fn current_epoch(&self) -> usize
pub fn current_epoch(&self) -> usize
Current epoch number.
Sourcepub fn epochs_since_improvement(&self) -> usize
pub fn epochs_since_improvement(&self) -> usize
Number of epochs since last improvement.
Trait Implementations§
Source§impl Clone for EarlyStoppingMonitor
impl Clone for EarlyStoppingMonitor
Source§fn clone(&self) -> EarlyStoppingMonitor
fn clone(&self) -> EarlyStoppingMonitor
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 EarlyStoppingMonitor
impl RefUnwindSafe for EarlyStoppingMonitor
impl Send for EarlyStoppingMonitor
impl Sync for EarlyStoppingMonitor
impl Unpin for EarlyStoppingMonitor
impl UnsafeUnpin for EarlyStoppingMonitor
impl UnwindSafe for EarlyStoppingMonitor
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> 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