pub struct AdamW<T: Float + Send + Default> { /* private fields */ }Expand description
AdamW optimizer implementation Adam with decoupled weight decay for better regularization
Implementations§
Source§impl<T: Float + Send + Default> AdamW<T>
impl<T: Float + Send + Default> AdamW<T>
Sourcepub fn with_beta1(self, beta1: T) -> Self
pub fn with_beta1(self, beta1: T) -> Self
Set beta1 parameter (momentum coefficient)
Sourcepub fn with_beta2(self, beta2: T) -> Self
pub fn with_beta2(self, beta2: T) -> Self
Set beta2 parameter (variance coefficient)
Sourcepub fn with_epsilon(self, epsilon: T) -> Self
pub fn with_epsilon(self, epsilon: T) -> Self
Set epsilon for numerical stability
Sourcepub fn with_weight_decay(self, weight_decay: T) -> Self
pub fn with_weight_decay(self, weight_decay: T) -> Self
Set weight decay (decoupled from gradient-based updates)
Sourcepub fn with_error_function(
self,
error_function: Box<dyn ErrorFunction<T>>,
) -> Self
pub fn with_error_function( self, error_function: Box<dyn ErrorFunction<T>>, ) -> Self
Set error function
Trait Implementations§
Source§impl<T: Float + Send + Default> TrainingAlgorithm<T> for AdamW<T>
impl<T: Float + Send + Default> TrainingAlgorithm<T> for AdamW<T>
Source§fn train_epoch(
&mut self,
network: &mut Network<T>,
data: &TrainingData<T>,
) -> Result<T, TrainingError>
fn train_epoch( &mut self, network: &mut Network<T>, data: &TrainingData<T>, ) -> Result<T, TrainingError>
Train for one epoch
Source§fn calculate_error(&self, network: &Network<T>, data: &TrainingData<T>) -> T
fn calculate_error(&self, network: &Network<T>, data: &TrainingData<T>) -> T
Calculate the current error
Source§fn count_bit_fails(
&self,
network: &Network<T>,
data: &TrainingData<T>,
bit_fail_limit: T,
) -> usize
fn count_bit_fails( &self, network: &Network<T>, data: &TrainingData<T>, bit_fail_limit: T, ) -> usize
Count bit fails
Source§fn save_state(&self) -> TrainingState<T>
fn save_state(&self) -> TrainingState<T>
Save training state
Source§fn restore_state(&mut self, state: TrainingState<T>)
fn restore_state(&mut self, state: TrainingState<T>)
Restore training state
Source§fn set_callback(&mut self, callback: TrainingCallback<T>)
fn set_callback(&mut self, callback: TrainingCallback<T>)
Set a callback function
Source§fn call_callback(
&mut self,
epoch: usize,
network: &Network<T>,
data: &TrainingData<T>,
) -> bool
fn call_callback( &mut self, epoch: usize, network: &Network<T>, data: &TrainingData<T>, ) -> bool
Call the callback if set
Auto Trait Implementations§
impl<T> !RefUnwindSafe for AdamW<T>
impl<T> !Sync for AdamW<T>
impl<T> !UnwindSafe for AdamW<T>
impl<T> Freeze for AdamW<T>where
T: Freeze,
impl<T> Send for AdamW<T>
impl<T> Unpin for AdamW<T>where
T: Unpin,
impl<T> UnsafeUnpin for AdamW<T>where
T: UnsafeUnpin,
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