pub struct GridSpline2dFit {
pub coeffs: Vec<Vec<f64>>,
pub log_lambda: f64,
pub sigma2: Vec<f64>,
pub restricted_loglik: f64,
/* private fields */
}Expand description
Fitted penalized tensor-product smoother with its factored covariance.
Fields§
§coeffs: Vec<Vec<f64>>Per response dimension: coefficients in row-major flat order
g = j1·(K+3) + j2.
log_lambda: f64Selected (or supplied) log smoothing parameter, shared by all response dimensions.
sigma2: Vec<f64>Per response dimension: profiled (or supplied) observation variance σ².
restricted_loglik: f64Pooled restricted log-likelihood at the optimum, up to λ- and data-independent additive constants (exact REML differences across λ).
Implementations§
Source§impl GridSpline2dFit
impl GridSpline2dFit
Sourcepub fn to_state(&self) -> GridSpline2dState
pub fn to_state(&self) -> GridSpline2dState
Snapshot the fit for persistence (#1031). Verbatim — every field
predict reads is copied; the training design is not retained on the fit
and is not needed for replay.
Sourcepub fn from_state(state: &GridSpline2dState) -> Result<Self, String>
pub fn from_state(state: &GridSpline2dState) -> Result<Self, String>
Rebuild a predict-capable fit from a snapshot (#1031). Validates shape,
finiteness, positive cell widths/counts, positive σ², and that the basis
arithmetic is self-consistent (m_axis = K + 3, chol is p × p,
coeffs/sigma2 agree on D), so a corrupt payload fails here rather
than inside a later predict. The restored fit replays the posterior
mean+variance bit-for-bit: predict reads only the snapshotted fields.
Sourcepub fn predict(
&self,
dim: usize,
x1: f64,
x2: f64,
) -> Result<(f64, f64), String>
pub fn predict( &self, dim: usize, x1: f64, x2: f64, ) -> Result<(f64, f64), String>
Posterior (mean, variance) of response dimension dim at an
arbitrary point: the 16-entry basis row dotted with the coefficients,
and σ̂²_dim·x'(X'WX+λS)⁻¹x through the retained Cholesky factor.
Outside the bounding box the boundary cell’s cubic polynomial extends.
Auto Trait Implementations§
impl Freeze for GridSpline2dFit
impl RefUnwindSafe for GridSpline2dFit
impl Send for GridSpline2dFit
impl Sync for GridSpline2dFit
impl Unpin for GridSpline2dFit
impl UnsafeUnpin for GridSpline2dFit
impl UnwindSafe for GridSpline2dFit
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> 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.