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
sourceimpl<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
sourceimpl<T: Clone + Float> Clone for Regularization<T>
impl<T: Clone + Float> Clone for Regularization<T>
sourcefn clone(&self) -> Regularization<T>
fn clone(&self) -> Regularization<T>
Returns a copy of the value. Read more
1.0.0const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<T: Debug + Float> Debug for Regularization<T>
impl<T: Debug + Float> Debug for Regularization<T>
impl<T: Copy + Float> Copy for Regularization<T>
Auto Trait Implementations
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
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more