Deterministic Morphisms¶
Dirac kernels for deterministic maps: cumulative sums for monotone splines, the softmax projection onto the simplex, and covariance reconstruction from a correlation Cholesky factor and scales.
deterministic
¶
Deterministic morphisms in :math:\mathbf{Kern}.
Each builder returns a ContinuousMorphism whose runtime
realisation is a Dirac kernel concentrated on a deterministic
image: cumsum_morphism for ordinal monotone splines,
softmax_morphism for the standard simplex projection,
cholesky_quad_form_morphism for
covariance reconstruction from a correlation Cholesky factor and
a positive-scale vector.
Categorically a deterministic morphism :math:f : X \to Y is the
unit-Kleisli image of a measurable map; its log-density is
:math:-\infty everywhere except at :math:y = f(x) and zero
there. The variational backend treats the sampling path as an
identity reparameterization of the deterministic image and the
log-density as a no-op (the surrounding KL terms absorb the
Dirac indicator).
DeterministicMorphism
¶
DeterministicMorphism(domain: AnySpace, codomain: AnySpace, apply: Callable[[Tensor], Tensor], name: str)
Bases: ContinuousMorphism
Helper base for deterministic morphisms f : X → Y.
A deterministic morphism in :math:\mathbf{Kern} is a Dirac
kernel concentrated on :math:f(x). Its log-density is
:math:-\infty everywhere except at :math:y = f(x) and
:math:0 (= :math:\log 1) there; for gradient-based inference
we treat the sampling path as an identity reparameterization
of the deterministic image.
Subclasses supply _apply(x) -> y.
Source code in src/quivers/continuous/deterministic.py
point_mass_value
¶
The Dirac's location, :math:f(x).
Reporting it lets a composition through this morphism integrate over its codomain exactly, by evaluating the next kernel at the single point carrying all the mass, instead of approximating an integral that has no spread to resolve.
Source code in src/quivers/continuous/deterministic.py
cumsum_morphism
¶
cumsum_morphism(dim: int) -> DeterministicMorphism
Cumulative sum cumsum : Euclidean(dim) → Euclidean(dim).
Maps :math:(x_1, \dots, x_K) to
:math:(x_1, x_1 + x_2, \dots, \sum_i x_i). The canonical
monotonic-spline parameterization for ordinal covariates
(coef ~ Normal(0, sigma) followed by cumsum(coef - coef[0])
gives a 0-anchored, monotonically-increasing effect across the
ordered levels).
Source code in src/quivers/continuous/deterministic.py
softmax_morphism
¶
softmax_morphism(dim: int) -> DeterministicMorphism
Softmax softmax : Euclidean(dim) → Simplex(dim).
The standard exponential normalizer onto the probability simplex. Useful for closed-form class-probability computations in posterior blocks where one would otherwise need a log-sum-exp aggregation by hand.
Source code in src/quivers/continuous/deterministic.py
cholesky_quad_form_morphism
¶
cholesky_quad_form_morphism(dim: int) -> ContinuousMorphism
Covariance reconstruction (L, s) -> diag(s) L L^T diag(s).
Given a Cholesky factor :math:L of a :math:K \times K
correlation matrix and a positive-scale vector
:math:s \in (0, \infty)^K, returns the corresponding
covariance matrix :math:\Sigma = D R D^T with
:math:R = L L^T and :math:D = \mathrm{diag}(s).
Domain is the product
CholeskyFactor(K) <quivers.continuous.spaces.CholeskyFactor> *
PositiveReals(K) <quivers.continuous.spaces.PositiveReals>;
codomain is Euclidean(K * K) <quivers.continuous.spaces.Euclidean>
flattened in row-major order so the result composes with
downstream
quivers.continuous.families.ConditionalMultivariateNormal
consumers that accept a flat covariance vector.