pub struct Regularizer<T: FloatBounds> { /* private fields */ }Expand description
Regularization implementation
Implementations§
Source§impl<T: FloatBounds + ScalarOperand> Regularizer<T>
impl<T: FloatBounds + ScalarOperand> Regularizer<T>
Sourcepub fn new(config: RegularizationConfig<T>) -> Self
pub fn new(config: RegularizationConfig<T>) -> Self
Create a new regularizer with the given configuration
Sourcepub fn compute_loss(&self, weights: &Array2<T>, bias: Option<&Array1<T>>) -> T
pub fn compute_loss(&self, weights: &Array2<T>, bias: Option<&Array1<T>>) -> T
Compute regularization loss for a weight matrix
Sourcepub fn compute_weight_gradients(&self, weights: &Array2<T>) -> Array2<T>
pub fn compute_weight_gradients(&self, weights: &Array2<T>) -> Array2<T>
Compute regularization gradients for weights
Sourcepub fn compute_bias_gradients(&self, bias: &Array1<T>) -> Array1<T>
pub fn compute_bias_gradients(&self, bias: &Array1<T>) -> Array1<T>
Compute regularization gradients for bias
Auto Trait Implementations§
impl<T> Freeze for Regularizer<T>where
T: Freeze,
impl<T> RefUnwindSafe for Regularizer<T>where
T: RefUnwindSafe,
impl<T> Send for Regularizer<T>
impl<T> Sync for Regularizer<T>
impl<T> Unpin for Regularizer<T>where
T: Unpin,
impl<T> UnsafeUnpin for Regularizer<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Regularizer<T>where
T: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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