pub struct GaussianJackknifePlusStats { /* private fields */ }Expand description
Test-point-independent sufficient statistics for the exact penalized
Gaussian-identity jackknife+, factored ONCE from (X, y, Sλ) so any number
of test points reuse the single Cholesky of M = XᵀX + Sλ.
For each training row i the leave-one-out fit is the rank-one
Sherman–Morrison downdate of M, giving (in closed form, no refits):
vᵢ = M⁻¹ xᵢ (p-vector, one column of M⁻¹Xᵀ)
hᵢ = xᵢᵀ vᵢ , cᵢ = rᵢ / (1 − hᵢ) (signed LOO residual)
Rᵢ = |cᵢ| (LOO absolute residual)At a test point x_* the LOO prediction is then a single inner product per
row, μ̂₋ᵢ(x_*) = x_*ᵀβ̂ − (x_*ᵀvᵢ)·cᵢ, so interval is
O(n·p) after the O(n·p²) factorization here. This is the substrate the
predict(interval=level) magic default replays: the stats are exactly the
{vᵢ, cᵢ, Rᵢ} of gaussian_jackknife_plus, which is recovered exactly when
fed a single x_* (the in-module test asserts that equivalence).
Unit prior weights are required, as everywhere in this module: a reweighted
training row is not exchangeable with the test row, so the finite-sample
coverage proof does not apply. The constructor rejects non-unit weights and
rows with 1 − hᵢ ≤ 1e-10 (no leave-one-out information).
Implementations§
Source§impl GaussianJackknifePlusStats
impl GaussianJackknifePlusStats
Sourcepub fn new(
x: &Array2<f64>,
y: &Array1<f64>,
prior_weights: &Array1<f64>,
s_lambda: &Array2<f64>,
) -> Result<Self, String>
pub fn new( x: &Array2<f64>, y: &Array1<f64>, prior_weights: &Array1<f64>, s_lambda: &Array2<f64>, ) -> Result<Self, String>
Factor the test-point-independent jackknife+ statistics from the training design, response, prior weights, and penalty matrix.
Sourcepub fn from_design_unit_weight_normal_matrix(
x: &Array2<f64>,
y: &Array1<f64>,
prior_weights: &Array1<f64>,
m: &Array2<f64>,
) -> Result<Self, String>
pub fn from_design_unit_weight_normal_matrix( x: &Array2<f64>, y: &Array1<f64>, prior_weights: &Array1<f64>, m: &Array2<f64>, ) -> Result<Self, String>
Same exact jackknife+ statistics as new, but the
penalized normal matrix M = XᵀX + Sλ is supplied directly rather than
reassembled from Sλ. For a Gaussian-identity unit-weight fit the
converged penalized Hessian stored in [FitGeometry] is this M (the
working weights are unity and the matrix is dispersion-unscaled), so
persisting the design + M at fit time and replaying through this
constructor reproduces the certified interval with no penalty
re-derivation — the seam the saved-model predict(interval=…) magic
uses.
prior_weights is validated to be unity for the exchangeability
guarantee, identically to new.
Trait Implementations§
Source§impl Clone for GaussianJackknifePlusStats
impl Clone for GaussianJackknifePlusStats
Source§fn clone(&self) -> GaussianJackknifePlusStats
fn clone(&self) -> GaussianJackknifePlusStats
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GaussianJackknifePlusStats
impl Debug for GaussianJackknifePlusStats
Source§impl<'de> Deserialize<'de> for GaussianJackknifePlusStats
impl<'de> Deserialize<'de> for GaussianJackknifePlusStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GaussianJackknifePlusStats
impl RefUnwindSafe for GaussianJackknifePlusStats
impl Send for GaussianJackknifePlusStats
impl Sync for GaussianJackknifePlusStats
impl Unpin for GaussianJackknifePlusStats
impl UnsafeUnpin for GaussianJackknifePlusStats
impl UnwindSafe for GaussianJackknifePlusStats
Blanket Implementations§
impl<T> Allocation for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.