pub struct AloInput<'a> {
pub design: &'a Array2<f64>,
pub penalized_hessian: &'a Array2<f64>,
pub hessian_weights: SignedWeightsView<'a>,
pub score_weights: PsdWeightsView<'a>,
pub working_response: &'a Array1<f64>,
pub eta: &'a Array1<f64>,
pub offset: &'a Array1<f64>,
pub link: LinkFunction,
pub phi: f64,
pub penalty_root: Option<&'a Array2<f64>>,
pub ridge: f64,
pub score_curvature: Option<&'a AloScalarScoreCurvature<'a>>,
}Expand description
Model-agnostic input for ALO diagnostics.
Any model with a design matrix, penalized Hessian, and IRLS geometry can compute ALO leverages and leave-one-out predictions. This decouples ALO from the single-block PIRLS solver and enables diagnostics for GAMLSS, survival, and joint models.
Fields§
§design: &'a Array2<f64>Dense design matrix X (n × p).
penalized_hessian: &'a Array2<f64>Penalized Hessian H = X’WX + S(λ) at convergence (p × p).
hessian_weights: SignedWeightsView<'a>Hessian-side IRLS weights W_H at convergence (n). Sign-honest: for
non-canonical links the observed-information diagonal can have negative
entries, so the typed SignedWeightsView is the contract here. PSD
callers needing to promote (e.g. the canonical-link case where the
caller has discharged W_H ≥ 0 algebraically) can route through
SignedWeightsView::as_psd() at the consumer.
score_weights: PsdWeightsView<'a>Score-side IRLS weights W_S paired with working_response (n).
PSD-by-construction: the score-side Fisher weights h'²/(φ V(μ)) ≥ 0.
working_response: &'a Array1<f64>IRLS working response at convergence (n).
eta: &'a Array1<f64>Fitted linear predictor η̂ (n).
offset: &'a Array1<f64>Offset vector (n). Pass zeros if no offset.
link: LinkFunctionLink function (for phi determination).
phi: f64Dispersion parameter φ. For non-Gaussian families this is 1.0.
penalty_root: Option<&'a Array2<f64>>Optional penalty square root E with E^T E = S(λ) (rank × p) for sandwich SE.
When None, sandwich SE is set equal to Bayesian SE.
ridge: f64Ridge added to the Hessian for logdet surface.
score_curvature: Option<&'a AloScalarScoreCurvature<'a>>Optional per-row score/curvature evaluator (i, η) → (ℓ_i'(η), ℓ_i''(η)).
When supplied, the leave-i-out predictor is obtained by solving the
frozen-curvature scalar fixed point η = η̂_i + a_ii ℓ_i'(η) to
convergence (see [alo_eta_exact_frozen_curvature]) instead of taking a
single Newton step. This eliminates the first-order linearization error
that the one-step ALO incurs on small-n, strongly curved likelihoods
(e.g. binomial logistic regression). Non-convergence or invalid scalar
Newton geometry is returned as an ALO error. When None, the classical
single-Newton-step ALO formula is used. The evaluator must be consistent
with hessian_weights at convergence: ℓ_i''(η̂_i) = W_H[i] and
ℓ_i'(η̂_i) = W_S[i]·((η̂_i−o_i) − (z_i−o_i)).
Implementations§
Source§impl<'a> AloInput<'a>
impl<'a> AloInput<'a>
Sourcepub fn from_geometry(
geom: &'a FitGeometry,
design: &'a Array2<f64>,
eta: &'a Array1<f64>,
offset: &'a Array1<f64>,
link: LinkFunction,
phi: f64,
) -> Self
pub fn from_geometry( geom: &'a FitGeometry, design: &'a Array2<f64>, eta: &'a Array1<f64>, offset: &'a Array1<f64>, link: LinkFunction, phi: f64, ) -> Self
Build an AloInput from FitGeometry and associated vectors.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for AloInput<'a>
impl<'a> !UnwindSafe for AloInput<'a>
impl<'a> Freeze for AloInput<'a>
impl<'a> Send for AloInput<'a>
impl<'a> Sync for AloInput<'a>
impl<'a> Unpin for AloInput<'a>
impl<'a> UnsafeUnpin for AloInput<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.