Shrinkage

shrinkage::Penalty

Shrinkage for Rust · rust · 0.3.0

pub trait Penalty

The complete penalty R(beta) on optimization-scale coefficients.

A value alone does not imply a proximal map or a valid coordinate update.

Associated types

Error

type Error;

Failure returned by penalty evaluation.

Methods

validate_input

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

Check parameters and coefficient compatibility independently of scaling.

The default evaluates the penalty and discards its value. Implementations can override this to validate without value arithmetic, allowing a zero Scaled penalty to avoid overflow in a value that is never used.

Errors

Reject invalid coefficients or parameters. The default also propagates errors from value evaluation.

value

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

Evaluate the penalty, including its strength.

Errors

Returns an error for invalid coefficients, parameters, or arithmetic.

Implementation of Penalty

impl Penalty for ElasticNet

Implementation of Penalty

impl Penalty for L1

Implementation of Penalty

impl Penalty for Ridge

Implementation of Penalty

impl Penalty for ChainFusedLasso

Implementation of Penalty

impl Penalty for ClusteredLasso

Implementation of Penalty

impl Penalty for GroupLasso

Implementation of Penalty

impl Penalty for Slope

Implementation of Penalty

impl<P: Penalty<Error = shrinkage::FitError>> Penalty for AxisPenalty<P>

Implementation of Penalty

impl<P: Penalty<Error = shrinkage::FitError>> Penalty for Scaled<P>

Implementation of Penalty

impl<P: ProximalPenalty> Penalty for ErasedPathPenalty<P>

Implementation of Penalty

impl<P: RestrictedProximalPenalty> Penalty for Masked<P>