Shrinkage

shrinkage::ElasticNet

Shrinkage for Rust · rust · 0.3.0

pub struct ElasticNet

Complete elastic-net penalty l1 * ||beta||₁ + l2 * ||beta||² / 2.

Inherent implementation

impl ElasticNet

alpha

pub fn alpha(&self) -> Option<f64>

Configured mixing parameter, or its equivalent for positive independent strengths. Two independently supplied zero strengths have no mixing ratio.

from_alpha

pub fn from_alpha(lambda: f64, alpha: f64) -> Self

Use lambda * (alpha * ||beta||₁ + (1 - alpha) * ||beta||² / 2). Lambda must be finite and nonnegative, and alpha must lie in [0, 1]. Validation occurs during evaluation or fitting. Automatic paths retain alpha even when the supplied lambda is zero.

l1

pub fn l1(&self) -> f64

Configured L1 strength.

l2

pub fn l2(&self) -> f64

Configured squared L2 strength.

new

pub fn new(l1: f64, l2: f64) -> Self

Set the L1 and squared L2 strengths independently, checked when used.

Implementation of Clone

impl Clone for ElasticNet

clone

fn clone(&self) -> Self

Implementation of CoordinatePenalty

impl CoordinatePenalty for shrinkage::ElasticNet

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 ElasticNet

Implementation of Debug

impl Debug for ElasticNet

fmt

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

Implementation of PathPenalty

impl PathPenalty for shrinkage::ElasticNet

AtStrength

type AtStrength = ElasticNet;

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 ElasticNet

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 ElasticNet

prox

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

Implementation of RestrictedProximalPenalty

impl RestrictedProximalPenalty for shrinkage::ElasticNet

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 ElasticNet

Implementation of RefUnwindSafe

impl RefUnwindSafe for ElasticNet

Implementation of Send

impl Send for ElasticNet

Implementation of Sync

impl Sync for ElasticNet

Implementation of Unpin

impl Unpin for ElasticNet

Implementation of UnsafeUnpin

impl UnsafeUnpin for ElasticNet

Implementation of UnwindSafe

impl UnwindSafe for ElasticNet

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>