Shrinkage

shrinkage::MultivariateGaussian

Shrinkage for Rust · rust · 0.3.0

pub struct MultivariateGaussian<'a>

Gaussian loss ||Y - predictor||_F² / (2 * nobs).

Responses and predictors store each response column contiguously: entry (observation, response) has index response * nobs + observation. The loss sums over responses and averages over observations, so separable fits use the same penalty strengths as independent Gaussian fits. Each response has its own optional unpenalized intercept, enabled by default.

Inherent implementation

impl<'a> MultivariateGaussian<'a>

fit_intercept

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

Enable or disable the free intercept for every response. Explicit feature centering can still induce original-scale intercepts.

fits_intercept

pub fn fits_intercept(&self) -> bool

Whether fitting includes a free intercept for each response.

gradient

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

Write (predictor - Y) / nobs in response-major order.

Errors

Reject invalid dimensions, nonfinite entries, or nonfinite arithmetic. Output is unspecified after an error.

new

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

Borrow response-major observations with explicit dimensions. Dimensions and entries are checked during loss evaluation or fitting.

nobs

pub fn nobs(&self) -> usize

Number of observations per response.

nresponses

pub fn nresponses(&self) -> usize

Number of response columns.

response

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

Borrow response columns in response-major order.

Implementation of Clone

impl<'a> Clone for MultivariateGaussian<'a>

clone

fn clone(&self) -> Self

Implementation of Copy

impl<'a> Copy for MultivariateGaussian<'a>

Implementation of Datafit

impl Datafit for MultivariateGaussian<'_>

Error

type Error = FitError;

value

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

Implementation of Debug

impl<'a> Debug for MultivariateGaussian<'a>

fmt

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

Implementation of NullModelDatafit

impl NullModelDatafit for shrinkage::MultivariateGaussian<'_>

deviance

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

null_intercepts

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

Implementation of Freeze

impl<'a> Freeze for MultivariateGaussian<'a>

Implementation of RefUnwindSafe

impl<'a> RefUnwindSafe for MultivariateGaussian<'a>

Implementation of Send

impl<'a> Send for MultivariateGaussian<'a>

Implementation of Sync

impl<'a> Sync for MultivariateGaussian<'a>

Implementation of Unpin

impl<'a> Unpin for MultivariateGaussian<'a>

Implementation of UnsafeUnpin

impl<'a> UnsafeUnpin for MultivariateGaussian<'a>

Implementation of UnwindSafe

impl<'a> UnwindSafe for MultivariateGaussian<'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 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>