oa::ml::training::EarlyStopping

Cooperative epoch-boundary early stopping.

StRust public API

Declaration

pub struct EarlyStopping { /* private fields */ }
Public Rust declaration.

Public Methods

pub const fn should_stop(&self) -> bool
pub const fn best(&self) -> f64
pub const fn bad_epochs(&self) -> u64
fn on_epoch_end( &mut self, context: &mut TrainingCallbackContext<'_>, ) -> Result<TrainingControl>
fn on_train_begin( &mut self, _context: &mut TrainingCallbackContext<'_>, ) -> Result<TrainingControl>
fn on_epoch_begin( &mut self, _context: &mut TrainingCallbackContext<'_>, ) -> Result<TrainingControl>
fn on_step_end( &mut self, _context: &mut TrainingCallbackContext<'_>, ) -> Result<TrainingControl>
fn on_train_end( &mut self, _context: &mut TrainingCallbackContext<'_>, ) -> Result<TrainingControl>

Associated Functions

pub fn new(patience: u64, min_delta: f64, mode: EarlyStopMode) -> Result<Self>
pub fn with_monitor( patience: u64, min_delta: f64, mode: EarlyStopMode, metric_name: impl Into<String>, monitor: impl Fn(TrainingSnapshot) -> f64 + 'static, ) -> Result<Self>
pub fn with_validation_metric( patience: u64, min_delta: f64, mode: EarlyStopMode, metric: ValidationMetric, ) -> Result<Self>
fn default() -> Self

Public Method Documentation

pub const fn should_stop( &self ) -> bool
No public source comment is attached to this declaration.
pub const fn best( &self ) -> f64
No public source comment is attached to this declaration.
pub const fn bad_epochs( &self ) -> u64
No public source comment is attached to this declaration.
fn on_epoch_end( &mut self, context: &mut TrainingCallbackContext<'_> ) -> Result<TrainingControl>
No public source comment is attached to this declaration.
fn on_train_begin( &mut self, _context: &mut TrainingCallbackContext<'_> ) -> Result<TrainingControl>
No public source comment is attached to this declaration.
fn on_epoch_begin( &mut self, _context: &mut TrainingCallbackContext<'_> ) -> Result<TrainingControl>
No public source comment is attached to this declaration.
fn on_step_end( &mut self, _context: &mut TrainingCallbackContext<'_> ) -> Result<TrainingControl>
No public source comment is attached to this declaration.
fn on_train_end( &mut self, _context: &mut TrainingCallbackContext<'_> ) -> Result<TrainingControl>
No public source comment is attached to this declaration.
pub fn new( patience: u64, min_delta: f64, mode: EarlyStopMode ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn with_monitor( patience: u64, min_delta: f64, mode: EarlyStopMode, metric_name: impl Into<String>, monitor: impl Fn(TrainingSnapshot) -> f64 + 'static ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn with_validation_metric( patience: u64, min_delta: f64, mode: EarlyStopMode, metric: ValidationMetric ) -> Result<Self>
No public source comment is attached to this declaration.
fn default() -> Self
No public source comment is attached to this declaration.