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
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.
ThinPlate
Fields
Sphere
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).
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
Matern
Fields
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: boolRealized 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
nullspace_order: DuchonNullspaceOrderinput_scales: Option<Vec<f64>>Per-column standard deviations used for input standardization (d > 1).
Pca
Fields
TensorBSpline
Fields
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).
SphereHarmonics
BySmooth
Wrap an inner basis metadata to record a multiplicative by (continuous or
factor) along a column of the dataset.
FactorSmooth
Factor-by-smooth (mgcv-style s(x, by=g, bs="fs"|"sz"|"re")).
Fields
marginal_is_cr: booltrue 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
impl Clone for BasisMetadata
Source§fn clone(&self) -> BasisMetadata
fn clone(&self) -> BasisMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BasisMetadata
impl RefUnwindSafe for BasisMetadata
impl Send for BasisMetadata
impl Sync for BasisMetadata
impl Unpin for BasisMetadata
impl UnsafeUnpin for BasisMetadata
impl UnwindSafe for BasisMetadata
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,
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.