# shrinkage::Ridge

Shrinkage for Rust · 0.3.0

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

```rust
pub struct Ridge
```

Ridge penalty `lambda * ||beta||² / 2`, distinct from the L2 norm. 

<a id="impl-49367dee284ae61f0469ff916e3c26bac6c209b1d072443027aa62829e9a02f9"></a>

## Inherent implementation

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

```rust
impl Ridge
```

<a id="method-lambda-49367dee284ae61f0469ff916e3c26bac6c209b1d072443027aa62829e9a02f9"></a>

### `lambda`

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

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

Configured squared L2 strength. 

<a id="method-new-49367dee284ae61f0469ff916e3c26bac6c209b1d072443027aa62829e9a02f9"></a>

### `new`

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

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

Set the squared L2 strength, checked during evaluation and fitting. 

<a id="impl-2186c7809da2b141b1058cbf86ec469e4520fb6fd959f387e0c4e96284af9e29"></a>

## Implementation of Clone

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

```rust
impl Clone for Ridge
```

<a id="method-clone-2186c7809da2b141b1058cbf86ec469e4520fb6fd959f387e0c4e96284af9e29"></a>

### `clone`

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

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

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

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

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

```rust
impl CoordinatePenalty for shrinkage::Ridge
```

<a id="method-coordinate_violation-fc0a44e650945f1ebbe4352b3869cd20172e6a0357d30dc093c366bb5a18f54c"></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-fc0a44e650945f1ebbe4352b3869cd20172e6a0357d30dc093c366bb5a18f54c"></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-0cd87a0088a41de9ba8bbf86b00e9a584c4227dcba2f68c60a03306df3190e42"></a>

## Implementation of Copy

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

```rust
impl Copy for Ridge
```

<a id="impl-60b10e56355628598202651b180937cd94adf62bb63588cb88d4ecf7b951217d"></a>

## Implementation of Debug

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

```rust
impl Debug for Ridge
```

<a id="method-fmt-60b10e56355628598202651b180937cd94adf62bb63588cb88d4ecf7b951217d"></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-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="associated-type-AtStrength-cca76e6775fdf28e961813c4220c22be3902364f0da9d83ea546cf7949989720"></a>

### `AtStrength`

```rust
type AtStrength = Ridge;
```

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

<a id="method-at_strength-cca76e6775fdf28e961813c4220c22be3902364f0da9d83ea546cf7949989720"></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-cca76e6775fdf28e961813c4220c22be3902364f0da9d83ea546cf7949989720"></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="method-path_anchor-cca76e6775fdf28e961813c4220c22be3902364f0da9d83ea546cf7949989720"></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>)

<a id="impl-166e1e62bfe337e0bee7f65167d54b1ad33d1b22e85b10a7d5f92584ca3c9dc8"></a>

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

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

```rust
impl Penalty for Ridge
```

<a id="associated-type-Error-166e1e62bfe337e0bee7f65167d54b1ad33d1b22e85b10a7d5f92584ca3c9dc8"></a>

### `Error`

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

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

<a id="method-validate_input-166e1e62bfe337e0bee7f65167d54b1ad33d1b22e85b10a7d5f92584ca3c9dc8"></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-166e1e62bfe337e0bee7f65167d54b1ad33d1b22e85b10a7d5f92584ca3c9dc8"></a>

### `value`

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

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

<a id="impl-67a6bb4e3fe83764bc356b6ba58d6a9471a8be54f912a12dcc08b729228a5f33"></a>

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

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

```rust
impl ProximalPenalty for Ridge
```

<a id="method-prox-67a6bb4e3fe83764bc356b6ba58d6a9471a8be54f912a12dcc08b729228a5f33"></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-6d110b7c36b14ae641abbf7977305b5d56bf6528dd0e5508524a6ccd794c25e9"></a>

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

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

```rust
impl RestrictedProximalPenalty for shrinkage::Ridge
```

<a id="method-prox_restricted-6d110b7c36b14ae641abbf7977305b5d56bf6528dd0e5508524a6ccd794c25e9"></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-6d110b7c36b14ae641abbf7977305b5d56bf6528dd0e5508524a6ccd794c25e9"></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-46dbff524688d6561bb52f5effc820d1368243c73c5cf2b805de05d93e90c29d"></a>

## Implementation of Freeze

```rust
impl Freeze for Ridge
```

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

## Implementation of RefUnwindSafe

```rust
impl RefUnwindSafe for Ridge
```

<a id="impl-435169d9b719511cf6dc45763a2bd99661a5c71631875bbe27906dbe70c41c5c"></a>

## Implementation of Send

```rust
impl Send for Ridge
```

<a id="impl-18018d40d6766e691e409f549492fa3bdf0639a905240cd98411d73ef8e4b2f1"></a>

## Implementation of Sync

```rust
impl Sync for Ridge
```

<a id="impl-03a362f88bf1868bf1d8f59300c43030e9ae82d07216a8c63214e125721f3555"></a>

## Implementation of Unpin

```rust
impl Unpin for Ridge
```

<a id="impl-67f7e555b90544ccb976c4c1685fbcaaa2dfd93aa9db0dd34666273cfdfe4894"></a>

## Implementation of UnsafeUnpin

```rust
impl UnsafeUnpin for Ridge
```

<a id="impl-4814d36230b2f925d6336c083bfd1acad6b84555dc12bab9c36f020a119bc88a"></a>

## Implementation of UnwindSafe

```rust
impl UnwindSafe for Ridge
```

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