pub struct CompiledMap {
pub raw_from_compiled: Array2<f64>,
pub compiled_block_ranges: Vec<Range<usize>>,
pub raw_block_ranges: Vec<Range<usize>>,
}Expand description
Closed-form Gram-based compile output: a single p_raw × p_compiled
reparam matrix T mapping compiled coordinates back to raw width.
T · θ lifts a fitted compiled-width β back to raw width; predict-time
row contribution is X_raw · T · θ where X_raw is the full raw design.
compiled_block_ranges[b] gives the column range inside T (and inside
the compiled-width coefficient vector) attributable to raw block b.
raw_block_ranges[b] gives the corresponding raw-width column range.
Fields§
§raw_from_compiled: Array2<f64>(p_raw × p_compiled) raw-from-compiled reparam matrix.
compiled_block_ranges: Vec<Range<usize>>Per-block compiled-width column ranges, parallel to
raw_block_ranges. Same length as the input ordering.
raw_block_ranges: Vec<Range<usize>>Per-block raw-width column ranges (copied through from input).
Implementations§
Source§impl CompiledMap
impl CompiledMap
Sourcepub fn p_compiled(&self) -> usize
pub fn p_compiled(&self) -> usize
Compiled (reduced) coefficient width (p_compiled).
Sourcepub fn reduce_design(
&self,
raw_design: &Array2<f64>,
) -> Result<Array2<f64>, String>
pub fn reduce_design( &self, raw_design: &Array2<f64>, ) -> Result<Array2<f64>, String>
Reparameterise a raw design into compiled coordinates:
X_compiled = X_raw · T (n × p_compiled). Because the lift is
β_raw = T β_compiled, the compiled design predicts identically to the
raw design on every compiled coefficient: X_compiled · θ = X_raw · (T θ).
Families that build directly in reduced coordinates feed this compiled
design (and the reduce_penalties_with_map penalties) to the solver;
the rank-deficient raw basis never reaches Newton.
Sourcepub fn lift_coefficients(
&self,
beta_compiled: &Array1<f64>,
) -> Result<Array1<f64>, String>
pub fn lift_coefficients( &self, beta_compiled: &Array1<f64>, ) -> Result<Array1<f64>, String>
Lift a fitted compiled-width coefficient vector back to raw width:
β_raw = T · β_compiled. This is the exact inverse direction of the
quotient reduction — the reduced coordinates are what Newton/REML
operate in, and this map carries the final estimate (and any linear
functional of it) back to the original parameterisation so reported
coefficients and predictions match the raw design.
Trait Implementations§
Source§impl CompiledBlockMap for CompiledMap
Neutral view of this compiled reparametrisation for the gauge layer
(#1521): Gauge::from_compiled_map lives DOWN in gam-problem and
names only the CompiledBlockMap trait, never the concrete
CompiledMap (which lives ABOVE gam-problem). This impl supplies
the inverted dependency edge.
impl CompiledBlockMap for CompiledMap
Neutral view of this compiled reparametrisation for the gauge layer
(#1521): Gauge::from_compiled_map lives DOWN in gam-problem and
names only the CompiledBlockMap trait, never the concrete
CompiledMap (which lives ABOVE gam-problem). This impl supplies
the inverted dependency edge.
Source§fn raw_from_compiled(&self) -> &Array2<f64>
fn raw_from_compiled(&self) -> &Array2<f64>
(p_raw × p_compiled) raw-from-compiled reparam matrix T.Source§fn raw_block_ranges(&self) -> &[Range<usize>]
fn raw_block_ranges(&self) -> &[Range<usize>]
Source§fn compiled_block_ranges(&self) -> &[Range<usize>]
fn compiled_block_ranges(&self) -> &[Range<usize>]
Self::raw_block_ranges.Auto Trait Implementations§
impl Freeze for CompiledMap
impl RefUnwindSafe for CompiledMap
impl Send for CompiledMap
impl Sync for CompiledMap
impl Unpin for CompiledMap
impl UnsafeUnpin for CompiledMap
impl UnwindSafe for CompiledMap
Blanket Implementations§
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.