Shrinkage

shrinkage::PathPenalty

Shrinkage for Rust · rust · 0.3.0

pub trait PathPenalty: ProximalPenalty

A penalty shape that supplies thresholds and complete penalties along a path.

L1 and ridge replace their scalar strength. Elastic net retains its mixing parameter; SLOPE multiplies its supplied base rank weights. Clustered and chain fused lasso scale both supplied strengths, preserving their ratio. Implementations must use the same coefficient scale as their proximal map.

Associated types

AtStrength

type AtStrength: ProximalPenalty;

Complete penalty produced at a scalar strength.

Methods

at_strength

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

Construct a complete penalty at a finite, nonnegative scalar strength.

Errors

Reject invalid shape parameters, strengths, or arithmetic.

maximum_penalty

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

Smallest strength that makes zero optimal for the supplied null gradient.

Errors

Reject invalid shapes, dimensions, gradients, or nonfinite arithmetic.

path_anchor

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

Finite starting anchor for automatic sequences.

Errors

Reject shapes without a usable finite anchor. Ridge overrides this method with the L1 threshold divided by 0.001.

Implementation of PathPenalty

impl PathPenalty for shrinkage::ElasticNet

Implementation of PathPenalty

impl PathPenalty for shrinkage::L1

Implementation of PathPenalty

impl PathPenalty for shrinkage::Ridge

Implementation of PathPenalty

impl PathPenalty for shrinkage::ChainFusedLasso

Implementation of PathPenalty

impl PathPenalty for shrinkage::ClusteredLasso

Implementation of PathPenalty

impl PathPenalty for shrinkage::Slope

Implementation of PathPenalty

impl<P: PathPenalty> PathPenalty for ErasedPathPenalty<P> where <P as PathPenalty>::AtStrength: 'static

Implementation of PathPenalty

impl<P: PathPenalty> PathPenalty for shrinkage::AxisPenalty<P>