Shrinkage

shrinkage::Link

Shrinkage for Rust · rust · 0.3.0

pub trait Link

A differentiable, monotone link between a mean and a linear predictor.

Implementations must keep the forward and inverse operations consistent on their domains. Derivatives are with respect to the predictor. Override the log-scale helpers when ordinary probabilities or derivatives lose tail bits. Runtime callbacks belong outside observation loops; Rust links use static dispatch and do not need to implement Clone or Copy.

Methods

initial_predictor

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

Supply a fallback predictor when family reference means are unavailable.

Errors

Reject configurations without a finite initial predictor.

log_probabilities

fn log_probabilities(&self, eta: f64) -> Result<(f64, f64), FitError>

Return log(mu) and log(1 - mu) for binomial calculations.

Errors

Reject predictors without an interior probability or finite log tails.

valid_eta

fn valid_eta(&self, eta: f64) -> bool

Test the predictor domain without evaluating the loss.

validate

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

Validate parameters independently of any predictor-domain check.

Errors

Reject invalid link configuration.

Implementation of Link

impl Link for Identity

Implementation of Link

impl Link for Logit

Implementation of Link

impl Link for Probit