# shrinkage::HybridFit

Shrinkage for Rust · 0.3.0

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

```rust
pub struct HybridFit
```

Original-scale parameters and full-space hybrid diagnostics. 

Cluster labels and values refer to optimization-scale coefficients. Clustered lasso orders blocks by value; chain fused lasso orders contiguous segments by feature and retains zero-weight edges as segment boundaries. SLOPE orders equal-magnitude blocks decreasingly and retains individual signs in [`Self::coefficient_signs`](<4cfe41c15bbeb98348e19c60ae6240bfb650cf4d7fe4c2c32a660c298508b022#method-coefficient_signs-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe>). Scaling can change equalities among the reported original-scale parameters. Gap Safe certificates refer to the original loss and full design. A sweep that leaves all blocks unchanged does not certify convergence; check [`Self::termination`](<4cfe41c15bbeb98348e19c60ae6240bfb650cf4d7fe4c2c32a660c298508b022#method-termination-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe>) and the full mapping. 

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

## Inherent implementation

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

```rust
impl HybridFit
```

<a id="method-backtracks-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `backtracks`

```rust
pub fn backtracks(&self) -> usize
```

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

Number of rejected trials followed by a curvature doubling. 

<a id="method-cluster_labels-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `cluster_labels`

```rust
pub fn cluster_labels(&self) -> &[usize]
```

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

Cluster label of each feature, indexing [`Self::cluster_values`](<4cfe41c15bbeb98348e19c60ae6240bfb650cf4d7fe4c2c32a660c298508b022#method-cluster_values-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe>). 

<a id="method-cluster_values-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `cluster_values`

```rust
pub fn cluster_values(&self) -> &[f64]
```

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

Optimization-scale block values, with positive zeros. Clustered lasso returns strictly increasing values. Chain fused lasso returns signed segment values in feature order, which may repeat. SLOPE returns strictly decreasing nonnegative magnitudes, with zero last when present. For SLOPE, coefficient `j` on the optimization scale equals `coefficient_signs()[j] * cluster_values()[cluster_labels()[j]]`. Equal original-scale values need not share a label when training scales differ. 

<a id="method-coefficient_signs-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `coefficient_signs`

```rust
pub fn coefficient_signs(&self) -> &[f64]
```

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

Optimization-scale coefficient signs in feature order: -1, 0, or 1. Both signed zeros have sign zero. Signs are recorded before coefficient back-transformation; SLOPE clusters may contain both nonzero signs. 

<a id="method-coefficients-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `coefficients`

```rust
pub fn coefficients(&self) -> &[f64]
```

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

Original-scale coefficients in training-column order. 

<a id="method-coordinate_sweeps-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `coordinate_sweeps`

```rust
pub fn coordinate_sweeps(&self) -> usize
```

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

Number of cluster-coordinate sweeps over the current working set. 

<a id="method-diagnostic_checks-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `diagnostic_checks`

```rust
pub fn diagnostic_checks(&self) -> usize
```

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

Number of refreshed inner diagnostic checks. Logistic checks use the fixed-zero quadratic subproblem; original-loss checks also run initially and after every accepted outer step. 

<a id="method-dual_certificate-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `dual_certificate`

```rust
pub fn dual_certificate(&self) -> Option<&[f64]>
```

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

Original-space feasible dual vector from the latest certificate check. Screening-disabled fits do not construct a certificate. 

<a id="method-dual_objective-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `dual_objective`

```rust
pub fn dual_objective(&self) -> Option<f64>
```

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

Dual objective `D(theta)`, when a certificate is available. 

<a id="method-duality_gap-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `duality_gap`

```rust
pub fn duality_gap(&self) -> Option<f64>
```

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

Duality gap `G(beta_0, beta, theta) = P(beta_0, beta) - D(theta)`. This diagnostic does not replace the full mapping stopping rule. 

<a id="method-intercept-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `intercept`

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

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

Original-scale intercept, including the centering correction. 

<a id="method-iterations-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `iterations`

```rust
pub fn iterations(&self) -> usize
```

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

Total committed PG transitions plus coordinate sweeps over the current working set. 

<a id="method-objective-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `objective`

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

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

Final primal objective `P(beta_0, beta) = F(beta_0, beta) + R(beta)`. 

<a id="method-outer_backtracks-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `outer_backtracks`

```rust
pub fn outer_backtracks(&self) -> usize
```

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

Rejected logistic trials followed by a step halving. Zero for Gaussian. 

<a id="method-outer_iterations-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `outer_iterations`

```rust
pub fn outer_iterations(&self) -> usize
```

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

Accepted logistic IRLS steps. Zero for Gaussian fits. 

<a id="method-pg_steps-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `pg_steps`

```rust
pub fn pg_steps(&self) -> usize
```

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

Number of committed PG transitions, excluding diagnostic proxes. 

<a id="method-predict-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `predict`

```rust
pub fn predict<M: RawColumns<f64> + ?Sized>(
    &self,
    x: &M
) -> Result<Vec<f64>, FitError>
```

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

Predict linear predictors with original-scale parameters without fitting preprocessing. Binomial predictions are logits. 

<a id="method-predict-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe-documentation-errors"></a>

#### Errors

Reject mismatched dimensions, invalid entries, or nonfinite arithmetic. 

<a id="method-preprocessing-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `preprocessing`

```rust
pub fn preprocessing(&self) -> &Preprocessing
```

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

Training normalization retained for interpreting optimization values. 

<a id="method-screening_diagnostics-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `screening_diagnostics`

```rust
pub fn screening_diagnostics(&self) -> &shrinkage::ScreeningDiagnostics
```

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

Work and certified zero restrictions in the original feature space. 

<a id="method-step_policy-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `step_policy`

```rust
pub fn step_policy(&self) -> HybridStep
```

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

Curvature policy selected for this fit. 

<a id="method-step_size-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `step_size`

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

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

Step used by final full-space diagnostics. Gaussian fits use the final PG curvature; logistic fits use a fixed global logistic curvature bound. 

<a id="method-stopping_criterion-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `stopping_criterion`

```rust
pub fn stopping_criterion(&self) -> StoppingCriterion
```

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

Selected full-space convergence criterion. 

<a id="method-stopping_threshold-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `stopping_threshold`

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

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

Absolute mapping threshold used to certify convergence. 

<a id="method-stopping_value-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `stopping_value`

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

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

Full mapping infinity norm, including the free-intercept derivative, evaluated for the original loss at the returned parameters using [`Self::step_size`](<4cfe41c15bbeb98348e19c60ae6240bfb650cf4d7fe4c2c32a660c298508b022#method-step_size-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe>). Logistic surrogate checks never certify convergence. 

<a id="method-termination-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `termination`

```rust
pub fn termination(&self) -> Termination
```

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

Whether the full mapping passed or the iteration budget expired. 

<a id="method-working_set_diagnostics-fd21dcf484ddec7051fa72f82ff6c79ac8b3807b8f3d432379bceaae43eefcbe"></a>

### `working_set_diagnostics`

```rust
pub fn working_set_diagnostics(&self) -> &shrinkage::WorkingSetDiagnostics
```

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

Work performed by heuristic feature selection, separate from safe screening. 

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

## Implementation of Clone

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

```rust
impl Clone for HybridFit
```

<a id="method-clone-e145dceeab5bd203083bd46009ac8fb169ae306d247318eb728202547d12a698"></a>

### `clone`

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

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

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

## Implementation of Debug

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

```rust
impl Debug for HybridFit
```

<a id="method-fmt-7c7798ffa925dcc4fc1a321f29c910d1c6745124f9d7787ee26e679ef857580c"></a>

### `fmt`

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

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

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

## [Implementation of ValidationFit](<5d173ce7dcb2d06e349b61bf9258286c35ff88ac41d7933ce0fe0553c3337dce>)

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

```rust
impl ValidationFit for shrinkage::HybridFit
```

<a id="method-predict-5beade9e684de0da5c23fc7f94fb47441a622324083bd22e36ff4295b50c0a3f"></a>

### `predict`

```rust
fn predict<M: RawColumns<f64> + ?Sized>(
    &self,
    design: &M
) -> Result<Vec<f64>, FitError>
```

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

<a id="method-termination-5beade9e684de0da5c23fc7f94fb47441a622324083bd22e36ff4295b50c0a3f"></a>

### `termination`

```rust
fn termination(&self) -> Termination
```

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

<a id="impl-64fba4763d54b4262f0dc8bba2212bd461ef219b3cc23a0dd6f9f4f06e2c58a7"></a>

## Implementation of Freeze

```rust
impl Freeze for HybridFit
```

<a id="impl-4605d020d65980fbe52cea8c81cb7eac535521c98d9f2bff98af42fdd7c6fd6f"></a>

## Implementation of RefUnwindSafe

```rust
impl RefUnwindSafe for HybridFit
```

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

## Implementation of Send

```rust
impl Send for HybridFit
```

<a id="impl-53927097904aadd788213e060f321a505e8d5f47cf66400ac031bf09e9060167"></a>

## Implementation of Sync

```rust
impl Sync for HybridFit
```

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

## Implementation of Unpin

```rust
impl Unpin for HybridFit
```

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

## Implementation of UnsafeUnpin

```rust
impl UnsafeUnpin for HybridFit
```

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

## Implementation of UnwindSafe

```rust
impl UnwindSafe for HybridFit
```

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