# shrinkage::L1

Shrinkage for Rust · 0.3.0

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

```rust
pub struct L1
```

An L1 penalty on optimization-scale coefficients. 

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

## Inherent implementation

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

```rust
impl L1
```

<a id="method-lambda-a436fdd1a67baac057150a3d24209e1f5ed28239309aa09d9d71fe4bd52b0c80"></a>

### `lambda`

```rust
pub fn lambda(&self) -> f64
```

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

Configured penalty strength. 

<a id="method-new-a436fdd1a67baac057150a3d24209e1f5ed28239309aa09d9d71fe4bd52b0c80"></a>

### `new`

```rust
pub fn new(lambda: f64) -> Self
```

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

Set the penalty strength, checked when fitting. 

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

## Implementation of Clone

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

```rust
impl Clone for L1
```

<a id="method-clone-3d3be9b4acb0961ea07c5bbfb9c6cd4a0938ead9a51bfe031382914203135c8e"></a>

### `clone`

```rust
fn clone(&self) -> Self
```

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

<a id="impl-42635ee035e62c74e7d277223d35e6868bddcde14b3ecf48412228deea7f7a3e"></a>

## [Implementation of CoordinatePenalty](<20da77c0be652888a9d06dd14f0baaa185037b5c45513c2454efefbc53d3c0e8>)

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

```rust
impl CoordinatePenalty for shrinkage::L1
```

<a id="method-coordinate_violation-42635ee035e62c74e7d277223d35e6868bddcde14b3ecf48412228deea7f7a3e"></a>

### `coordinate_violation`

```rust
fn coordinate_violation(
    &self,
    _: usize,
    value: f64,
    gradient: f64
) -> Result<f64, FitError>
```

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

<a id="method-minimize_coordinate-42635ee035e62c74e7d277223d35e6868bddcde14b3ecf48412228deea7f7a3e"></a>

### `minimize_coordinate`

```rust
fn minimize_coordinate(
    &self,
    _: usize,
    linear: f64,
    curvature: f64
) -> Result<f64, FitError>
```

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

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

## Implementation of Copy

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

```rust
impl Copy for L1
```

<a id="impl-2a9a8340adbfe29070be168df591c507f7bd69224b7ff9963121ddf15d28a579"></a>

## Implementation of Debug

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

```rust
impl Debug for L1
```

<a id="method-fmt-2a9a8340adbfe29070be168df591c507f7bd69224b7ff9963121ddf15d28a579"></a>

### `fmt`

```rust
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
```

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

<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="associated-type-AtStrength-d56737cee724763b1eda54278fcda66f2ff4babcd8c7f37549c582e0d60d4d83"></a>

### `AtStrength`

```rust
type AtStrength = L1;
```

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

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

### `at_strength`

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

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

<a id="method-maximum_penalty-d56737cee724763b1eda54278fcda66f2ff4babcd8c7f37549c582e0d60d4d83"></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>)

<a id="impl-6f8fada035423d99ba9aef4396dac45184709dabfc05e11aa6e273b51cfe5b07"></a>

## [Implementation of PathSolver](<f5c72d3e4429c416ab6028c635ab099e02363494611b3296ed38741c10c0f4cf>)

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

```rust
impl<M, P> PathSolver<Problem<&M, Gaussian<'_>, P>, L1> for shrinkage::CoordinateDescent where M: RawColumns<f64> + ColumnStats<f64> + ?Sized
```

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

## [Implementation of Penalty](<a4f4243001e8d9121fca7a92bcb924b17aa5375aba23987fae95b2a05faf5245>)

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

```rust
impl Penalty for L1
```

<a id="associated-type-Error-bef0583a4ab0e16df7c3e3a9218232d44b414fa3400938566ee26ba942011451"></a>

### `Error`

```rust
type Error = FitError;
```

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

<a id="method-validate_input-bef0583a4ab0e16df7c3e3a9218232d44b414fa3400938566ee26ba942011451"></a>

### `validate_input`

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

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

<a id="method-value-bef0583a4ab0e16df7c3e3a9218232d44b414fa3400938566ee26ba942011451"></a>

### `value`

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

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

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

## [Implementation of ProximalPenalty](<45434a0394c5d718086e7e777f7db8271e2fb2b568e2519720168e5ea2877ed0>)

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

```rust
impl ProximalPenalty for L1
```

<a id="method-prox-b842f83a0a3c9645d42cf1f9e3110e006cce3a14aaf1a290c84555cfe0688344"></a>

### `prox`

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

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

<a id="impl-71f4983d124be898f9ca86e0b5b6db36392a031b3e58bc7df9d4d692b09296dc"></a>

## [Implementation of RestrictedProximalPenalty](<6e81c84ae32917d40a6711abfffe4b252008f5265d347b3a8b6129238b41dffe>)

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

```rust
impl RestrictedProximalPenalty for shrinkage::L1
```

<a id="method-prox_restricted-71f4983d124be898f9ca86e0b5b6db36392a031b3e58bc7df9d4d692b09296dc"></a>

### `prox_restricted`

```rust
fn prox_restricted(
    &self,
    input: &[f64],
    unpenalized: &[bool],
    step: f64,
    output: &mut [f64]
) -> Result<(), FitError>
```

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

<a id="method-value_restricted-71f4983d124be898f9ca86e0b5b6db36392a031b3e58bc7df9d4d692b09296dc"></a>

### `value_restricted`

```rust
fn value_restricted(
    &self,
    coefficients: &[f64],
    unpenalized: &[bool]
) -> Result<f64, FitError>
```

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

<a id="impl-47a0f3b396d56e41f04417b8d81c8441d69999476866bbef9211a1dc0cda3962"></a>

## Implementation of Freeze

```rust
impl Freeze for L1
```

<a id="impl-46e97c1ef1487a0ba8b5570a02d44a9fd7a35682bf1f8a6d1db86db2b0e49130"></a>

## Implementation of RefUnwindSafe

```rust
impl RefUnwindSafe for L1
```

<a id="impl-6aa0c5b4136a8cec95bfa6fb2438abd427346465e2a8b1678357376b33b427e5"></a>

## Implementation of Send

```rust
impl Send for L1
```

<a id="impl-86ed99d26cc0e0ea5578aa19e66db8b77e2ebf15b609babe387ecdedbfe9363e"></a>

## Implementation of Sync

```rust
impl Sync for L1
```

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

## Implementation of Unpin

```rust
impl Unpin for L1
```

<a id="impl-1b801b68922b0723ced6532a6ba13d7911d570d13be06a57dcd2498e8b291557"></a>

## Implementation of UnsafeUnpin

```rust
impl UnsafeUnpin for L1
```

<a id="impl-53f79e47b5476c36ce1e778dc4c4c397b4ccc3005a40ab5caf26f785b7ce07c7"></a>

## Implementation of UnwindSafe

```rust
impl UnwindSafe for L1
```

<a id="impl-1e5682dc18e03c648aa9b125290c107c1e8d96ce8a179a8532e4057da4daf0cd"></a>

## Implementation of Any

```rust
impl<T> Any for T where T: 'static + ?Sized
```

<a id="impl-6c0b25c2c92cdb117802d9c0a4c70afc9a8bfb0da875bc6e66191e2349fcdf3f"></a>

## Implementation of Borrow

```rust
impl<T> Borrow<T> for T where T: ?Sized
```

<a id="impl-796e80d926348273a22b04d8e84f510693b11c06ec57c3c3e2e8c1524094a85c"></a>

## Implementation of BorrowMut

```rust
impl<T> BorrowMut<T> for T where T: ?Sized
```

<a id="impl-8360e4092e7ec4a05a26dd304cd739398f0cacc50c8d08dd5be0223d1a08d02e"></a>

## Implementation of ByRef

```rust
impl<T> ByRef<T> for T
```

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

## Implementation of CastableFrom

```rust
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized
```

<a id="impl-97b65e7dfc44b5ecaa495a3a19fe737914a1e9f8532200cf8f46191314e7d777"></a>

## Implementation of CastableFrom

```rust
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized
```

<a id="impl-86d7da2bfd1140cc1675dfe6a975e6a2762338ab32731152da0723858ef3aa81"></a>

## Implementation of CloneToUninit

```rust
impl<T> CloneToUninit for T where T: Clone
```

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

## Implementation of From

```rust
impl<T> From<T> for T
```

<a id="impl-5adf6ca1830f30fbbac655ab8ff394d254954df7ededc7cc833c72fdc87d6f00"></a>

## Implementation of Imply

```rust
impl<T, U> Imply<T> for U where T: ?Sized, U: ?Sized
```

<a id="impl-85eec431edd188129f88290bbcb748e4d2fdc97f7efef3c162b8c252286ffec0"></a>

## Implementation of Into

```rust
impl<T, U> Into<U> for T where U: From<T>
```

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

## Implementation of IntoEither

```rust
impl<T> IntoEither for T
```

<a id="impl-5655b1ef858b34a584cb80104f040c8a4063ced0d281311a0833ed12aefde86e"></a>

## Implementation of Pointable

```rust
impl<T> Pointable for T
```

<a id="impl-8cc2aa01198fc9fa44f08b889f62988d70d2a7f4f0f11f4666d4c08bdaddb22a"></a>

## Implementation of Read

```rust
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized
```

<a id="impl-5ea09131039c62dd92b119d480a35c7e2b33d2b81dccf0b849f6b1f19f4bda24"></a>

## Implementation of Same

```rust
impl<T> Same for T
```

<a id="impl-7ee6ff38d6674f5edfe4734359062c2a67a572cff5899a89704764822b931c7f"></a>

## Implementation of SupersetOf

```rust
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>
```

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

## Implementation of ToOwned

```rust
impl<T> ToOwned for T where T: Clone
```

<a id="impl-83960135d00d98080c95a08867729696e36811280c2dd9cf34c1b4fe21c81e18"></a>

## Implementation of TryFrom

```rust
impl<T, U> TryFrom<U> for T where U: Into<T>
```

<a id="impl-1cc495bcaa5112ffb304e7f0de674feca391fd97f47bec86033a9225b72ac05c"></a>

## Implementation of TryInto

```rust
impl<T, U> TryInto<U> for T where U: TryFrom<T>
```
