Shrinkage

shrinkage::ProximalPenalty

Shrinkage for Rust · rust · 0.3.0

pub trait ProximalPenalty: Penalty<Error = shrinkage::FitError>

A convex penalty with an exact proximal map for the complete term.

Implementations minimize ||z - input||² / (2 * step) + self.value(z). This contract applies to the entire penalty, including its strengths. A sum of penalties does not acquire this capability from its summands. A value-only penalty cannot be fitted by proximal gradient:

use shrinkage::{FitError, Gaussian, Penalty, Problem, ProximalGradient};
use shrinkage::lazymatrix::{ColumnStats, MatVecInto, MatTransposeVecInto, RawColumns};
fn fit<M, P>(problem: &Problem<&M, Gaussian<'_>, P>)
where
    M: RawColumns<f64> + ColumnStats<f64>
        + MatVecInto<Vec<f64>> + MatTransposeVecInto<Vec<f64>>,
    P: Penalty<Error = FitError>,
{
    let _ = problem.fit_with(&ProximalGradient::<Vec<f64>>::new());
}

Methods

gap_safe

fn gap_safe(&self) -> Option<&dyn shrinkage::GapSafePenalty>

Optional dual feasibility, safe zero screening, and exact zero restriction.

Implementations without this capability retain ordinary proximal fitting.

prox

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

Write the proximal minimizer into reusable output storage.

Errors

Reject invalid parameters, nonpositive or nonfinite steps, mismatched lengths, nonfinite input, or nonfinite arithmetic. Output is unspecified after an error.

Implementation of ProximalPenalty

impl ProximalPenalty for ElasticNet

Implementation of ProximalPenalty

impl ProximalPenalty for L1

Implementation of ProximalPenalty

impl ProximalPenalty for Ridge

Implementation of ProximalPenalty

impl ProximalPenalty for ChainFusedLasso

Implementation of ProximalPenalty

impl ProximalPenalty for ClusteredLasso

Implementation of ProximalPenalty

impl ProximalPenalty for GroupLasso

Implementation of ProximalPenalty

impl ProximalPenalty for Slope

Implementation of ProximalPenalty

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

Implementation of ProximalPenalty

impl<P: ProximalPenalty> ProximalPenalty for AxisPenalty<P>

Implementation of ProximalPenalty

impl<P: ProximalPenalty> ProximalPenalty for Scaled<P>

Implementation of ProximalPenalty

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