Shrinkage

AxisPenalty

AxisPenalty applies a complete vector penalty along explicitly selected axes of a pp-feature, qq-response coefficient matrix β\beta:

RFeatures(β)=∑r=1qR(β:,r),RResponses(β)=∑j=1pR(βj,:),RAll(β)=R(vec⁡(β)). \begin{aligned} R_{\mathrm{Features}}(\beta) & = \sum_{r=1}^q R(\beta_{:,r}), \\ R_{\mathrm{Responses}}(\beta) & = \sum_{j=1}^p R(\beta_{j,:}), \\ R_{\mathrm{All}}(\beta) & = R(\operatorname{vec}(\beta)). \end{aligned}

Each group receives the supplied strength. Shrinkage does not divide by the number of features, responses, or groups. Intercepts remain separate. CoefficientLayout stores response columns contiguously, with index response * nfeatures + feature.

Constraint region

A diamond for separate scalar penalties and a disk for one joint response penalty.

Both panels use one feature and two responses, with the unsquared L2 norm as the inner penalty, represented by one Group LASSO group of unit weight and strength one at each required vector width. The axes denote the two response coefficients of that feature. Features gives ∣β1∣+∣β2∣≤1|\beta_1| + |\beta_2| \leq 1; Responses gives β12+β22≤1\sqrt{\beta_1^2 + \beta_2^2} \leq 1. All coincides with Responses in this layout. See the plot conventions.

Use the wrapper

use shrinkage::{AxisPenalty, CoefficientLayout, Penalty, PenaltyAxis, Ridge};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let layout = CoefficientLayout::new(2, 2)?;
    let penalty = AxisPenalty::new(layout, PenaltyAxis::Features, Ridge::new(1.0));
    let coefficients = [1.0, 2.0, 3.0, 4.0];
    assert_eq!(penalty.value(&coefficients)?, 15.0);
    Ok(())
}

Use Features to fit responses independently, Responses to couple responses within a feature, and All to apply one penalty to the flattened matrix. Disjoint groups make the composed proximal map exact whenever the inner map is exact. Scaled and Masked can wrap the inner penalty; mask length follows the selected vector width.

Fitting uses proximal gradient with multivariate Gaussian.

API: shrinkage::AxisPenalty, shrinkage::PenaltyAxis, and shrinkage::CoefficientLayout.