pub struct JointPenaltySpec {
pub label: Option<String>,
pub matrix: ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
pub initial_log_lambda: f64,
pub nullspace_dim: usize,
pub group: Option<usize>,
}Expand description
A penalty whose support spans the entire compiled parameter vector.
Unlike crate::families::custom_family::PenaltyMatrix, this carries a
single dense total_compiled × total_compiled quadratic form — the
shape produced by T^T S_j T pullback after the V+M / SMGS-exact
compile. The nullspace_dim is the structural dimension of ker(S)
as reported by the construction site (rank-revealing on the pulled-back
operator, not the pre-pullback S_j), so the REML pseudo-logdet can
avoid numerical rank thresholds.
Fields§
§label: Option<String>Optional user-visible precision label. Joint penalties that share a
label share one smoothing parameter (same convention as
crate::families::custom_family::PenaltyMatrix::Labeled).
matrix: ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>Dense symmetric PSD matrix of shape (total_compiled, total_compiled).
initial_log_lambda: f64Initial value of log λ for this penalty.
nullspace_dim: usizeStructural nullspace dimension of matrix (i.e. total_compiled - rank).
group: Option<usize>Optional term grouping, declared by the producing family.
Specs sharing a group are the SAME smooth term seen through different
class contrasts, so a relabeling permutes them among themselves. Any
consumer that needs a reference-INVARIANT quantity per term must
aggregate over the group rather than read one spec: an individual spec’s
matrix is expressed in the stacked ALR basis, whose meaning depends on
which class is the reference (#2579). This is deliberately a declared
integer and not something recovered by parsing Self::label — a
substring classifier over a formatted name is exactly the failure #2593
was closed for.
None means “stands alone”, which is every family that does not group.
Implementations§
Source§impl JointPenaltySpec
impl JointPenaltySpec
Sourcepub fn pseudo_rank(&self) -> usize
pub fn pseudo_rank(&self) -> usize
Structural pseudo-rank, derived from the declared nullspace_dim.
This is the rank used by the REML pseudo-logdet under the
no-numerical-thresholds policy in the surrounding code.
Sourcepub fn quadratic_form(
&self,
beta: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
) -> f64
pub fn quadratic_form( &self, beta: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, ) -> f64
Quadratic form βᵀ S β. Mirrors
crate::families::custom_family::PenaltyMatrix::quadratic_form for
the full-width case.
Sourcepub fn validated_root(
&self,
) -> Result<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, JointPenaltyError>
pub fn validated_root( &self, ) -> Result<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, JointPenaltyError>
Validate shape, finiteness, symmetry, PSD, and nullspace bookkeeping,
returning the invariant thin root R such that matrix = RᵀR.
Joint-penalty strengths vary throughout an outer optimization, but the component matrices do not. Returning the root from the same eigendecomposition that validates the component lets callers retain it as penalty geometry instead of repeating one O(p³) decomposition per component on every objective evaluation.
Sourcepub fn validate(&self) -> Result<(), JointPenaltyError>
pub fn validate(&self) -> Result<(), JointPenaltyError>
Validate this joint penalty without retaining its spectral root.
Trait Implementations§
Source§impl Clone for JointPenaltySpec
impl Clone for JointPenaltySpec
Source§fn clone(&self) -> JointPenaltySpec
fn clone(&self) -> JointPenaltySpec
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 JointPenaltySpec
impl RefUnwindSafe for JointPenaltySpec
impl Send for JointPenaltySpec
impl Sync for JointPenaltySpec
impl Unpin for JointPenaltySpec
impl UnsafeUnpin for JointPenaltySpec
impl UnwindSafe for JointPenaltySpec
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> 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.