Shrinkage

shrinkage::Gaussian

Shrinkage for Rust · rust · 0.3.0

pub struct Gaussian<'a>

A Gaussian response with an optional unpenalized fitted intercept.

Inherent implementation

impl Gaussian<'_>

fits_intercept

pub fn fits_intercept(&self) -> bool

Whether fitting includes a free, unpenalized intercept.

response

pub fn response(&self) -> &[f64]

Borrow the observed response.

Inherent implementation

impl<'a> Gaussian<'a>

fit_intercept

pub fn fit_intercept(self, enabled: bool) -> Self

Enable or disable the unpenalized fitted intercept.

Explicit column centering can still induce an original-scale intercept.

new

pub fn new(response: &'a [f64]) -> Self

Borrow a response, fitting an intercept by default.

Implementation of Clone

impl<'a> Clone for Gaussian<'a>

clone

fn clone(&self) -> Self

Implementation of ConvexLink

impl ConvexLink<Gaussian<'_>> for Identity

Implementation of Copy

impl<'a> Copy for Gaussian<'a>

Implementation of CrossValidationDatafit

impl CrossValidationDatafit for shrinkage::Gaussian<'_>

WithResponse

type WithResponse<'a> = Gaussian<'a>;

response

fn response(&self) -> &[f64]

supports_metric

fn supports_metric(&self, metric: ValidationMetric) -> bool

validate_training

fn validate_training(&self) -> Result<(), FitError>

validation_metric

fn validation_metric(&self) -> ValidationMetric

with_response

fn with_response<'a>(&self, response: &'a [f64]) -> Gaussian<'a>

Implementation of Datafit

impl Datafit for Gaussian<'_>

Error

type Error = FitError;

value

fn value(&self, predictor: &[f64]) -> Result<f64, <Self as Datafit>::Error>

Evaluate ||response - predictor||² / (2n).

Implementation of Debug

impl<'a> Debug for Gaussian<'a>

fmt

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

Implementation of DiagonalHessianDatafit

impl DiagonalHessianDatafit for Gaussian<'_>

hessian_diagonal

fn hessian_diagonal(
    &self,
    predictor: &[f64],
    output: &mut [f64]
) -> Result<(), FitError>

Implementation of DifferentiableDatafit

impl DifferentiableDatafit for Gaussian<'_>

fits_intercept

fn fits_intercept(&self) -> bool

gradient

fn gradient(
    &self,
    predictor: &[f64],
    output: &mut [f64]
) -> Result<(), FitError>

n_obs

fn n_obs(&self) -> usize

Implementation of From

impl<'a> From<Gaussian<'a>> for Model<'a>

from

fn from(value: Gaussian<'a>) -> Self

Implementation of GapSafeDatafit

impl GapSafeDatafit for Gaussian<'_>

dual_candidate

fn dual_candidate(
    &self,
    predictor: &[f64],
    output: &mut [f64]
) -> Result<(), FitError>

dual_objective

fn dual_objective(&self, dual: &[f64]) -> Result<f64, FitError>

fenchel_gap

fn fenchel_gap(&self, predictor: &[f64], dual: &[f64]) -> Result<f64, FitError>

finalize_dual

fn finalize_dual(&self, dual: &mut [f64]) -> Result<(), FitError>

strong_concavity

fn strong_concavity(&self) -> f64

Implementation of HybridPathDatafit

impl HybridPathDatafit for shrinkage::Gaussian<'_>

Outer

type Outer = ();

fit

fn fit<M, V, P>(
    &self,
    design: &mut NativeDesign<M, V>,
    penalty: &P,
    solver: &HybridCoordinateDescent<V>,
    threshold: f64,
    work: (&mut Workspace<P>, &mut ())
) -> Result<Solution, FitError<<M as >::Error>> where M: RawColumns<f64> + MatVecInto<V> + MatTransposeVecInto<V>, V: ProximalVector, P: ReducedCoordinatePenalty

initial_intercept

fn initial_intercept(&self) -> Result<f64, FitError>

outer

fn outer(_: usize, _: usize)

path_deviance

fn path_deviance<P: ReducedCoordinatePenalty>(
    &self,
    work: &Workspace<P>,
    _: &()
) -> Result<Option<f64>, FitError>

Implementation of NullModelDatafit

impl NullModelDatafit for shrinkage::Gaussian<'_>

deviance

fn deviance(&self, predictor: &[f64]) -> Result<Option<f64>, FitError>

null_intercepts

fn null_intercepts(&self) -> Result<Vec<f64>, FitError>

Implementation of QuadraticModelDatafit

impl QuadraticModelDatafit for Gaussian<'_>

working_curvature

fn working_curvature(
    &self,
    predictor: &[f64],
    output: &mut [f64]
) -> Result<(), FitError>

Implementation of SmoothDatafit

impl SmoothDatafit for Gaussian<'_>

gap_safe

fn gap_safe(&self) -> Option<&dyn shrinkage::GapSafeDatafit>

Implementation of Freeze

impl<'a> Freeze for Gaussian<'a>

Implementation of RefUnwindSafe

impl<'a> RefUnwindSafe for Gaussian<'a>

Implementation of Send

impl<'a> Send for Gaussian<'a>

Implementation of Sync

impl<'a> Sync for Gaussian<'a>

Implementation of Unpin

impl<'a> Unpin for Gaussian<'a>

Implementation of UnsafeUnpin

impl<'a> UnsafeUnpin for Gaussian<'a>

Implementation of UnwindSafe

impl<'a> UnwindSafe for Gaussian<'a>

Implementation of Any

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

Implementation of Borrow

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

Implementation of BorrowMut

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

Implementation of ByRef

impl<T> ByRef<T> for T

Implementation of CastableFrom

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

Implementation of CastableFrom

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

Implementation of CloneToUninit

impl<T> CloneToUninit for T where T: Clone

Implementation of From

impl<T> From<T> for T

Implementation of Imply

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

Implementation of Into

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

Implementation of IntoEither

impl<T> IntoEither for T

Implementation of PathDatafit

impl<D> PathDatafit for D where D: SmoothDatafit + NullModelDatafit + ?Sized

Implementation of Pointable

impl<T> Pointable for T

Implementation of Read

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

Implementation of Same

impl<T> Same for T

Implementation of SupersetOf

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

Implementation of ToOwned

impl<T> ToOwned for T where T: Clone

Implementation of TryFrom

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

Implementation of TryInto

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