pub struct TermCollectionSpec {
pub linear_terms: Vec<LinearTermSpec>,
pub random_effect_terms: Vec<RandomEffectTermSpec>,
pub smooth_terms: Vec<SmoothTermSpec>,
}Fields§
§linear_terms: Vec<LinearTermSpec>§random_effect_terms: Vec<RandomEffectTermSpec>§smooth_terms: Vec<SmoothTermSpec>Implementations§
Source§impl TermCollectionSpec
impl TermCollectionSpec
Sourcepub fn write_structural_shape_hash(&self, h: &mut Fingerprinter)
pub fn write_structural_shape_hash(&self, h: &mut Fingerprinter)
Write this collection’s topology identity into a warm-start cache fingerprint (#869).
The persistent warm-start cache_key hashes only family + raw input
dimensions, so two fits on the same data that differ only in their
smooth topology (the s(..., type=AUTO) candidate enumeration: sphere
vs torus vs euclidean vs duchon) collide on one key and seed each other
with geometrically incompatible β/ρ. Folding the per-term structural
kind + feature columns + linear/random-effect counts into the shape hash
gives each candidate its own key, so the screen→full-refit reuse of one
candidate is preserved while cross-candidate contamination is removed.
Only the structural identity is hashed (not fitted coefficients or
frozen knot values), so a refit of the same topology still hits.
Sourcepub fn validate_frozen(&self, label: &str) -> Result<(), String>
pub fn validate_frozen(&self, label: &str) -> Result<(), String>
Validate that a term collection spec represents a fully frozen model (i.e. all knots/centers are pre-computed, identifiability transforms are baked in, and random-effect levels are fixed).
Sourcepub fn remap_feature_columns<E, F>(
&self,
remap: F,
) -> Result<TermCollectionSpec, E>
pub fn remap_feature_columns<E, F>( &self, remap: F, ) -> Result<TermCollectionSpec, E>
Re-resolve every stored feature-column index through remap, returning a
spec that addresses a different column layout.
A frozen TermCollectionSpec stores feature columns as absolute indices
into the training table. To replay it on a fresh dataset whose columns
sit at different positions — the common case at prediction time, where
the response column is unknown and may be absent entirely — every index
must be re-resolved against the new layout. remap receives each
training-table index and returns its position in the runtime table;
callers typically implement it as “look the name up in the training
headers, then resolve that name against the prediction dataset”.
This is the single authority on which fields carry a column index
across every basis variant (linear, random-effect, the by= column of
ByVariable/FactorSumToZero/BySmooth, the continuous and group
columns of a FactorSmooth, and the multi-axis feature_cols of every
spatial/tensor basis), so a predict-time realignment cannot silently miss
one and dereference a stale training index.
Trait Implementations§
Source§impl Clone for TermCollectionSpec
impl Clone for TermCollectionSpec
Source§fn clone(&self) -> TermCollectionSpec
fn clone(&self) -> TermCollectionSpec
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 TermCollectionSpec
impl Debug for TermCollectionSpec
Source§impl<'de> Deserialize<'de> for TermCollectionSpec
impl<'de> Deserialize<'de> for TermCollectionSpec
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 TermCollectionSpec
impl RefUnwindSafe for TermCollectionSpec
impl Send for TermCollectionSpec
impl Sync for TermCollectionSpec
impl Unpin for TermCollectionSpec
impl UnsafeUnpin for TermCollectionSpec
impl UnwindSafe for TermCollectionSpec
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.