pub struct MultinomialFitInputs<'a> {
pub design: ArrayView2<'a, f64>,
pub y_one_hot: ArrayView2<'a, f64>,
pub penalty: ArrayView2<'a, f64>,
pub lambdas: ArrayView1<'a, f64>,
pub row_weights: Option<ArrayView1<'a, f64>>,
pub fisher_w_override: Option<ArrayView3<'a, f64>>,
pub max_iter: usize,
pub tol: f64,
}Expand description
Inputs to fit_penalized_multinomial.
The penalty matrix S is shared across classes; per-class smoothing
parameters lambdas (length K - 1) scale S independently for each
active class. The full block-replicated penalty is diag_a(λ_a) ⊗ S,
which is exactly what gam_solve::arrow_schur::KroneckerPenaltyOp
expresses in matrix-free form when this driver is later lifted into the
arrow-Schur loop.
Fields§
§design: ArrayView2<'a, f64>Design matrix X ∈ ℝ^{N×P} (one row per observation).
y_one_hot: ArrayView2<'a, f64>Categorical response Y ∈ ℝ^{N×K}. Each row must be a point on the
probability simplex (y_c ≥ 0, Σ_c y_c = 1): a one-hot indicator for
hard classification, or a label-smoothed probability vector. Rows whose
mass departs from 1 are rejected — the softmax residual gradient and
Fisher block are the derivatives of Σ_c y_c log p_c only under the
simplex constraint (see validate_multinomial_simplex).
penalty: ArrayView2<'a, f64>Shared smoothing penalty S ∈ ℝ^{P×P} (symmetric, PSD).
lambdas: ArrayView1<'a, f64>Per-active-class smoothing parameter λ_a (length K - 1).
row_weights: Option<ArrayView1<'a, f64>>Optional per-row weights (length N); None ⇒ uniform 1.0.
fisher_w_override: Option<ArrayView3<'a, f64>>Optional per-row Fisher-block override, shape (N, K-1, K-1) in the
active-class gauge (the reference class K-1 is dropped). When Some,
each Newton step uses this block as the curvature W in place of the
analytic softmax Fisher w_n (δ_ab p_a − p_a p_b); the gradient/residual
path stays analytic, so this is a curvature-only override (the
research escape-hatch for latent multinomial fits, issue #349). Each
per-row block must be symmetric, PSD, and finite — preconditions the
FFI boundary discharges before constructing this view.
max_iter: usizeMaximum Newton iterations; recommend 50.
tol: f64Relative-step convergence tolerance; recommend 1e-7.
Trait Implementations§
Source§impl<'a> Clone for MultinomialFitInputs<'a>
impl<'a> Clone for MultinomialFitInputs<'a>
Source§fn clone(&self) -> MultinomialFitInputs<'a>
fn clone(&self) -> MultinomialFitInputs<'a>
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<'a> Freeze for MultinomialFitInputs<'a>
impl<'a> RefUnwindSafe for MultinomialFitInputs<'a>
impl<'a> Send for MultinomialFitInputs<'a>
impl<'a> Sync for MultinomialFitInputs<'a>
impl<'a> Unpin for MultinomialFitInputs<'a>
impl<'a> UnsafeUnpin for MultinomialFitInputs<'a>
impl<'a> UnwindSafe for MultinomialFitInputs<'a>
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.