pub struct TrainingSession<F: Float + Debug + ScalarOperand> {
pub history: HashMap<String, Vec<F>>,
pub initial_learning_rate: F,
pub epochs_trained: usize,
pub current_epoch: usize,
pub best_validation_score: Option<F>,
pub early_stopped: bool,
}
Expand description
Training session for tracking training history
Fields§
§history: HashMap<String, Vec<F>>
Training metrics history
initial_learning_rate: F
Initial learning rate
epochs_trained: usize
Number of epochs trained
current_epoch: usize
Current epoch number
best_validation_score: Option<F>
Best validation score achieved
early_stopped: bool
Whether training has been stopped early
Implementations§
Source§impl<F: Float + Debug + ScalarOperand> TrainingSession<F>
impl<F: Float + Debug + ScalarOperand> TrainingSession<F>
Sourcepub fn new(config: TrainingConfig) -> Self
pub fn new(config: TrainingConfig) -> Self
Create a new training session
Sourcepub fn add_metric(&mut self, metricname: &str, value: F)
pub fn add_metric(&mut self, metricname: &str, value: F)
Add a metric value to the history
Sourcepub fn get_metric_history(&self, metricname: &str) -> Option<&Vec<F>>
pub fn get_metric_history(&self, metricname: &str) -> Option<&Vec<F>>
Get the history for a specific metric
Sourcepub fn get_metric_names(&self) -> Vec<&String>
pub fn get_metric_names(&self) -> Vec<&String>
Get all metric names
Sourcepub fn next_epoch(&mut self)
pub fn next_epoch(&mut self)
Update the current epoch
Sourcepub fn finish_training(&mut self)
pub fn finish_training(&mut self)
Mark training as completed
Sourcepub fn early_stop(&mut self)
pub fn early_stop(&mut self)
Mark training as early stopped
Trait Implementations§
Source§impl<F: Clone + Float + Debug + ScalarOperand> Clone for TrainingSession<F>
impl<F: Clone + Float + Debug + ScalarOperand> Clone for TrainingSession<F>
Source§fn clone(&self) -> TrainingSession<F>
fn clone(&self) -> TrainingSession<F>
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 moreSource§impl<F: Debug + Float + Debug + ScalarOperand> Debug for TrainingSession<F>
impl<F: Debug + Float + Debug + ScalarOperand> Debug for TrainingSession<F>
Auto Trait Implementations§
impl<F> Freeze for TrainingSession<F>where
F: Freeze,
impl<F> RefUnwindSafe for TrainingSession<F>where
F: RefUnwindSafe,
impl<F> Send for TrainingSession<F>where
F: Send,
impl<F> Sync for TrainingSession<F>where
F: Sync,
impl<F> Unpin for TrainingSession<F>where
F: Unpin,
impl<F> UnwindSafe for TrainingSession<F>where
F: UnwindSafe,
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