# shrinkage::PathPenalty

Shrinkage for Rust · 0.3.0

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
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. 

<a id="associated-types"></a>

## Associated types

<a id="associated-type-AtStrength"></a>

### `AtStrength`

```rust
type AtStrength: ProximalPenalty;
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

Complete penalty produced at a scalar strength. 

<a id="methods"></a>

## Methods

<a id="method-at_strength"></a>

### `at_strength`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

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

<a id="method-at_strength-documentation-errors"></a>

#### Errors

Reject invalid shape parameters, strengths, or arithmetic. 

<a id="method-maximum_penalty"></a>

### `maximum_penalty`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

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

<a id="method-maximum_penalty-documentation-errors"></a>

#### Errors

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

<a id="method-path_anchor"></a>

### `path_anchor`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

Finite starting anchor for automatic sequences. 

<a id="method-path_anchor-documentation-errors"></a>

#### Errors

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

<a id="impl-faf313e5b4211dfb63ef8a18e8c2b0981da638b0abbabdd374108e848a2673b5"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::ElasticNet
```

<a id="impl-d56737cee724763b1eda54278fcda66f2ff4babcd8c7f37549c582e0d60d4d83"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::L1
```

<a id="impl-cca76e6775fdf28e961813c4220c22be3902364f0da9d83ea546cf7949989720"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::Ridge
```

<a id="impl-d44440774b57b2a12464ccb4162a7de6c6d84b6b35e0d4e4142c28d31d0398e5"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::ChainFusedLasso
```

<a id="impl-9e53f8cdd3e01e0d674c45daf8d6fe017247c120b707381f427202f7a8c55662"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::ClusteredLasso
```

<a id="impl-6645ed1e1cc35ef166af1fddabfc4cd0125c4f23462354f7ac69246ad02ca890"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl PathPenalty for shrinkage::Slope
```

<a id="impl-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

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

<a id="impl-3ef4a7414d2252c1b07ad74f609f4dcb38549ef7e60ac4297290435412ec6c12"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

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