Skip to main content

BasisMetadata

Enum BasisMetadata 

Source
pub enum BasisMetadata {
Show 13 variants BSpline1D { knots: Array1<f64>, identifiability_transform: Option<Array2<f64>>, periodic: Option<(f64, f64, usize)>, degree: Option<usize>, auto_shrink_note: Option<String>, }, CubicRegression1D { knots: Array1<f64>, identifiability_transform: Option<Array2<f64>>, }, ThinPlate { centers: Array2<f64>, length_scale: f64, periodic: Option<Vec<Option<f64>>>, identifiability_transform: Option<Array2<f64>>, input_scales: Option<Vec<f64>>, radial_reparam: Option<Array2<f64>>, }, Sphere { centers: Array2<f64>, penalty_order: usize, method: SphereMethod, max_degree: Option<usize>, wahba_kernel: SphereWahbaKernel, constraint_transform: Option<Array2<f64>>, }, ConstantCurvature { centers: Array2<f64>, kappa: f64, length_scale: f64, constraint_transform: Option<Array2<f64>>, }, MeasureJet {
Show 13 fields centers: Array2<f64>, input_scales: Option<Vec<f64>>, length_scale: f64, eps_band: Vec<f64>, order_s: f64, alpha: f64, tau0: f64, masses: Array1<f64>, support_means: Vec<f64>, penalty_normalization_scales: Vec<f64>, raw_penalty_normalization_scales: Vec<f64>, fused_penalty_normalization_scale: Option<f64>, constraint_transform: Option<Array2<f64>>,
}, Matern { centers: Array2<f64>, length_scale: f64, periodic: Option<Vec<Option<f64>>>, nu: MaternNu, include_intercept: bool, identifiability_transform: Option<Array2<f64>>, input_scales: Option<Vec<f64>>, aniso_log_scales: Option<Vec<f64>>, nullspace_shrinkage_survived: bool, }, Duchon { centers: Array2<f64>, length_scale: Option<f64>, periodic: Option<Vec<Option<f64>>>, power: f64, nullspace_order: DuchonNullspaceOrder, identifiability_transform: Option<Array2<f64>>, input_scales: Option<Vec<f64>>, aniso_log_scales: Option<Vec<f64>>, operator_collocation_points: Option<Array2<f64>>, radial_reparam: Option<Array2<f64>>, }, Pca { feature_cols: Vec<usize>, basis_matrix: Array2<f64>, centered: bool, smooth_penalty: f64, center_mean: Option<Array1<f64>>, pca_basis_path: Option<PathBuf>, chunk_size: usize, }, TensorBSpline { feature_cols: Vec<usize>, knots: Vec<Array1<f64>>, degrees: Vec<usize>, periods: Vec<Option<f64>>, is_cr: Vec<bool>, identifiability_transform: Option<Array2<f64>>, }, SphereHarmonics { max_degree: usize, radians: bool, }, BySmooth { inner: Box<BasisMetadata>, by_col: usize, levels: Option<Vec<u64>>, ordered: bool, }, FactorSmooth { continuous_cols: Vec<usize>, group_col: usize, knots: Array1<f64>, degree: usize, periodic: Option<(f64, f64, usize)>, group_levels: Vec<u64>, flavour: String, marginal_is_cr: bool, },
}
Expand description

Metadata returned by generic basis builders.

Variants§

§

BSpline1D

Fields

§knots: Array1<f64>
§identifiability_transform: Option<Array2<f64>>
§periodic: Option<(f64, f64, usize)>
§degree: Option<usize>

Effective B-spline polynomial degree carried by knots.

Persisted alongside knots so prediction can reconstruct an evaluator that matches fit-time geometry, even when the fit-time auto-shrink (issue #340) reduced the user’s requested degree to fit the available data (n too small for cubic ⇒ quadratic ⇒ linear). When None the consumer should fall back to the upstream BSplineBasisSpec.degree (legacy / non-shrunk path).

§auto_shrink_note: Option<String>

Human-readable description of an automatic basis shrink (issue #340) when the user’s requested (degree, num_internal_knots) exceeded the available evaluation count n. Some(note) records the before→after configuration; None means no auto-shrink occurred for this basis.

§

CubicRegression1D

Natural cubic regression spline (bs="cr"/"cs") metadata (#1074).

knots are the k Lancaster–Salkauskas knots that index the basis values directly (basis dim = knots.len()). Predict-time rebuilds reconstruct the cr geometry from knots and replay the captured identifiability_transform exactly, mirroring BSpline1D.

Fields

§knots: Array1<f64>
§identifiability_transform: Option<Array2<f64>>
§

ThinPlate

Fields

§centers: Array2<f64>
§length_scale: f64
§periodic: Option<Vec<Option<f64>>>
§identifiability_transform: Option<Array2<f64>>
§input_scales: Option<Vec<f64>>

Per-column standard deviations used for input standardization (d > 1).

§radial_reparam: Option<Array2<f64>>

Wood-TPRS radial reparameterization carried into prediction so the rotated radial basis at predict-time matches fit-time exactly. None in the lazy/streaming path which retains the original basis.

§

Sphere

Fields

§centers: Array2<f64>
§penalty_order: usize
§max_degree: Option<usize>
§wahba_kernel: SphereWahbaKernel
§constraint_transform: Option<Array2<f64>>
§

ConstantCurvature

Constant-curvature (M_κ) geodesic-kernel smooth (#944). kappa and the realized length_scale are persisted so predict-time (and the future ψ-channel per-trial) rebuilds replay the exact fit-time geometry; constraint_transform is the composed z · z_parametric frozen by the global identifiability pipeline (#532 pattern).

Fields

§centers: Array2<f64>
§kappa: f64
§length_scale: f64
§constraint_transform: Option<Array2<f64>>
§

MeasureJet

Measure-jet spline smooth: multiscale local-jet-residual energy of the empirical measure, quadratured on the center set. centers are the REALIZED barycenter nodes; order_s stores the spec’s order sentinel verbatim as the mode marker (0.0 = per-level/spectral, > 0 = fused pin — persisting a realized default would flip the rebuilt mode). The penalty depends on the FIT data through masses, the realized eps_band, the support anchors, and the normalization scales, so all are persisted and replayed verbatim by predict-time (and per-ψ-trial) rebuilds — recomputing either from predict rows would change the penalty the coefficients were estimated under. constraint_transform is the composed z · z_parametric frozen by the global identifiability pipeline (#532 pattern).

Fields

§centers: Array2<f64>
§input_scales: Option<Vec<f64>>
§length_scale: f64
§eps_band: Vec<f64>
§order_s: f64
§alpha: f64
§tau0: f64
§masses: Array1<f64>
§support_means: Vec<f64>
§penalty_normalization_scales: Vec<f64>
§raw_penalty_normalization_scales: Vec<f64>
§fused_penalty_normalization_scale: Option<f64>
§constraint_transform: Option<Array2<f64>>
§

Matern

Fields

§centers: Array2<f64>
§length_scale: f64
§periodic: Option<Vec<Option<f64>>>
§include_intercept: bool
§identifiability_transform: Option<Array2<f64>>
§input_scales: Option<Vec<f64>>

Per-column standard deviations used for input standardization (d > 1).

§aniso_log_scales: Option<Vec<f64>>

Per-axis anisotropy log-scales η_a for geometric anisotropy. When Some, distance is r = √(Σ_a exp(2η_a) · (x_a - c_a)²).

§nullspace_shrinkage_survived: bool

Realized double-penalty nullspace-shrinkage decision at this build (gam#787/#860). The freeze step pins this into MaternIdentifiability::FrozenTransform::nullspace_shrinkage_survived so the κ-optimizer’s per-trial rebuilds keep the learned-penalty count invariant (otherwise the κ-dependent spectral test flips it 6↔7 → “joint hyper rho dimension mismatch”).

§

Duchon

Fields

§centers: Array2<f64>
§length_scale: Option<f64>
§periodic: Option<Vec<Option<f64>>>
§power: f64
§nullspace_order: DuchonNullspaceOrder
§identifiability_transform: Option<Array2<f64>>
§input_scales: Option<Vec<f64>>

Per-column standard deviations used for input standardization (d > 1).

§aniso_log_scales: Option<Vec<f64>>

Per-axis anisotropy log-scales η_a, stored for prediction.

§operator_collocation_points: Option<Array2<f64>>

Support points used to build the active lower-order operator penalties (mass/tension/stiffness). Stored so runtime adaptive caches can rebuild the exact same operator rows instead of guessing from centers.

§radial_reparam: Option<Array2<f64>>

Data-metric radial reparameterization V (#1355). When Some, the constrained kernel transform is folded to Z·V so predict-time and κ-trial rebuilds replay the exact fit-time rotated radial basis. None on the lazy/streaming path (original constrained basis).

§

Pca

Fields

§feature_cols: Vec<usize>
§basis_matrix: Array2<f64>
§centered: bool
§smooth_penalty: f64
§center_mean: Option<Array1<f64>>
§pca_basis_path: Option<PathBuf>
§chunk_size: usize
§

TensorBSpline

Fields

§feature_cols: Vec<usize>
§knots: Vec<Array1<f64>>
§degrees: Vec<usize>
§periods: Vec<Option<f64>>
§is_cr: Vec<bool>

Per-margin flag: true when that margin is a natural cubic regression spline (NaturalCubicRegression knotspec) rather than an open/periodic B-spline (#1074). Persisted so the tensor freeze rebuilds the cr marginal knotspec (value-at-knot) instead of an open Provided(knots) B-spline, keeping predict-time marginals identical to the fit-time cr margins. Defaults to all-false (legacy B-spline tensors) when deserialized from an older persisted model (the older-model default is applied on the persisted SmoothBasisSpec side; BasisMetadata itself is transient builder output and is not serde-serialized, so it carries no #[serde] attributes).

§identifiability_transform: Option<Array2<f64>>
§

SphereHarmonics

Fields

§max_degree: usize
§radians: bool
§

BySmooth

Wrap an inner basis metadata to record a multiplicative by (continuous or factor) along a column of the dataset.

Fields

§by_col: usize
§levels: Option<Vec<u64>>
§ordered: bool
§

FactorSmooth

Factor-by-smooth (mgcv-style s(x, by=g, bs="fs"|"sz"|"re")).

Fields

§continuous_cols: Vec<usize>
§group_col: usize
§knots: Array1<f64>
§degree: usize
§periodic: Option<(f64, f64, usize)>
§group_levels: Vec<u64>
§flavour: String
§marginal_is_cr: bool

true when the per-level marginal is a cubic regression spline (NaturalCubicRegression knotspec, mgcv’s bs="sz" default marginal, #1074). Predict-time freeze must then restore a cr knotspec from the stored value-knots rather than treating them as a B-spline knot vector. Defaults to false (B-spline marginal) for backward compat.

Trait Implementations§

Source§

impl Clone for BasisMetadata

Source§

fn clone(&self) -> BasisMetadata

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BasisMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V