Shrinkage

shrinkage::L1

Shrinkage for Rust · rust · 0.3.0

pub struct L1

An L1 penalty on optimization-scale coefficients.

Inherent implementation

impl L1

lambda

pub fn lambda(&self) -> f64

Configured penalty strength.

new

pub fn new(lambda: f64) -> Self

Set the penalty strength, checked when fitting.

Implementation of Clone

impl Clone for L1

clone

fn clone(&self) -> Self

Implementation of CoordinatePenalty

impl CoordinatePenalty for shrinkage::L1

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 L1

Implementation of Debug

impl Debug for L1

fmt

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

Implementation of PathPenalty

impl PathPenalty for shrinkage::L1

AtStrength

type AtStrength = L1;

at_strength

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

maximum_penalty

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

Implementation of PathSolver

impl<M, P> PathSolver<Problem<&M, Gaussian<'_>, P>, L1> for shrinkage::CoordinateDescent where M: RawColumns<f64> + ColumnStats<f64> + ?Sized

Implementation of Penalty

impl Penalty for L1

Error

type Error = FitError;

validate_input

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

value

fn value(&self, coefficients: &[f64]) -> Result<f64, <Self as Penalty>::Error>

Implementation of ProximalPenalty

impl ProximalPenalty for L1

prox

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

Implementation of RestrictedProximalPenalty

impl RestrictedProximalPenalty for shrinkage::L1

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 L1

Implementation of RefUnwindSafe

impl RefUnwindSafe for L1

Implementation of Send

impl Send for L1

Implementation of Sync

impl Sync for L1

Implementation of Unpin

impl Unpin for L1

Implementation of UnsafeUnpin

impl UnsafeUnpin for L1

Implementation of UnwindSafe

impl UnwindSafe for L1

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>