Shrinkage

shrinkage::LinkedDatafit

Shrinkage for Rust · rust · 0.3.0

pub struct LinkedDatafit<F, L>

A response family composed with a link for Fisher-scoring IRLS.

Construct with Gaussian::with_link or Binomial::with_link. Explicit IRLS paths require only Link; automatic paths additionally require ConvexLink. Exact Hessians require TwiceDifferentiableLink. The original family constructors retain their specialized solver capabilities.

Automatic paths require convexity of the particular family-link pairing:

use shrinkage::{Gaussian, Logit, NullModelDatafit};
fn automatic<D: NullModelDatafit>(_: D) {}
automatic(Gaussian::new(&[0.2, 0.8]).with_link(Logit));

A composed link does not acquire proximal solver capabilities implicitly:

use shrinkage::{Binomial, Probit, SmoothDatafit};
fn proximal<D: SmoothDatafit>(_: D) {}
proximal(Binomial::new(&[0.0, 1.0]).with_link(Probit));

Inherent implementation

impl<'a, L: Link> LinkedDatafit<shrinkage::Binomial<'a>, L>

fit_intercept

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

Enable or disable the free, unpenalized intercept.

fits_intercept

pub fn fits_intercept(&self) -> bool

Whether fitting includes an unpenalized intercept.

response

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

Borrow the observed responses.

Inherent implementation

impl<'a, L: Link> LinkedDatafit<shrinkage::Gaussian<'a>, L>

fit_intercept

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

Enable or disable the free, unpenalized intercept.

fits_intercept

pub fn fits_intercept(&self) -> bool

Whether fitting includes an unpenalized intercept.

response

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

Borrow the observed responses.

Inherent implementation

impl<F, L: Link> LinkedDatafit<F, L>

Inherent implementation

impl<F, L> LinkedDatafit<F, L>

Inherent implementation

impl<L: Link> LinkedDatafit<shrinkage::Binomial<'_>, L>

Implementation of Clone

impl<F: core::clone::Clone, L: core::clone::Clone> Clone for LinkedDatafit<F, L>

clone

fn clone(&self) -> Self

Implementation of Copy

impl<F: core::marker::Copy, L: core::marker::Copy> Copy for LinkedDatafit<F, L>

Implementation of Datafit

impl<L: Link> Datafit for LinkedDatafit<shrinkage::Binomial<'_>, L>

Error

type Error = FitError;

value

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

Implementation of Datafit

impl<L: Link> Datafit for LinkedDatafit<shrinkage::Gaussian<'_>, L>

Error

type Error = FitError;

value

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

Implementation of Debug

impl<F: core::fmt::Debug, L: core::fmt::Debug> Debug for LinkedDatafit<F, L>

fmt

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

Implementation of DiagonalHessianDatafit

impl<L: TwiceDifferentiableLink> DiagonalHessianDatafit for LinkedDatafit<shrinkage::Binomial<'_>, L>

hessian_diagonal

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

Implementation of DiagonalHessianDatafit

impl<L: TwiceDifferentiableLink> DiagonalHessianDatafit for LinkedDatafit<shrinkage::Gaussian<'_>, L>

hessian_diagonal

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

Implementation of DifferentiableDatafit

impl<L: Link> DifferentiableDatafit for LinkedDatafit<shrinkage::Binomial<'_>, L>

fits_intercept

fn fits_intercept(&self) -> bool

gradient

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

n_obs

fn n_obs(&self) -> usize

Implementation of DifferentiableDatafit

impl<L: Link> DifferentiableDatafit for LinkedDatafit<shrinkage::Gaussian<'_>, L>

fits_intercept

fn fits_intercept(&self) -> bool

gradient

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

n_obs

fn n_obs(&self) -> usize

Implementation of NullModelDatafit

impl<'a, L: ConvexLink<shrinkage::Binomial<'a>>> NullModelDatafit for LinkedDatafit<shrinkage::Binomial<'a>, L>

deviance

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

null_intercepts

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

Implementation of NullModelDatafit

impl<'a, L: ConvexLink<shrinkage::Gaussian<'a>>> NullModelDatafit for LinkedDatafit<shrinkage::Gaussian<'a>, L>

deviance

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

null_intercepts

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

Implementation of QuadraticModelDatafit

impl<L: Link> QuadraticModelDatafit for LinkedDatafit<shrinkage::Binomial<'_>, L>

initial_intercept

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

valid_predictor

fn valid_predictor(&self, eta: &[f64]) -> bool

working_curvature

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

Implementation of QuadraticModelDatafit

impl<L: Link> QuadraticModelDatafit for LinkedDatafit<shrinkage::Gaussian<'_>, L>

initial_intercept

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

valid_predictor

fn valid_predictor(&self, eta: &[f64]) -> bool

working_curvature

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

Implementation of Freeze

impl<F, L> Freeze for LinkedDatafit<F, L> where F: Freeze, L: Freeze

Implementation of RefUnwindSafe

impl<F, L> RefUnwindSafe for LinkedDatafit<F, L> where F: RefUnwindSafe, L: RefUnwindSafe

Implementation of Send

impl<F, L> Send for LinkedDatafit<F, L> where F: Send, L: Send

Implementation of Sync

impl<F, L> Sync for LinkedDatafit<F, L> where F: Sync, L: Sync

Implementation of Unpin

impl<F, L> Unpin for LinkedDatafit<F, L> where F: Unpin, L: Unpin

Implementation of UnsafeUnpin

impl<F, L> UnsafeUnpin for LinkedDatafit<F, L> where F: UnsafeUnpin, L: UnsafeUnpin

Implementation of UnwindSafe

impl<F, L> UnwindSafe for LinkedDatafit<F, L> where F: UnwindSafe, L: UnwindSafe

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