pub struct HistogramCallback {
pub history: Vec<HashMap<String, HistogramStats>>,
/* private fields */
}Expand description
Callback for tracking weight histograms during training.
This callback computes and logs histogram statistics of model parameters at regular intervals. Useful for:
- Detecting vanishing/exploding weights
- Monitoring weight distribution changes
- Debugging initialization issues
- Understanding parameter evolution
§Example
use tensorlogic_train::{CallbackList, HistogramCallback};
let mut callbacks = CallbackList::new();
callbacks.add(Box::new(HistogramCallback::new(
5, // log_frequency: Every 5 epochs
10, // num_bins: 10 histogram bins
true, // verbose: Print detailed histograms
)));Fields§
§history: Vec<HashMap<String, HistogramStats>>History of histogram statistics.
Implementations§
Trait Implementations§
Source§impl Callback for HistogramCallback
impl Callback for HistogramCallback
Source§fn on_epoch_end(
&mut self,
epoch: usize,
state: &TrainingState,
) -> TrainResult<()>
fn on_epoch_end( &mut self, epoch: usize, state: &TrainingState, ) -> TrainResult<()>
Called at the end of an epoch.
Source§fn on_train_begin(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_train_begin(&mut self, _state: &TrainingState) -> TrainResult<()>
Called at the beginning of training.
Source§fn on_train_end(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_train_end(&mut self, _state: &TrainingState) -> TrainResult<()>
Called at the end of training.
Source§fn on_epoch_begin(
&mut self,
_epoch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_epoch_begin( &mut self, _epoch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the beginning of an epoch.
Source§fn on_batch_begin(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_batch_begin( &mut self, _batch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the beginning of a batch.
Source§fn on_batch_end(
&mut self,
_batch: usize,
_state: &TrainingState,
) -> TrainResult<()>
fn on_batch_end( &mut self, _batch: usize, _state: &TrainingState, ) -> TrainResult<()>
Called at the end of a batch.
Source§fn on_validation_end(&mut self, _state: &TrainingState) -> TrainResult<()>
fn on_validation_end(&mut self, _state: &TrainingState) -> TrainResult<()>
Called after validation.
Source§fn should_stop(&self) -> bool
fn should_stop(&self) -> bool
Check if training should stop early.
Auto Trait Implementations§
impl Freeze for HistogramCallback
impl RefUnwindSafe for HistogramCallback
impl Send for HistogramCallback
impl Sync for HistogramCallback
impl Unpin for HistogramCallback
impl UnwindSafe for HistogramCallback
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> 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