pub enum Regularization<T: Float> {
L1(T),
L2(T),
ElasticNet(T, T),
None,
}Expand description
Model Regularization
Variants§
L1(T)
L1 Regularization
L2(T)
L2 Regularization
ElasticNet(T, T)
Elastic Net Regularization (L1 and L2)
None
No Regularization
Implementations§
Source§impl<T: Float + FromPrimitive> Regularization<T>
impl<T: Float + FromPrimitive> Regularization<T>
Sourcepub fn reg_cost(&self, mat: MatrixSlice<'_, T>) -> T
pub fn reg_cost(&self, mat: MatrixSlice<'_, T>) -> T
Compute the regularization addition to the cost.
Sourcepub fn reg_grad(&self, mat: MatrixSlice<'_, T>) -> Matrix<T>
pub fn reg_grad(&self, mat: MatrixSlice<'_, T>) -> Matrix<T>
Compute the regularization addition to the gradient.
Trait Implementations§
Source§impl<T: Clone + Float> Clone for Regularization<T>
impl<T: Clone + Float> Clone for Regularization<T>
Source§fn clone(&self) -> Regularization<T>
fn clone(&self) -> Regularization<T>
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 moreimpl<T: Copy + Float> Copy for Regularization<T>
Auto Trait Implementations§
impl<T> Freeze for Regularization<T>where
T: Freeze,
impl<T> RefUnwindSafe for Regularization<T>where
T: RefUnwindSafe,
impl<T> Send for Regularization<T>where
T: Send,
impl<T> Sync for Regularization<T>where
T: Sync,
impl<T> Unpin for Regularization<T>where
T: Unpin,
impl<T> UnwindSafe for Regularization<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