pub struct LogKernelSumJet {
pub value: f64,
pub d1: f64,
pub d2: f64,
pub d3: f64,
pub d4: f64,
pub mode: IntegratedExpectationMode,
}Expand description
Derivatives of log(Σ_j a_j · K_{k_j, m_j}(μ, σ)) with respect to μ.
This is the workhorse for row-level log-likelihood derivatives in all latent families. The numerator and denominator of a row likelihood are each a small signed sum of kernel terms.
The value path is assembled from log-space kernel bundles and ratio jets,
so individual kernel terms are never exponentiated before the final signed
sum. That avoids the old overflow/underflow problems from value-space
kernels. When the signed sum is zero or negative, this returns an invalid
row (value = -∞) instead of trying to continue with a floored surrogate.
Signed two-term differences (e.g. interval censoring K_{0,M_L} − K_{0,M_R})
are still combined through the shared sign-aware log-sum path.
Fields§
§value: f64log(Σ a_j K_j)
d1: f64d/dμ log(Σ a_j K_j)
d2: f64d²/dμ² log(Σ a_j K_j)
d3: f64d³/dμ³ log(Σ a_j K_j)
d4: f64d⁴/dμ⁴ log(Σ a_j K_j)
mode: IntegratedExpectationModeImplementations§
Source§impl LogKernelSumJet
impl LogKernelSumJet
Sourcepub fn single_term(
quadctx: &QuadratureContext,
k: usize,
m: f64,
mu: f64,
sigma: f64,
) -> Result<Self, EstimationError>
pub fn single_term( quadctx: &QuadratureContext, k: usize, m: f64, mu: f64, sigma: f64, ) -> Result<Self, EstimationError>
Evaluate for a single positive kernel term (fast path).
Computes log(K_{k,m}) and its μ-derivatives from exact recurrences,
entirely in log-space.
Sourcepub fn evaluate(
quadctx: &QuadratureContext,
terms: &[KernelSumTerm],
mu: f64,
sigma: f64,
) -> Result<Self, EstimationError>
pub fn evaluate( quadctx: &QuadratureContext, terms: &[KernelSumTerm], mu: f64, sigma: f64, ) -> Result<Self, EstimationError>
Evaluate log(Σ a_j K_j) and its μ-derivatives for a small signed sum.
All terms share the same (μ, σ). Both the value and derivative
ratios are computed entirely in log-space. The runtime latent-survival
rows in this repo are almost always one-term or two-term sums, so those
cases stay on dedicated stack paths; the heap-backed logic below is only
for genuinely longer symbolic sums:
- Per-term log-magnitudes
log|a_j| + log K_{k_j,m_j}and signs. - Sign-aware log-sum-exp to get
log|S|andsign(S). - Importance weights
w_j = a_j K_j / Sformed in log-space. - Weighted ratio sums
R_n = Σ w_j · (∂ⁿK_j / K_j)for the final log-derivatives.
Trait Implementations§
Source§impl Clone for LogKernelSumJet
impl Clone for LogKernelSumJet
Source§fn clone(&self) -> LogKernelSumJet
fn clone(&self) -> LogKernelSumJet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LogKernelSumJet
Auto Trait Implementations§
impl Freeze for LogKernelSumJet
impl RefUnwindSafe for LogKernelSumJet
impl Send for LogKernelSumJet
impl Sync for LogKernelSumJet
impl Unpin for LogKernelSumJet
impl UnsafeUnpin for LogKernelSumJet
impl UnwindSafe for LogKernelSumJet
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.