Shrinkage

shrinkage::Ridge

Shrinkage for Rust · rust · 0.3.0

pub struct Ridge

Ridge penalty lambda * ||beta||² / 2, distinct from the L2 norm.

Inherent implementation

impl Ridge

lambda

pub fn lambda(&self) -> f64

Configured squared L2 strength.

new

pub fn new(lambda: f64) -> Self

Set the squared L2 strength, checked during evaluation and fitting.

Implementation of Clone

impl Clone for Ridge

clone

fn clone(&self) -> Self

Implementation of CoordinatePenalty

impl CoordinatePenalty for shrinkage::Ridge

coordinate_violation

fn coordinate_violation(
    &self,
    _: usize,
    value: f64,
    gradient: f64
) -> Result<f64, FitError>

minimize_coordinate

fn minimize_coordinate(
    &self,
    _: usize,
    linear: f64,
    curvature: f64
) -> Result<f64, FitError>

Implementation of Copy

impl Copy for Ridge

Implementation of Debug

impl Debug for Ridge

fmt

fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

Implementation of PathPenalty

impl PathPenalty for shrinkage::Ridge

AtStrength

type AtStrength = Ridge;

at_strength

fn at_strength(&self, lambda: f64) -> Result<Self, FitError>

maximum_penalty

fn maximum_penalty(&self, gradient: &[f64]) -> Result<PenaltyMaximum, FitError>

path_anchor

fn path_anchor(&self, gradient: &[f64]) -> Result<f64, FitError>

Implementation of Penalty

impl Penalty for Ridge

Error

type Error = FitError;

validate_input

fn validate_input(&self, coefficients: &[f64]) -> Result<(), FitError>

value

fn value(&self, coefficients: &[f64]) -> Result<f64, FitError>

Implementation of ProximalPenalty

impl ProximalPenalty for Ridge

prox

fn prox(
    &self,
    input: &[f64],
    step: f64,
    output: &mut [f64]
) -> Result<(), FitError>

Implementation of RestrictedProximalPenalty

impl RestrictedProximalPenalty for shrinkage::Ridge

prox_restricted

fn prox_restricted(
    &self,
    input: &[f64],
    unpenalized: &[bool],
    step: f64,
    output: &mut [f64]
) -> Result<(), FitError>

value_restricted

fn value_restricted(
    &self,
    coefficients: &[f64],
    unpenalized: &[bool]
) -> Result<f64, FitError>

Implementation of Freeze

impl Freeze for Ridge

Implementation of RefUnwindSafe

impl RefUnwindSafe for Ridge

Implementation of Send

impl Send for Ridge

Implementation of Sync

impl Sync for Ridge

Implementation of Unpin

impl Unpin for Ridge

Implementation of UnsafeUnpin

impl UnsafeUnpin for Ridge

Implementation of UnwindSafe

impl UnwindSafe for Ridge

Implementation of Any

impl<T> Any for T where T: 'static + ?Sized

Implementation of Borrow

impl<T> Borrow<T> for T where T: ?Sized

Implementation of BorrowMut

impl<T> BorrowMut<T> for T where T: ?Sized

Implementation of ByRef

impl<T> ByRef<T> for T

Implementation of CastableFrom

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized

Implementation of CastableFrom

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized

Implementation of CloneToUninit

impl<T> CloneToUninit for T where T: Clone

Implementation of From

impl<T> From<T> for T

Implementation of Imply

impl<T, U> Imply<T> for U where T: ?Sized, U: ?Sized

Implementation of Into

impl<T, U> Into<U> for T where U: From<T>

Implementation of IntoEither

impl<T> IntoEither for T

Implementation of Pointable

impl<T> Pointable for T

Implementation of Read

impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized

Implementation of Same

impl<T> Same for T

Implementation of SupersetOf

impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>

Implementation of ToOwned

impl<T> ToOwned for T where T: Clone

Implementation of TryFrom

impl<T, U> TryFrom<U> for T where U: Into<T>

Implementation of TryInto

impl<T, U> TryInto<U> for T where U: TryFrom<T>