Continuous Families¶
The module gives the families of continuous distributions
(family registry), each chosen by the values
a response can take: a Normal for real values, and other families for positive or bounded
supports. A conditional family
computes its parameters from its input through a learned parameter map, while a fixed call such as
Normal(loc=0, scale=1) has constant parameters.
families
¶
Parameterized distribution families as continuous morphisms.
Each family is a ContinuousMorphism whose codomain is a continuous space and whose conditional distribution p(y | x) belongs to a specific parametric family. The parameters are learnable functions of x:
- For discrete domains (FinSet): parameters are looked up from a table.
- For continuous domains (ContinuousSpace): parameters are produced by a small neural network.
This module wraps every reparameterizable distribution in torch.distributions as a conditional morphism, plus custom families (TruncatedNormal, MultivariateNormal, etc.).
Architecture
Most per-dimension-independent distributions are built on a shared
generic base _IndependentConditional that handles the parameter
source, transform, and torch.distributions plumbing. The
_make_family class factory generates named classes from a
specification. Distributions that need special handling
(MultivariateNormal, Dirichlet, TruncatedNormal, etc.) are
implemented as standalone classes.
ConditionalCauchy
module-attribute
¶
ConditionalCauchy = _make_family('ConditionalCauchy', D.Cauchy, [('loc', 'id'), ('scale', 'softplus')], 'Conditional Cauchy(loc(x), scale(x)). Heavy-tailed, no finite moments.')
Conditional Cauchy(loc(x), scale(x)). Heavy-tailed, no finite moments.
ConditionalLaplace
module-attribute
¶
ConditionalLaplace = _make_family('ConditionalLaplace', D.Laplace, [('loc', 'id'), ('scale', 'softplus')], 'Conditional Laplace(loc(x), scale(x)). Sharp peak, heavier tails than normal.')
Conditional Laplace(loc(x), scale(x)). Sharp peak, heavier tails than normal.
ConditionalCOMPoisson
module-attribute
¶
ConditionalCOMPoisson = _make_family('ConditionalCOMPoisson', COMPoisson, [('rate', 'softplus'), ('dispersion', 'softplus')], 'Conditional Conway--Maxwell--Poisson rate and dispersion.', discrete=True, inline_bounds={'rate': (0.0, math.inf)})
Conditional COM-Poisson count law.
ConditionalWiener
module-attribute
¶
ConditionalWiener = _make_family('ConditionalWiener', Wiener, [('boundary', 'softplus'), ('ndt', 'softplus'), ('bias', 'sigmoid'), ('drift', 'id')], 'Conditional joint signed Wiener reaction times and boundary decisions.', discrete=False, inline_bounds={'ndt': (0.0, math.inf)})
Conditional Wiener joint signed response-time law.
ConditionalDiscreteWeibull
module-attribute
¶
ConditionalDiscreteWeibull = _make_family('ConditionalDiscreteWeibull', DiscreteWeibull, [('probs', 'sigmoid'), ('concentration', 'softplus')], 'Conditional discrete Weibull survival probability and positive power.', discrete=True)
Conditional discrete Weibull count law.
ConditionalZeroInflatedAsymmetricLaplace
module-attribute
¶
ConditionalZeroInflatedAsymmetricLaplace = _make_family('ConditionalZeroInflatedAsymmetricLaplace', ZeroInflatedAsymmetricLaplace, [('zero_prob', 'sigmoid'), ('loc', 'id'), ('scale', 'softplus'), ('quantile', 'sigmoid')], 'Conditional structural zero and asymmetric Laplace quantile response.', discrete=False)
Conditional zero atom and asymmetric Laplace continuous component.
ConditionalAsymmetricLaplace
module-attribute
¶
ConditionalAsymmetricLaplace = _make_family('ConditionalAsymmetricLaplace', AsymmetricLaplace, [('loc', 'id'), ('scale', 'softplus'), ('quantile', 'sigmoid')], 'Conditional asymmetric Laplace with input-driven location, scale, and quantile.')
Conditional quantile regression distribution with three input-driven parameters.
ConditionalExGaussian
module-attribute
¶
ConditionalExGaussian = _make_family('ConditionalExGaussian', ExGaussian, [('loc', 'id'), ('scale', 'softplus'), ('rate', 'softplus')], 'Conditional exponentially modified Gaussian with location, Normal scale, and Exponential rate.')
Conditional sum of a Normal and an independent Exponential variable.
ConditionalExtendedBeta
module-attribute
¶
ConditionalExtendedBeta = _make_family('ConditionalExtendedBeta', ExtendedBeta, [('mu', 'sigmoid'), ('phi', 'softplus'), ('kappa', 'softplus')], 'Conditional censored extended Beta with mean, precision, and extension heads.', discrete=False, inline_bounds={'kappa': (0.0, math.inf)})
Conditional extended-Beta component parameters with endpoint censoring atoms.
ConditionalInverseGaussian
module-attribute
¶
ConditionalInverseGaussian = _make_family('ConditionalInverseGaussian', InverseGaussian, [('mu', 'softplus'), ('shape', 'softplus')], 'Conditional inverse Gaussian with input-driven mean and shape.')
Conditional inverse Gaussian with implicit reparameterized sampling.
ConditionalHurdleGamma
module-attribute
¶
ConditionalHurdleGamma = _make_family('ConditionalHurdleGamma', HurdleGamma, [('zero_prob', 'sigmoid'), ('concentration', 'softplus'), ('rate', 'softplus')], 'Conditional structural zero probability and Gamma shape/rate response.', discrete=False)
Conditional zero atom combined with a positive Gamma component.
ConditionalHurdleLogNormal
module-attribute
¶
ConditionalHurdleLogNormal = _make_family('ConditionalHurdleLogNormal', HurdleLogNormal, [('zero_prob', 'sigmoid'), ('loc', 'id'), ('scale', 'softplus')], 'Conditional structural zero probability and LogNormal log-location/log-scale response.', discrete=False)
Conditional zero atom combined with a positive LogNormal component.
ConditionalSkewNormal
module-attribute
¶
ConditionalSkewNormal = _make_family('ConditionalSkewNormal', SkewNormal, [('loc', 'id'), ('scale', 'softplus'), ('skewness', 'id')], 'Conditional SkewNormal response distribution.')
Conditional skew-normal with learned location, positive scale, and real skewness.
ConditionalShiftedLogNormal
module-attribute
¶
ConditionalShiftedLogNormal = _make_family('ConditionalShiftedLogNormal', ShiftedLogNormal, [('loc', 'id'), ('scale', 'softplus'), ('shift', 'softplus')], 'Conditional ShiftedLogNormal response distribution.', support=_constraints.real, inline_bounds={'shift': (0.0, math.inf)})
Conditional lognormal component with a learned nonnegative additive shift.
ConditionalFrechet
module-attribute
¶
ConditionalFrechet = _make_family('ConditionalFrechet', Frechet, [('scale', 'softplus'), ('concentration', 'softplus')], 'Conditional Frechet response distribution.')
Conditional Fréchet with learned positive scale and concentration.
ConditionalGeneralizedExtremeValue
module-attribute
¶
ConditionalGeneralizedExtremeValue = _make_family('ConditionalGeneralizedExtremeValue', GeneralizedExtremeValue, [('loc', 'id'), ('scale', 'softplus'), ('concentration', 'id')], 'Conditional GeneralizedExtremeValue response distribution.', support=_constraints.real)
Conditional generalized extreme value with learned location, scale, and tail index.
ConditionalGumbel
module-attribute
¶
ConditionalGumbel = _make_family('ConditionalGumbel', D.Gumbel, [('loc', 'id'), ('scale', 'softplus')], 'Conditional Gumbel(loc(x), scale(x)). Extreme value distribution (type I).')
Conditional Gumbel(loc(x), scale(x)). Extreme value distribution (type I).
ConditionalLogNormal
module-attribute
¶
ConditionalLogNormal = _make_family('ConditionalLogNormal', D.LogNormal, [('loc', 'id'), ('scale', 'softplus')], 'Conditional LogNormal(loc(x), scale(x)). Positive-valued, right-skewed.')
Conditional LogNormal(loc(x), scale(x)). Positive-valued, right-skewed.
ConditionalStudentT
module-attribute
¶
ConditionalStudentT = _make_family('ConditionalStudentT', D.StudentT, [('df', 'softplus_shifted'), ('loc', 'id'), ('scale', 'softplus')], 'Conditional StudentT(df(x), loc(x), scale(x)). Heavy-tailed with learnable df.')
Conditional StudentT(df(x), loc(x), scale(x)). Heavy-tailed with learnable df.
ConditionalExponential
module-attribute
¶
ConditionalExponential = _make_family('ConditionalExponential', D.Exponential, [('rate', 'softplus')], 'Conditional Exponential(rate(x)). Memoryless, positive-valued.')
Conditional Exponential(rate(x)). Memoryless, positive-valued.
ConditionalGamma
module-attribute
¶
ConditionalGamma = _make_family('ConditionalGamma', D.Gamma, [('concentration', 'softplus_shifted'), ('rate', 'softplus')], 'Conditional Gamma(concentration(x), rate(x)). Positive-valued, flexible shape.')
Conditional Gamma(concentration(x), rate(x)). Positive-valued, flexible shape.
ConditionalChi2
module-attribute
¶
ConditionalChi2 = _make_family('ConditionalChi2', D.Chi2, [('df', 'softplus_shifted')], 'Conditional Chi2(df(x)). Positive-valued, sum of squared normals.')
Conditional Chi2(df(x)). Positive-valued, sum of squared normals.
ConditionalHalfCauchy
module-attribute
¶
ConditionalHalfCauchy = _make_family('ConditionalHalfCauchy', D.HalfCauchy, [('scale', 'softplus')], 'Conditional HalfCauchy(scale(x)). Heavy-tailed positive prior.')
Conditional HalfCauchy(scale(x)). Heavy-tailed positive prior.
ConditionalHalfNormal
module-attribute
¶
ConditionalHalfNormal = _make_family('ConditionalHalfNormal', D.HalfNormal, [('scale', 'softplus')], 'Conditional HalfNormal(scale(x)). Folded normal, positive-valued.')
Conditional HalfNormal(scale(x)). Folded normal, positive-valued.
ConditionalInverseGamma
module-attribute
¶
ConditionalInverseGamma = _make_family('ConditionalInverseGamma', D.InverseGamma, [('concentration', 'softplus_shifted'), ('rate', 'softplus')], 'Conditional InverseGamma(concentration(x), rate(x)). Conjugate prior for normal variance.')
Conditional InverseGamma(concentration(x), rate(x)). Conjugate prior for normal variance.
ConditionalWeibull
module-attribute
¶
ConditionalWeibull = _make_family('ConditionalWeibull', D.Weibull, [('scale', 'softplus'), ('concentration', 'softplus')], 'Conditional Weibull(scale(x), concentration(x)). Survival analysis, reliability.')
Conditional Weibull(scale(x), concentration(x)). Survival analysis, reliability.
ConditionalPareto
module-attribute
¶
ConditionalPareto = _make_family('ConditionalPareto', D.Pareto, [('scale', 'softplus'), ('alpha', 'softplus')], 'Conditional Pareto(scale(x), alpha(x)). Power-law tail.')
Conditional Pareto(scale(x), alpha(x)). Power-law tail.
ConditionalLogGamma
module-attribute
¶
ConditionalLogGamma = _make_family('ConditionalLogGamma', LogGamma, [('concentration', 'softplus'), ('rate', 'softplus')], 'Conditional LogGamma(concentration(x), rate(x)). The log of a Gamma variable, scored and sampled on the real line.')
Conditional LogGamma(concentration(x), rate(x)). The log of a Gamma variable, scored and sampled on the real line.
ConditionalLogitBeta
module-attribute
¶
ConditionalLogitBeta = _make_family('ConditionalLogitBeta', LogitBeta, [('concentration1', 'softplus'), ('concentration0', 'softplus')], 'Conditional LogitBeta(a(x), b(x)). The logit of a Beta variable, scored and sampled on the real line.')
Conditional LogitBeta(a(x), b(x)). The logit of a Beta variable, scored and sampled on the real line.
ConditionalKumaraswamy
module-attribute
¶
ConditionalKumaraswamy = _make_family('ConditionalKumaraswamy', D.Kumaraswamy, [('concentration1', 'softplus_shifted'), ('concentration0', 'softplus_shifted')], 'Conditional Kumaraswamy(a(x), b(x)). Beta-like on (0,1), closed-form CDF.')
Conditional Kumaraswamy(a(x), b(x)). Beta-like on (0,1), closed-form CDF.
ConditionalContinuousBernoulli
module-attribute
¶
ConditionalContinuousBernoulli = _make_family('ConditionalContinuousBernoulli', _LogSpaceContinuousBernoulli, [('logits', 'id')], 'Conditional ContinuousBernoulli(logits(x)). Continuous relaxation of Bernoulli.')
Conditional ContinuousBernoulli(logits(x)). Continuous relaxation of Bernoulli.
ConditionalFisherSnedecor
module-attribute
¶
ConditionalFisherSnedecor = _make_family('ConditionalFisherSnedecor', D.FisherSnedecor, [('df1', 'softplus_shifted'), ('df2', 'softplus_shifted')], 'Conditional FisherSnedecor(df1(x), df2(x)). F-distribution, ratio of chi-squared.')
Conditional FisherSnedecor(df1(x), df2(x)). F-distribution, ratio of chi-squared.
ConditionalPoisson
module-attribute
¶
ConditionalPoisson = _make_family('ConditionalPoisson', ClosedPoisson, [('rate', 'softplus')], 'Conditional Poisson(rate(x)). Discrete, non-negative integer counts.', inline_bounds={'rate': (0.0, math.inf)})
Conditional Poisson(rate(x)). Discrete, non-negative integer counts.
ConditionalZeroInflatedNegativeBinomial
module-attribute
¶
ConditionalZeroInflatedNegativeBinomial = _make_family('ConditionalZeroInflatedNegativeBinomial', ZeroInflatedNegativeBinomial, [('zero_prob', 'sigmoid'), ('total_count', 'softplus_shifted'), ('probs', 'sigmoid')], 'Conditional structural zeros plus a negative binomial count.', inline_bounds={'zero_prob': (0.0, 1.0), 'total_count': (0.0, math.inf), 'probs': (0.0, 1.0)})
Conditional zero-inflated negative binomial with three parameter heads.
ConditionalHurdleNegativeBinomial
module-attribute
¶
ConditionalHurdleNegativeBinomial = _make_family('ConditionalHurdleNegativeBinomial', HurdleNegativeBinomial, [('zero_prob', 'sigmoid'), ('total_count', 'softplus_shifted'), ('probs', 'sigmoid')], 'Conditional structural zeros plus a normalized positive negative binomial.', inline_bounds={'zero_prob': (0.0, 1.0), 'probs': (0.0, 1.0)})
Conditional hurdle negative binomial with an efficiently sampled positive count.
ConditionalGeometric
module-attribute
¶
ConditionalGeometric = _make_family('ConditionalGeometric', ClosedGeometric, [('probs', 'sigmoid')], 'Conditional Geometric(probs(x)). Number of failures before first success.', inline_bounds={'probs': (0.0, 1.0)})
Conditional Geometric(probs(x)). Number of failures before first success.
ConditionalNegativeBinomial
module-attribute
¶
ConditionalNegativeBinomial = _make_family('ConditionalNegativeBinomial', ClosedNegativeBinomial, [('total_count', 'softplus_shifted'), ('probs', 'sigmoid')], 'Conditional NegativeBinomial(total_count(x), probs(x)). Discrete, over-dispersed count distribution.', inline_bounds={'total_count': (0.0, math.inf), 'probs': (0.0, 1.0)})
Conditional NegativeBinomial(total_count(x), probs(x)). Discrete, over-dispersed count distribution.
ConditionalVonMises
module-attribute
¶
ConditionalVonMises = _make_family('ConditionalVonMises', D.VonMises, [('loc', 'id'), ('concentration', 'softplus')], 'Conditional VonMises(loc(x), concentration(x)). Circular analogue of the Normal distribution.', discrete=False)
Conditional VonMises(loc(x), concentration(x)). Circular analogue of the Normal distribution.
COMPoisson
¶
COMPoisson(rate=None, dispersion=1.0, *, log_rate=None, validate_args=None, normalization_rtol=1e-12, max_terms=262144, max_proposals=10000)
Bases: Distribution
Counts proportional to rate**k / (k!)**dispersion.
| PARAMETER | DESCRIPTION |
|---|---|
rate
|
Nonnegative rate. Supply exactly one of rate and log_rate.
TYPE:
|
dispersion
|
Strictly positive dispersion exponent.
TYPE:
|
log_rate
|
Logarithm of the rate, permitting rates beyond floating-point range.
TYPE:
|
validate_args
|
Whether to validate parameters and samples.
TYPE:
|
normalization_rtol
|
Certified relative tail tolerance for normalization and moments.
TYPE:
|
max_terms
|
Maximum centered count cells per row before an explicit refusal.
TYPE:
|
max_proposals
|
Maximum rejection rounds per requested sample.
TYPE:
|
Source code in src/quivers/continuous/_com_poisson.py
mean
property
¶
Return a certified response mean.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response means. |
variance
property
¶
Return a certified response variance.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response variances. |
expand
¶
Expand parameter views while retaining the numerical policy.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Unused torch expansion hook.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
COMPoisson
|
Expanded distribution. |
Source code in src/quivers/continuous/_com_poisson.py
log_prob
¶
Score counts with a certified centered normalizer.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate count values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 log masses, negative infinity off support. |
Source code in src/quivers/continuous/_com_poisson.py
sample
¶
sample(sample_shape=Size())
Sample from a log-concave envelope without truncating the law.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 count samples. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a proposal exceeds exact count capacity or the round budget. |
Source code in src/quivers/continuous/_com_poisson.py
BernsteinHazard
¶
Bases: Distribution
A normalized positive baseline hazard and a proportional rate.
| PARAMETER | DESCRIPTION |
|---|---|
breaks
|
Strictly increasing finite boundaries with trailing shape
TYPE:
|
controls
|
Positive Bernstein coefficients of trailing shape
TYPE:
|
rate
|
Positive hazard multiplier, exclusive with log_rate.
TYPE:
|
log_rate
|
Finite log hazard multiplier.
TYPE:
|
validate_args
|
Torch parameter-validation policy.
TYPE:
|
Notes
The final hazard value continues constantly beyond the upper boundary. This positive tail retains total probability one. Normalizing the finite baseline integral identifies its shape separately from the rate. The immutable finite_moment_orders certificate records the first two finite moments; an analytic formula for those moments is not provided.
Source code in src/quivers/continuous/_bernstein_hazard.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
rate
property
¶
Return the proportional multiplier when representable.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exponentiated log rate. Density and tail calculations retain log-rate arithmetic even when this view overflows. |
expand
¶
Expand parameter views without rebuilding the integrated table.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested leading batch dimensions.
TYPE:
|
_instance
|
Optional instance populated through the Torch expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BernsteinHazard
|
Distribution retaining the same baseline and integrated table. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_prob
¶
Evaluate the normalized time density on the nonnegative support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Normalized log density, negative infinity outside the support. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the time is NaN. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_survival_function
¶
Evaluate log survival directly from the integrated hazard.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log survival, evaluated directly from cumulative hazard. |
Source code in src/quivers/continuous/_bernstein_hazard.py
cdf
¶
Evaluate cumulative event probability, including exact support tails.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Cumulative event probability. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_cdf
¶
Evaluate log CDF without subtracting small survival probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probability, retaining small positive probabilities. |
Source code in src/quivers/continuous/_bernstein_hazard.py
icdf
¶
Invert the integrated hazard with a bounded, checked root solve.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probability in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Event quantile; the endpoints return zero and positive infinity. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a probability is NaN or outside the unit interval. |
FloatingPointError
|
If the finite positive quantile is unrepresentable. |
RuntimeError
|
If the bounded root solver does not converge. |
Source code in src/quivers/continuous/_bernstein_hazard.py
rsample
¶
rsample(sample_shape=Size())
Draw vectorized event times by inverse cumulative hazard.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Independent sample dimensions preceding batch dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Pathwise event times from the full normalized law. |
Source code in src/quivers/continuous/_bernstein_hazard.py
ExtendedBeta
¶
ExtendedBeta(mu, phi, kappa, *, moment_atol=1e-12, moment_rtol=1e-10, moment_max_panels=4096, validate_args=None)
Bases: Censored
Extend a mean/precision Beta law and censor its tails at zero and one.
| PARAMETER | DESCRIPTION |
|---|---|
mu
|
Underlying Beta mean, strictly between zero and one.
TYPE:
|
phi
|
Strictly positive Beta precision.
TYPE:
|
kappa
|
Nonnegative extension:
TYPE:
|
moment_atol
|
Deterministic bounded-moment quadrature error budgets.
TYPE:
|
moment_rtol
|
Deterministic bounded-moment quadrature error budgets.
TYPE:
|
moment_max_panels
|
Per-row adaptive panel limit; work is chunked over at most64 rows.
TYPE:
|
validate_args
|
Torch validation policy; parameter validity is always checked.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If parameters or numerical budgets are invalid. |
RuntimeError
|
If the symmetric extension cannot retain its censoring bounds in Float64. |
Source code in src/quivers/continuous/_extended_beta.py
mean
property
¶
mean: Tensor
True censored response mean, computed with deterministic error bounds.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Mean on the parameter batch axes, generally different from mu. |
variance
property
¶
variance: Tensor
Positive within/between response variance without raw-moment cancellation.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Variance on the parameter batch axes. |
expand
¶
Broadcast the same law and deterministic moment budgets.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested parameter batch shape.
TYPE:
|
_instance
|
Optional Torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ExtendedBeta
|
Expanded distribution, retaining the same numerical policy. |
Source code in src/quivers/continuous/_extended_beta.py
sample
¶
Draw censoring atoms before rounding complementary Beta weights.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading independent sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Distribution result on the requested sample and batch axes. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the evaluation or sample exceeds the documented numerical capacity. |
Source code in src/quivers/continuous/_extended_beta.py
rsample
¶
Draw pathwise responses, refusing unrepresentable interior samples.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading independent sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Distribution result on the requested sample and batch axes. |
Source code in src/quivers/continuous/_extended_beta.py
CoxPH
¶
Bases: BernsteinHazard
Proportional hazards with a retained normalized M-spline basis.
| PARAMETER | DESCRIPTION |
|---|---|
basis
|
Immutable fitted knots, degree, and constant endpoint tail.
TYPE:
|
weights
|
Strictly positive simplex weights over basis components.
TYPE:
|
rate
|
Positive proportional multiplier, exclusive with log_rate.
TYPE:
|
log_rate
|
Finite log multiplier.
TYPE:
|
validate_args
|
Torch parameter-validation policy.
TYPE:
|
Source code in src/quivers/continuous/_cox.py
expand
¶
Expand distribution views while retaining the original fitted basis.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested leading batch dimensions.
TYPE:
|
_instance
|
Optional instance populated by the Torch expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CoxPH
|
Expanded view retaining the fitted basis and weights. |
Source code in src/quivers/continuous/_cox.py
MSplineBasis
dataclass
¶
MSplineBasis(boundary_knots: tuple[float, float] = (0.0, 1.0), interior_knots: tuple[float, ...] = (), degree: int = 3, tail: str = 'constant')
Normalized M-splines, integrated I-splines, and a constant hazard tail.
| PARAMETER | DESCRIPTION |
|---|---|
boundary_knots
|
Finite increasing endpoints of the fitted spline interval.
TYPE:
|
interior_knots
|
Strictly increasing knots inside the boundary interval.
TYPE:
|
degree
|
Nonnegative polynomial degree of the M-splines.
TYPE:
|
tail
|
Hazard continuation; currently
TYPE:
|
Notes
Every M-spline integrates to one over the fitted interval. Below its lower boundary both bases are zero. The retained knots and tail policy are part of value equality, so prediction cannot silently rebuild a training basis.
size
property
¶
Return the number of retained spline components.
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of retained normalized spline components. |
__post_init__
¶
Validate immutable knots and construct normalized basis tables.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If knots, degree, tail policy, or basis normalization are invalid. |
NotImplementedError
|
If the retained table exceeds the explicit coefficient budget. |
Source code in src/quivers/_splines.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
evaluate
¶
Evaluate the hazard basis and its integral, including the tail.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Evaluation time, including support endpoints and infinities.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[tuple[float, ...], tuple[float, ...]]
|
M-spline values and integrated I-spline values in component order. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the time is NaN. |
Source code in src/quivers/_splines.py
AdditiveLogRatioNormal
¶
Bases: Distribution
A Gaussian law for log ratios against a selected simplex component.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Gaussian location with trailing width
TYPE:
|
scale_tril
|
Lower-triangular Gaussian scale with trailing shape
TYPE:
|
reference
|
Reference component, broadcast over Gaussian batch dimensions. None selects the final component. Free coordinates retain the relative order of every other component.
TYPE:
|
validate_args
|
Torch distribution validation policy.
TYPE:
|
Notes
A draw has D + 1 components. The nonreference components retain their
original order; their log ratios against the reference have the joint
Gaussian law. The final component is the default reference. Analytic
response means and variances are unavailable.
Source code in src/quivers/continuous/_additive_log_ratio.py
expand
¶
Broadcast the batch dimensions while retaining the coordinate event.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
New broadcast-compatible batch shape.
TYPE:
|
_instance
|
Optional instance populated by Torch's expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AdditiveLogRatioNormal
|
Distribution with the requested batch shape. |
Source code in src/quivers/continuous/_additive_log_ratio.py
rsample
¶
rsample(sample_shape=Size())
Draw simplex values by reparameterizing the Gaussian log ratios.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Independent sample dimensions preceding the batch dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Strictly positive simplex draws. |
| RAISES | DESCRIPTION |
|---|---|
FloatingPointError
|
If floating point underflow cannot represent an interior draw. |
Source code in src/quivers/continuous/_additive_log_ratio.py
log_prob
¶
Score an interior simplex event, including the ALR Jacobian.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate simplex events with the trailing component axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Gaussian log density minus the sum of log components; negative infinity outside the simplex interior. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the event has the wrong number of components. |
Source code in src/quivers/continuous/_additive_log_ratio.py
MultivariateStudentT
¶
MultivariateStudentT(df: Tensor | float, loc: Tensor, covariance_matrix: Tensor | None = None, precision_matrix: Tensor | None = None, scale_tril: Tensor | None = None, validate_args: bool | None = None)
Bases: Distribution
A multivariate Student law with one shared radial scale per vector.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Positive degrees of freedom, broadcast over Gaussian batch axes.
TYPE:
|
loc
|
Location with trailing event dimension
TYPE:
|
covariance_matrix
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
precision_matrix
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
scale_tril
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
validate_args
|
Torch argument and observation validation policy.
TYPE:
|
Notes
A single chi-squared variate scales every coordinate in each vector. Independent univariate Student distributions have a different joint law. The location is the response mean only for degrees of freedom above one.
Source code in src/quivers/continuous/_multivariate_student_t.py
arg_constraints
property
¶
arg_constraints: dict[str, Constraint]
Read the checked heads without materializing covariance properties.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Constraint]
|
Actual stored Gaussian factor and Student head constraints. |
covariance_matrix
property
¶
covariance_matrix: Tensor
Return the Gaussian scale matrix, following Torch parameter names.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Scale matrices with trailing shape |
precision_matrix
property
¶
precision_matrix: Tensor
Return the inverse Gaussian scale matrix.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Inverse scale matrices with trailing shape |
mean
property
¶
mean: Tensor
Return the finite response mean where it exists.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Location for |
variance
property
¶
variance: Tensor
Return marginal variances with Student moment existence boundaries.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Finite variances above two degrees of freedom, infinity between one and two, and NaN at or below one. |
log_prob
¶
Evaluate the marginal vector density without auxiliary latent sites.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Observations ending in the declared vector event axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
One log density per sample and batch coordinate. |
Source code in src/quivers/continuous/_multivariate_student_t.py
rsample
¶
Draw pathwise using one radial chi-squared scale per vector.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Draws with sample, batch, and final vector event dimensions. |
Source code in src/quivers/continuous/_multivariate_student_t.py
expand
¶
expand(batch_shape: Sequence[int], _instance=None) -> MultivariateStudentT
Expand only batch axes while retaining the shared factor.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Broadcast-compatible new batch dimensions.
TYPE:
|
_instance
|
Optional uninitialized expansion instance, following Torch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MultivariateStudentT
|
Expanded distribution without another matrix factorization. |
Source code in src/quivers/continuous/_multivariate_student_t.py
Multinomial
¶
Bases: Distribution
Multinomial events with a separate trial count on each batch row.
| PARAMETER | DESCRIPTION |
|---|---|
total_count
|
Nonnegative integer trials, exactly representable through 2**53.
TYPE:
|
probs
|
Finite nonnegative category weights with a positive row total.
TYPE:
|
logits
|
Alternative category log weights; provide exactly one representation.
TYPE:
|
validate_args
|
Whether to validate observation support through torch.
TYPE:
|
Source code in src/quivers/continuous/_multinomial.py
mean
property
¶
Expected category counts.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 counts on the batch and category axes. |
variance
property
¶
Marginal category variances.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 variances on batch and category axes. |
probs
¶
Normalized category probabilities, retaining the original zero-trial input.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Probabilities on batch and category axes. |
Source code in src/quivers/continuous/_multinomial.py
logits
¶
Normalized category log weights with exact structural zeros.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log probabilities on batch and category axes. |
expand
¶
Expand parameter views while preserving category event axes.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Optional torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Multinomial
|
Expanded distribution with unchanged category count. |
Source code in src/quivers/continuous/_multinomial.py
log_prob
¶
Score whole count vectors by stable conditional binomial masses.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Count events with the declared trailing category axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
One Float64 log mass per sample and batch event. |
Source code in src/quivers/continuous/_multinomial.py
sample
¶
Draw Int64 events in O(categories times rows) work.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 events with exactly the requested trial totals. |
Source code in src/quivers/continuous/_multinomial.py
DirichletMultinomial
¶
Bases: Distribution
Multinomial events with Dirichlet-distributed category probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
total_count
|
Nonnegative integer trials through 2**53 on the batch axes.
TYPE:
|
concentration
|
Finite strictly positive category concentrations.
TYPE:
|
validate_args
|
Whether torch validates normalized parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_multinomial.py
mean
property
¶
Expected category counts.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 counts including exact zero-trial rows. |
variance
property
¶
Marginal category variances, including Dirichlet overdispersion.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 marginal variances. |
expand
¶
Expand trials and concentration views without merging event axes.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Optional torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DirichletMultinomial
|
Expanded count-vector distribution. |
Source code in src/quivers/continuous/_multinomial.py
log_prob
¶
Score the event using its exact conditional beta-binomial factorization.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Count vectors on the trailing category axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 log masses on the sample and batch axes. |
Source code in src/quivers/continuous/_multinomial.py
sample
¶
Draw Dirichlet weights and use the shared heterogeneous-trial sampler.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 count events with exact trial totals. |
Source code in src/quivers/continuous/_multinomial.py
DiscreteWeibull
¶
DiscreteWeibull(probs, concentration, validate_args=None, *, moment_rtol=1e-10, moment_max_terms=262144)
Bases: Distribution
Counts with survival P(Y >= k) = probs**(k**concentration).
| PARAMETER | DESCRIPTION |
|---|---|
probs
|
Survival parameter in [0, 1), with zero giving the point mass at zero.
TYPE:
|
concentration
|
Strictly positive power parameter.
TYPE:
|
validate_args
|
Whether to validate distribution parameters.
TYPE:
|
moment_rtol
|
Relative tolerance certified by omitted-moment integral bounds.
TYPE:
|
moment_max_terms
|
Maximum number of count cells used for a moment calculation.
TYPE:
|
Notes
Density and inverse-transform sampling require constant work per row. Moments use adaptive blocks and analytic upper bounds on the omitted tails. Failure to certify the requested tolerance raises explicitly. Native count arithmetic uses Float64 and integer samples use Int64.
Source code in src/quivers/continuous/_discrete_weibull.py
mean
property
¶
Compute the mean with an analytic omitted-tail error bound.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response means within the configured relative tolerance. |
variance
property
¶
Compute variance without subtracting two large raw moments.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 variances within the configured relative tolerance. |
expand
¶
Expand the parameter views and retain the moment resource policy.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Target batch dimensions.
TYPE:
|
_instance
|
Optional reusable instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DiscreteWeibull
|
Expanded distribution. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_prob
¶
Evaluate a count mass in Float64.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate integer counts.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log mass, negative infinity outside the support. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_interval_mass
¶
Evaluate an integer interval without subtracting rounded tail values.
| PARAMETER | DESCRIPTION |
|---|---|
low
|
Real endpoints; None leaves a side unbounded.
TYPE:
|
high
|
Real endpoints; None leaves a side unbounded.
TYPE:
|
lower_closed
|
Endpoint membership, optionally varying across batch rows.
TYPE:
|
upper_closed
|
Endpoint membership, optionally varying across batch rows.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exact factored log probabilities on the distribution batch. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an endpoint is NaN. |
TypeError
|
If endpoint membership is not Boolean. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_cdf
¶
log_survival_function
¶
cdf
¶
icdf
¶
Invert the staircase cumulative distribution.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 count quantiles, positive infinity at probability one except for the degenerate-zero law. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a finite requested quantile exceeds exact Float64 count capacity. |
Source code in src/quivers/continuous/_discrete_weibull.py
sample
¶
sample(sample_shape=Size())
Draw integer counts by a vectorized exponential transform.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the parameter batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 counts on the parameters' device. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a generated count exceeds exact Float64 integer capacity. |
Source code in src/quivers/continuous/_discrete_weibull.py
Wiener
¶
Wiener(boundary: Tensor | float, ndt: Tensor | float, bias: Tensor | float, drift: Tensor | float, validate_args: bool | None = False, *, max_proposals: int = 10000, max_terms: int = 64, max_precision: int = 192)
Bases: Distribution
Joint signed response-time law for two absorbing diffusion boundaries.
| PARAMETER | DESCRIPTION |
|---|---|
boundary
|
Positive boundary separation, with Brownian variance fixed to one.
TYPE:
|
ndt
|
Nonnegative delay added to decision time.
TYPE:
|
bias
|
Starting position as a fraction of separation, strictly between zero and one.
TYPE:
|
drift
|
Finite drift towards the upper boundary.
TYPE:
|
validate_args
|
Whether off-support observations raise rather than score as -infinity. Parameter validation is always performed.
TYPE:
|
max_proposals
|
Finite rejection, series, and decimal precision budgets. Exhaustion raises; the sampler never substitutes an approximate draw.
TYPE:
|
max_terms
|
Finite rejection, series, and decimal precision budgets. Exhaustion raises; the sampler never substitutes an approximate draw.
TYPE:
|
max_precision
|
Finite rejection, series, and decimal precision budgets. Exhaustion raises; the sampler never substitutes an approximate draw.
TYPE:
|
Notes
Positive observations encode upper hits and negative observations lower hits. The likelihood is joint in time and decision, without conditioning on the chosen boundary. Scores and samples use Float64; input gradients propagate to the original parameter dtype. Sampling is not reparameterized. Its exact-arithmetic construction has acceptance probability at least 1/2; numerical acceptance decisions use outward-rounded series enclosures.
Source code in src/quivers/continuous/_wiener.py
arg_constraints
property
¶
arg_constraints: dict[str, Constraint]
Return the domains of diffusion parameters.
| RETURNS | DESCRIPTION |
|---|---|
dict of str to Constraint
|
Positive separation, nonnegative delay, open-unit bias, real drift. |
support
property
¶
Return the signed reaction-time constraint.
| RETURNS | DESCRIPTION |
|---|---|
_SignedSupport
|
Absolute reaction time strictly above nondecision delay. |
choice_probs
property
¶
choice_probs: Tensor
Return lower/upper boundary probabilities along a final length-two axis.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Choice probabilities with axes batch x (lower, upper). |
mean
property
¶
mean: Tensor
Return the mean signed reaction time.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Positive upper-choice and negative lower-choice joint mean. |
variance
property
¶
variance: Tensor
Return signed reaction-time variance using a stable mixture formula.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Variance of signed joint reaction times. |
mean_response_time
property
¶
mean_response_time: Tensor
Return mean absolute reaction time, including nondecision delay.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Expected unsigned response time. |
variance_response_time
property
¶
variance_response_time: Tensor
Return unsigned reaction-time variance.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Variance of the magnitude of signed joint samples. |
log_prob
¶
Score a signed time without losing the probability of its decision.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Signed reaction time, broadcastable with parameter batch axes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 joint log density, negative infinity outside support when observation validation is disabled. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If observations are boolean or complex, or normalized times exceed floating-point arithmetic capacity. |
Source code in src/quivers/continuous/_wiener.py
sample
¶
Draw signed reaction times using certified first-passage rejection.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading independent sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 signed times, with sample and parameter-batch dimensions. |
Source code in src/quivers/continuous/_wiener.py
expand
¶
Expand diffusion parameter views without copying data.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
New batch dimensions.
TYPE:
|
_instance
|
Optional preallocated distribution instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Wiener
|
Distribution with broadcast parameter views and unchanged budgets. |
Source code in src/quivers/continuous/_wiener.py
ZeroInflatedAsymmetricLaplace
¶
Bases: Distribution
Structural zeros and a continuous asymmetric Laplace response.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Probability of the atom at zero, including zero and one.
TYPE:
|
loc
|
Quantile location of the continuous component.
TYPE:
|
scale
|
Positive component scale in the check-loss parameterization.
TYPE:
|
quantile
|
Component quantile strictly between zero and one.
TYPE:
|
validate_args
|
Whether to validate distribution parameters.
TYPE:
|
Notes
Density is relative to the sum of a zero atom and Lebesgue measure: the continuous density does not contribute to the mass at zero. Sampling selects the mixture branch before sampling its component.
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
mean
property
¶
Expected mixed response.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Component mean multiplied by its mixture probability. |
variance
property
¶
Variance including uncertainty about the mixture branch.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Component variance and between-component mean contribution. |
expand
¶
Expand parameter views over a new batch.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Target broadcast batch dimensions.
TYPE:
|
_instance
|
Optional reusable distribution instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ZeroInflatedAsymmetricLaplace
|
Distribution with expanded parameter views. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_prob
¶
Evaluate the zero atom or continuous component density.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real responses, broadcastable with the parameter batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log atom mass at zero and log Lebesgue density elsewhere. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_cdf
¶
Evaluate log probability at or below a response.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probabilities, including the atom at zero. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_survival_function
¶
Evaluate log probability strictly above a response.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log survival probabilities, excluding the atom at zero. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
cdf
¶
Evaluate cumulative probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Cumulative probabilities. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
icdf
¶
Invert the continuous tails and the jump at zero.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Generalized quantiles, with zero throughout the atom's jump. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
sample
¶
sample(sample_shape=Size())
Select branches before sampling active continuous responses.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the parameter batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Floating responses, including exact structural zeros. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
ShiftedLogNormal
¶
Bases: Distribution
A lognormal response plus a nonnegative location shift.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Mean of the underlying normal log response.
TYPE:
|
scale
|
Positive standard deviation of the underlying normal.
TYPE:
|
shift
|
Nonnegative lower support endpoint.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
support
¶
Return the parameter-dependent response support.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
Frechet
¶
Bases: Distribution
Frechet distribution on positive responses.
| PARAMETER | DESCRIPTION |
|---|---|
scale
|
Positive response scale.
TYPE:
|
concentration
|
Positive tail shape. The first moment exists above one and the second moment above two.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
GeneralizedExtremeValue
¶
Bases: Distribution
Generalized extreme-value law with a differentiable Gumbel limit.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Response location, distinct from the expectation.
TYPE:
|
scale
|
Positive scale.
TYPE:
|
concentration
|
Real extreme-value shape; zero gives Gumbel. SciPy's genextreme uses the opposite sign for its shape parameter.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
support
¶
Return the parameter-dependent response support.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
SkewNormal
¶
Bases: Distribution
Skew-normal law in Azzalini location, scale, and skewness parameters.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Location of the underlying skewed normal, distinct from its mean.
TYPE:
|
scale
|
Positive scale, distinct from its standard deviation.
TYPE:
|
skewness
|
Real Azzalini shape parameter, conventionally alpha.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_skew_normal.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
ZeroInflatedNegativeBinomial
¶
Bases: _InflatedCount
Structural zeros plus NB successes before total_count failures.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative negative-binomial shape.
TYPE:
|
probs
|
Success probability in [0, 1), with count mean r*p/(1-p).
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
ZeroInflatedBinomial
¶
Bases: _InflatedCount
Structural zeros plus a binomial, including zero trials.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative integer trial counts.
TYPE:
|
probs
|
Binomial success probability in [0, 1].
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
support
¶
Counts between zero and the trial count.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
The parameter-dependent integer support. |
Source code in src/quivers/continuous/_zero_inflated_count.py
ZeroInflatedBetaBinomial
¶
ZeroInflatedBetaBinomial(zero_prob, total_count, concentration1, concentration0, validate_args=None)
Bases: ZeroInflatedBinomial
Structural zeros plus a beta-binomial with integrated success probability.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative integer trial counts.
TYPE:
|
concentration1
|
Positive beta success concentration.
TYPE:
|
concentration0
|
Positive beta failure concentration.
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
HurdleNegativeBinomial
¶
Bases: ZeroInflatedNegativeBinomial
Zero atom plus a normalized strictly positive negative binomial.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Hurdle probability in [0, 1].
TYPE:
|
total_count
|
Strictly positive negative-binomial shape.
TYPE:
|
probs
|
Success probability in [0, 1). At zero the positive component is its point-mass-at-one limit.
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
mean
property
¶
mean: Tensor
Expected hurdle count.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Positive conditional mean times the nonzero probability. |
variance
property
¶
variance: Tensor
Variance of the full hurdle response.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Second moment minus the squared full mean. |
log_prob
¶
Score the atom or normalized positive component without p=0 divisions.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Nonnegative integer counts.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exact log probabilities including the p=0 limit. |
Source code in src/quivers/continuous/_zero_inflated_count.py
sample
¶
Draw structural zeros and efficiently conditioned positive NB counts.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the batch shape. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Nonnegative integer draws without reparameterized gradients. |
Source code in src/quivers/continuous/_zero_inflated_count.py
ConditionalBernsteinHazard
¶
ConditionalBernsteinHazard(domain, codomain, *, breaks=None, controls=None, hidden_dim=None, param_source=None, param_source_option=None)
Bases: _IndependentConditional
Learn a proportional log rate over an explicitly fixed baseline.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Predictor space for the log hazard multiplier.
TYPE:
|
codomain
|
Scalar event-time coordinates, independently repeated when dim > 1.
TYPE:
|
breaks
|
Explicit retained baseline boundaries; required.
TYPE:
|
controls
|
Explicit normalized positive baseline coefficients; required.
TYPE:
|
hidden_dim
|
Parameter-source network widths.
TYPE:
|
param_source
|
Reusable source of one log rate per output coordinate.
TYPE:
|
param_source_option
|
Parameter-source strategy.
TYPE:
|
Notes
The checked baseline is copied into fixed buffers. Knots and controls are never invented by unconstrained neural heads. Source programs can instead pass explicitly computed, differentiable controls to BernsteinHazard.
Source code in src/quivers/continuous/families.py
support
property
¶
Return nonnegative event-time support.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
Nonnegative real support. |
ConditionalNormal
¶
ConditionalNormal(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source=None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional normal (Gaussian) distribution.
For each input x, produces an independent normal distribution on each dimension of the codomain:
y_i ~ Normal(mu_i(x), sigma_i(x))
Parameters are learnable: mu and log(sigma) are functions of x, implemented as lookup tables (discrete domain) or neural networks (continuous domain).
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Examples:
>>> from quivers import FinSet
>>> from quivers.continuous.spaces import Euclidean
>>> A = FinSet(name="context", cardinality=5)
>>> Y = Euclidean(name="response", dim=3)
>>> f = ConditionalNormal(A, Y)
>>> x = torch.tensor([0, 1, 2])
>>> samples = f.rsample(x) # shape (3, 3)
Source code in src/quivers/continuous/families.py
base_dimension
¶
base_dimension(x: Tensor) -> int
One standard-normal coordinate per independent output axis.
push_base
¶
The location-scale map mu(x) + sigma(x) * base.
The same map rsample applies, with the caller's coordinates
in place of a fresh draw.
Source code in src/quivers/continuous/families.py
ConditionalLogitNormal
¶
ConditionalLogitNormal(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional logit-normal distribution on (0, 1)^d.
If z ~ Normal(mu(x), sigma(x)), then y = sigmoid(z) ~ LogitNormal. Useful for modeling probabilities and bounded quantities.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (should have bounds [0, 1]).
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalBeta
¶
ConditionalBeta(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional beta distribution on (0, 1)^d.
For each input x, produces an independent Beta(alpha_i(x), beta_i(x)) on each dimension of the codomain.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (should have bounds [0, 1]).
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalTruncatedNormal
¶
ConditionalTruncatedNormal(domain: AnySpace, codomain: Euclidean, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional truncated normal on [low, high]^d.
A normal distribution restricted to a bounded interval. Uses rejection-free sampling via the inverse CDF (Phi-based) method.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (must be bounded).
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalDirichlet
¶
ConditionalDirichlet(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Dirichlet distribution on a probability simplex.
For each input x, produces a Dirichlet(alpha(x)) distribution on the simplex.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target simplex.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalMultinomial
¶
ConditionalMultinomial(domain, codomain, total_count, hidden_dim=None, param_source=None, param_source_option=None)
Bases: _ConditionalCountVector
Fixed-trial Multinomial with category logits learned from the input.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Input space and vector-valued output space.
TYPE:
|
codomain
|
Input space and vector-valued output space.
TYPE:
|
total_count
|
Nonnegative exact trials broadcastable with input batch dimensions.
TYPE:
|
hidden_dim
|
Parameter-network hidden dimensions.
TYPE:
|
param_source
|
Optional reusable category parameter source.
TYPE:
|
param_source_option
|
Parameter-source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalDirichletMultinomial
¶
ConditionalDirichletMultinomial(domain, codomain, total_count, hidden_dim=None, param_source=None, param_source_option=None)
Bases: _ConditionalCountVector
Fixed-trial Dirichlet-multinomial with learned positive concentrations.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Input space and vector-valued output space.
TYPE:
|
codomain
|
Input space and vector-valued output space.
TYPE:
|
total_count
|
Nonnegative exact trials broadcastable with input batch dimensions.
TYPE:
|
hidden_dim
|
Parameter-network hidden dimensions.
TYPE:
|
param_source
|
Optional reusable category parameter source.
TYPE:
|
param_source_option
|
Parameter-source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalZeroInflatedBinomial
¶
ConditionalZeroInflatedBinomial(domain, codomain, total_count, hidden_dim=None, param_source=None, param_source_option=None)
Bases: _ConditionalInflatedTrialCount
Zero-inflated binomial heads with fixed nonnegative trial counts.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Parameter-source domain.
TYPE:
|
codomain
|
Independent count coordinates.
TYPE:
|
total_count
|
Fixed nonnegative number of trials.
TYPE:
|
hidden_dim
|
Parameter-source network dimensions.
TYPE:
|
param_source
|
Optional reusable parameter source.
TYPE:
|
param_source_option
|
Optional source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalZeroInflatedBetaBinomial
¶
ConditionalZeroInflatedBetaBinomial(domain, codomain, total_count, hidden_dim=None, param_source=None, param_source_option=None)
Bases: _ConditionalInflatedTrialCount
Zero-inflated beta-binomial heads with fixed nonnegative trials.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Parameter-source domain.
TYPE:
|
codomain
|
Independent count coordinates.
TYPE:
|
total_count
|
Fixed nonnegative number of trials.
TYPE:
|
hidden_dim
|
Parameter-source network dimensions.
TYPE:
|
param_source
|
Optional reusable parameter source.
TYPE:
|
param_source_option
|
Optional source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalUniform
¶
ConditionalUniform(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional uniform distribution on a learnable interval.
Parameterized as Uniform(loc - width/2, loc + width/2) where loc is unconstrained and width is positive. This ensures low < high is always satisfied.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalMultivariateNormal
¶
ConditionalMultivariateNormal(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional multivariate normal with full covariance.
Parameterized via Cholesky factor: the parameter source outputs loc (d values) and the lower-triangular entries of L (d*(d+1)/2 values), where Sigma = L @ L^T.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (d-dimensional).
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalMultivariateStudentT
¶
ConditionalMultivariateStudentT(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ConditionalMultivariateNormal
Learn a Student radial scale alongside the existing Gaussian heads.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Input carrier and real-vector response space.
TYPE:
|
codomain
|
Input carrier and real-vector response space.
TYPE:
|
hidden_dim
|
Parameter-network hidden dimensions.
TYPE:
|
param_source
|
Reusable source emitting location, packed Cholesky, and one df head.
TYPE:
|
param_source_option
|
Existing parameter-source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalAdditiveLogRatioNormal
¶
ConditionalAdditiveLogRatioNormal(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ConditionalMultivariateNormal
Learn correlated Gaussian log ratios against the final component.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Simplex space with at least two components.
TYPE:
|
hidden_dim
|
Parameter-network hidden dimensions.
TYPE:
|
param_source
|
Reusable Gaussian coordinate parameter source.
TYPE:
|
param_source_option
|
Parameter-source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalLowRankMVN
¶
ConditionalLowRankMVN(domain: AnySpace, codomain: ContinuousSpace, rank: int = 2, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional low-rank multivariate normal.
Parameterized as loc + low-rank factor + diagonal: Sigma = W @ W^T + diag(d)
This is more parameter-efficient than full MVN for high dimensions.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (d-dimensional).
TYPE:
|
rank
|
Rank of the low-rank factor W.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalRelaxedBernoulli
¶
ConditionalRelaxedBernoulli(domain: AnySpace, codomain: ContinuousSpace, temperature: float = 0.5, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional relaxed Bernoulli (concrete) distribution.
Outputs continuous values in (0, 1) that approximate Bernoulli samples. The temperature controls the relaxation: lower temperature = closer to discrete.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (should be 1-d per Bernoulli component).
TYPE:
|
temperature
|
Relaxation temperature.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalRelaxedOneHotCategorical
¶
ConditionalRelaxedOneHotCategorical(domain: AnySpace, codomain: ContinuousSpace, temperature: float = 0.5, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional relaxed one-hot categorical (Gumbel-Softmax).
Outputs continuous vectors on the simplex that approximate one-hot categorical samples.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space (simplex or d-dimensional).
TYPE:
|
temperature
|
Relaxation temperature.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalWishart
¶
ConditionalWishart(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Wishart distribution over positive-definite matrices.
Produces random d x d positive-definite matrices. Parameterized by degrees of freedom df(x) and a scale matrix V(x).
The codomain dimension is interpreted as d, and outputs are d x d matrices flattened to d^2.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space. dim is the matrix size d (output is d x d).
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalMatrixNormal
¶
ConditionalMatrixNormal(domain: AnySpace, codomain: ContinuousSpace, rows: int, cols: int, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Matrix-Normal :math:\mathcal{MN}(M, U, V).
The matrix-Normal distribution on :math:\mathbb{R}^{n \times p}
factorises with a Kronecker-product covariance: if
:math:X \sim \mathcal{MN}(M, U, V) then
:math:\mathrm{vec}(X) \sim \mathcal{N}(\mathrm{vec}(M), V \otimes U)
with :math:U \in \mathbb{R}^{n \times n} the row covariance
and :math:V \in \mathbb{R}^{p \times p} the column covariance.
Categorically, the Kronecker structure is the tensor product
of two Gaussians; it is strictly more constrained than the
flat :math:np-dim MVN that the same parameter tensor could
carry, so the surface keeps the two families distinct (no
auto-substitution). Use this when the prior should express
independent row and column correlation structure.
The codomain's product factorisation supplies the row and
column dimensions. The grammar surface
~ MatrixNormal(loc, row_scale, col_scale) over (dom, cod)
binds the first axis listed in over to the row covariance
and the second to the column covariance.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space whose factorisation supplies
TYPE:
|
rows
|
Row dimension :math:
TYPE:
|
cols
|
Column dimension :math:
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter network.
TYPE:
|
Source code in src/quivers/continuous/families.py
log_prob
¶
The log density of a matrix at an input.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input.
TYPE:
|
y
|
The matrix,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The log densities. |
Source code in src/quivers/continuous/families.py
rsample
¶
Draw a matrix at an input.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input.
TYPE:
|
sample_shape
|
Leading sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The draws, |
Source code in src/quivers/continuous/families.py
ConditionalInverseWishart
¶
ConditionalInverseWishart(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Inverse-Wishart over positive-definite matrices.
Conjugate prior for the covariance of a multivariate normal.
Realised as a deterministic inversion of a Wishart sample so
autograd flows; equivalent in distribution to drawing
:math:\Sigma^{-1} \sim \mathcal{W}(\nu, V^{-1}) and
inverting. See Gelman et al. (2013) §3.6 for the conjugacy
statement.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space whose
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter network.
TYPE:
|
Source code in src/quivers/continuous/families.py
log_prob
¶
The log density of a matrix at an input.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input.
TYPE:
|
y
|
The matrix,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The log densities. |
Source code in src/quivers/continuous/families.py
rsample
¶
Draw a matrix at an input.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input.
TYPE:
|
sample_shape
|
Leading sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The draws, flattened row-major to |
Source code in src/quivers/continuous/families.py
ConditionalBernoulli
¶
ConditionalBernoulli(domain: AnySpace, codomain: AnySpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Bernoulli: continuous probability -> discrete truth value.
Takes a continuous input x and produces learnable logits that parameterize a Bernoulli distribution. The output is a discrete sample in {0, 1}, returned as a LongTensor.
This is the key bridge used in PDS (Grove & White) for the
Bern x pattern, where a LogitNormal draw x in (0,1)
parameterizes a Bernoulli over truth values.
The codomain must be a FinSet of size 2 (representing {False, True} or {0, 1}).
Note
Sampling from Bernoulli is NOT reparameterizable. Gradients do not flow through the discrete samples. Use score function estimators (REINFORCE) or the Gumbel-Softmax trick if differentiable samples are needed.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space (typically UnitInterval or a FinSet).
TYPE:
|
codomain
|
Target FinSet of size 2.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
log_prob
¶
Log-probability of discrete output y given input x.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Input tensor.
TYPE:
|
y
|
Discrete output in {0, 1}. Shape (batch,).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log-probabilities. Shape (batch,). |
Source code in src/quivers/continuous/families.py
rsample
¶
Sample from Bernoulli (not reparameterizable).
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Input tensor.
TYPE:
|
sample_shape
|
Additional leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Discrete samples in {0, 1}. Shape (*sample_shape, batch). |
Source code in src/quivers/continuous/families.py
ConditionalCategorical
¶
ConditionalCategorical(domain: AnySpace, codomain: AnySpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Categorical: continuous input -> discrete category.
Generalizes ConditionalBernoulli to k > 2 categories. Takes a continuous input and produces learnable logits over k categories. The output is a discrete sample in {0, ..., k-1}.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target FinSet of size k.
TYPE:
|
hidden_dim
|
Hidden layer width for neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
log_prob
¶
Log-probability of discrete output y given input x.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Input tensor.
TYPE:
|
y
|
Discrete output in {0, ..., k-1}. Shape (batch,).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log-probabilities. Shape (batch,). |
Source code in src/quivers/continuous/families.py
rsample
¶
Sample from Categorical (not reparameterizable).
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Input tensor.
TYPE:
|
sample_shape
|
Additional leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Discrete samples in {0, ..., k-1}. Shape (*sample_shape, batch). |
Source code in src/quivers/continuous/families.py
ConditionalBinomial
¶
ConditionalBinomial(domain: AnySpace, codomain: ContinuousSpace, total_count: int = 1, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional Binomial(total_count, probs(x)).
The total_count (number of trials) is a fixed
hyperparameter set at construction time, typical for binomial
likelihoods where n is known per observation. Only the
probs parameter is learnable.
Outputs integer counts in {0, 1, ..., total_count}.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
total_count
|
Number of Bernoulli trials per observation.
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalLogisticNormal
¶
ConditionalLogisticNormal(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional LogisticNormal on the simplex.
Pushes a Normal(loc(x), scale(x)) draw through the softmax
transform to produce a simplex-valued sample. Multivariate
analogue of ConditionalLogitNormal. Useful as an
alternative to ConditionalDirichlet when the
underlying simplex distribution should be Gaussian in
logit space rather than Beta-shaped.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space;
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalZeroInflatedPoisson
¶
ConditionalZeroInflatedPoisson(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional ZeroInflatedPoisson(zero_prob(x), rate(x)).
The parameter source produces 2 * codomain.dim numbers per
input row: the first half feeds a sigmoid to produce the
zero-inflation probability, the second half a softplus to
produce the Poisson rate. Outputs non-negative integer counts.
Source code in src/quivers/continuous/families.py
ConditionalHurdlePoisson
¶
ConditionalHurdlePoisson(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional HurdlePoisson(zero_prob(x), rate(x)).
Same parameter shape as ConditionalZeroInflatedPoisson but the
two-stage hurdle log-density: a Bernoulli for zero vs positive,
then a zero-truncated Poisson for the strictly-positive branch.
Source code in src/quivers/continuous/families.py
ConditionalZeroOneInflatedBeta
¶
ConditionalZeroOneInflatedBeta(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional ZeroOneInflatedBeta(mu(x), phi(x), zoi(x), coi(x)).
Parameter source emits 4 * dim numbers per row: logit-mu,
log-phi, logit-zoi, logit-coi. Used by the runtime family registry
for ~ ZeroOneInflatedBeta declarations; formula frontend
prefers the inline observe ... <- ZeroOneInflatedBeta(mu, phi, zoi, coi).
Source code in src/quivers/continuous/families.py
ConditionalMixtureNormal
¶
ConditionalMixtureNormal(domain: AnySpace, codomain: ContinuousSpace, num_components: int = 2, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional finite Gaussian mixture with input-driven weights, locations, and scales.
The parameter source produces 3 * K numbers per row, where
K is the number of mixture components (fixed at construction).
Weights pass through softmax, locations are emitted directly,
scales pass through softplus + epsilon.
The codomain is assumed scalar (1-d real); a higher-dimensional
extension would replace Normal with Independent(Normal(...), 1)
and triple the per-component parameter count.
Source code in src/quivers/continuous/families.py
ConditionalOneHotCategorical
¶
ConditionalOneHotCategorical(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional OneHotCategorical(probs(x)).
Generalises ConditionalCategorical to one-hot
encoded outputs (vector of zeros with a single one). Useful
as a discrete-output observation kernel where downstream
code wants a vector rather than an integer index.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space;
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalMixture
¶
ConditionalMixture(domain: AnySpace, codomain: ContinuousSpace, component_class: type, num_components: int = 4, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
K-component mixture of a conditional family.
Wraps a single conditional family class (one of the registered
ConditionalX types) and gives it K independent
parameterizations plus learnable mixture logits, producing
p(y | x) = sum_k pi_k(x) * f_k(y | x)
where each f_k is an instance of the component class and
pi is the softmax of K learnable logits.
Sampling is via ancestral simulation (Categorical pick + the
chosen component's rsample). log_prob evaluates the
log-sum-exp of the per-component log-densities. The Categorical
pick is non-reparameterizable; gradient flow through the
weights uses the score-function path (which higher-level
objectives like IWAE can route through).
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space; matches the component family's codomain.
TYPE:
|
component_class
|
A
TYPE:
|
num_components
|
Number of mixture components.
TYPE:
|
hidden_dim
|
Hidden width for both the mixture-logit MLP and each component's parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalIndependent
¶
ConditionalIndependent(base: ContinuousMorphism)
Bases: ContinuousMorphism
Reinterpret the trailing batch dimension of a base conditional family as an event dimension.
Equivalent to wrapping the base distribution in
torch.distributions.Independent with
reinterpreted_batch_ndims = 1. Used to make per-element
independence explicit when a downstream guide wants to score
a vector-valued observation as a single event.
| PARAMETER | DESCRIPTION |
|---|---|
base
|
The base conditional family. The wrapped distribution sums the base's per-element log-probabilities along the last axis to score a vector-valued observation.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalTransformed
¶
ConditionalTransformed(base: ContinuousMorphism, transforms: list)
Bases: ContinuousMorphism
A base conditional family composed with a chain of bijectors.
Equivalent to torch.distributions.TransformedDistribution
lifted to ContinuousMorphism. The transforms are applied in
forward order to rsample outputs; log_prob includes the
log-determinant Jacobian correction.
| PARAMETER | DESCRIPTION |
|---|---|
base
|
Base conditional family.
TYPE:
|
transforms
|
Bijectors applied in forward order. Each must implement
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalLKJCholesky
¶
ConditionalLKJCholesky(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional LKJCholesky(dim, concentration(x)).
Produces lower-triangular Cholesky factors of correlation
matrices on the LKJ distribution (Lewandowski-Kurowicka-Joe
2009, doi:10.1016/j.jmva.2009.04.008). The matrix dimension
is taken from codomain.dim; only the concentration parameter
is learnable. Draws use the onion method of that paper (section
3.2), the construction the QIEC reference machine also draws by,
so every off-diagonal correlation r in dimension d has
(r + 1) / 2 ~ Beta(eta - 1 + d / 2, eta - 1 + d / 2).
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space;
TYPE:
|
hidden_dim
|
Hidden layer width for the parameter source.
TYPE:
|
param_source
|
A prebuilt source of the concentration's raw value.
TYPE:
|
param_source_option
|
The named parameter-source kind to build.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If |
Source code in src/quivers/continuous/families.py
rsample
¶
Draw one Cholesky factor per input row, by the onion method.
The factors are differentiable in the concentration, and so in the parameter source, through implicitly reparameterized Beta draws.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input the concentration is computed from.
TYPE:
|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Factors of shape |
Source code in src/quivers/continuous/families.py
ConditionalGaussianProcess
¶
ConditionalGaussianProcess(domain: AnySpace, codomain: ContinuousSpace, kernel: str = 'rbf', length_scale: float = 1.0, amplitude: float = 1.0, jitter: float = 1e-06)
Bases: ContinuousMorphism
Gaussian process prior with mean zero and a chosen covariance kernel.
A Gaussian process
is a Markov kernel X^N -> G(R^N) whose value at a finite set
of input locations x_1, ..., x_N follows a multivariate
Normal with covariance matrix K(x_i, x_j). Unlike the
parametric families that derive their distribution parameters
from a neural network on the input, the GP's "parameters" are
the input locations themselves: the kernel function evaluated
on the inputs produces the covariance directly.
Reference: Rasmussen & Williams (2006), Gaussian Processes for Machine Learning.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space. Its
TYPE:
|
codomain
|
Target space. Its
TYPE:
|
kernel
|
Covariance kernel.
TYPE:
|
length_scale
|
Initial length scale of the kernel (positive; learnable). Ignored by the linear kernel.
TYPE:
|
amplitude
|
Initial amplitude (positive; learnable). Multiplies the
kernel by
TYPE:
|
jitter
|
Diagonal regulariser added to
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalHorseshoe
¶
ConditionalHorseshoe(domain: AnySpace, codomain: ContinuousSpace, scale: float = 1.0)
Bases: ContinuousMorphism
Carvalho-Polson-Scott horseshoe prior.
The horseshoe prior places a global-local shrinkage structure on each coordinate:
.. code-block:: text
tau = scale positive learnable global parameter lambda_d ~ HalfCauchy(1) for d = 1, ..., D beta_d | tau, lambda_d ~ Normal(0, tau * lambda_d)
The global scale is a module parameter; it is not a sampled hyperprior.
Formula RegularizedHorseshoe priors instead emit explicit global,
local, and slab latent sites. The marginal density of beta_d after integrating the local
scale lambda_d has no closed form; this implementation uses a
16-point Gauss-Legendre quadrature after mapping the half-line
lambda in (0, inf) to t in (0, 1) via the change of
variables lambda = tan(pi * t / 2), whose Jacobian is
(pi / 2) * sec^2(pi * t / 2).
Reference: Carvalho, Polson & Scott (2010), The horseshoe estimator for sparse signals.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space. The prior is conditionally independent of
TYPE:
|
codomain
|
Target space. Its
TYPE:
|
scale
|
Initial global shrinkage
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalLearnedOrderedLogistic
¶
ConditionalLearnedOrderedLogistic(domain: AnySpace, codomain: AnySpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional OrderedLogistic(predictor(x), cutpoints(x)), cutpoints learned.
This is the morphism a ~ OrderedLogistic declaration compiles to.
ConditionalOrderedLogistic
is the variant that takes its cutpoints explicitly.
The continuous input drives a parameter source that produces
1 + (K - 1) numbers: one real predictor and a K - 1 cutpoint
vector. The cutpoints are passed through a strictly-monotonic
transform (first entry free, subsequent entries via cumulative
softplus) so the cumulative-link contract c_0 < c_1 < ... <
c_{K-2} is satisfied unconditionally.
Outputs integer categories in {0, ..., K - 1} where K =
codomain.size.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
A finite set of at least two ordered categories.
TYPE:
|
hidden_dim
|
Hidden widths, read only by a source that has hidden layers.
TYPE:
|
param_source
|
Select the parameter source directly, or by the DSL's
TYPE:
|
param_source_option
|
Select the parameter source directly, or by the DSL's
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the codomain is not a finite set of at least two categories. |
Source code in src/quivers/continuous/families.py
ConditionalGeneralizedPareto
¶
ConditionalGeneralizedPareto(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional generalized Pareto distribution.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
hidden_dim
|
Hidden widths, read only by a source that has hidden layers.
TYPE:
|
param_source
|
Select the parameter source directly, or by the DSL's
TYPE:
|
param_source_option
|
Select the parameter source directly, or by the DSL's
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalBetaBinomial
¶
ConditionalBetaBinomial(domain: AnySpace, codomain: ContinuousSpace, total_count: int, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conjugate Beta-Binomial likelihood with learnable Beta parameters.
The number of successes y arises by drawing
p ~ Beta(concentration1(x), concentration0(x)) and then
y ~ Binomial(total_count, p). The Beta is integrated out
analytically, yielding the log-probability
.. math::
\log p(y \mid x) = \log \Gamma(\alpha + \beta)
+ \log \Gamma(\alpha + y) + \log \Gamma(\beta + n - y)
- \log \Gamma(\alpha) - \log \Gamma(\beta)
- \log \Gamma(\alpha + \beta + n)
+ \log \binom{n}{y}
where :math:\alpha = \mathrm{concentration1}(x),
:math:\beta = \mathrm{concentration0}(x), and :math:n is
total_count.
Sampling is not reparameterisable; rsample raises and
sample draws p from the Beta and y from the
resulting Binomial.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
total_count
|
Number of Bernoulli trials per observation; must be a nonnegative integer.
TYPE:
|
hidden_dim
|
Hidden layer width for the neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalLogistic
¶
ConditionalLogistic(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional logistic distribution on the real line.
Independent per codomain dim with learnable location and scale:
.. math::
\log p(y \mid x) = -z - 2 \log(1 + e^{-z}) - \log \sigma
where :math:z = (y - \mu) / \sigma. Samples are
reparameterised via the inverse-CDF transform of a uniform draw,
:math:y = \mu + \sigma \log(u / (1 - u)).
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
hidden_dim
|
Hidden layer width for the neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
ConditionalHalfStudentT
¶
ConditionalHalfStudentT(domain: AnySpace, codomain: ContinuousSpace, df: float, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ContinuousMorphism
Conditional half-StudentT on the positive reals.
A StudentT with df fixed at construction time, learnable
scale, and location fixed at zero, restricted to nonnegative
values via reflection. The folded log-density at y >= 0 is
log 2 + log_prob_studentt(0, scale(x), df; y) and -inf
elsewhere.
Sampling reflects a base StudentT draw through the origin:
y = |z| with z ~ StudentT(df, 0, scale).
Reparameterisation flows through the absolute-value operation.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Source space.
TYPE:
|
codomain
|
Target space.
TYPE:
|
df
|
Degrees-of-freedom hyperparameter (positive). Held fixed
across observations; only
TYPE:
|
hidden_dim
|
Hidden layer width for the neural parameter source.
TYPE:
|
Source code in src/quivers/continuous/families.py
LKJCorrelationFactor
¶
LKJCorrelationFactor(dim: int, eta: float, domain: AnySpace)
Bases: ContinuousMorphism
LKJ prior on Cholesky factors LKJ(K, η) over CholeskyFactor(K).
Density on the Cholesky factor:
.. math::
p(L) \propto \prod_{k=2}^{K} L_{kk}^{K - k + 2(\eta - 1)}.
A higher concentration :math:\eta > 1 pulls toward the
identity correlation; :math:\eta = 1 is uniform on
correlations. Sampling uses the onion method of
Lewandowski-Kurowicka-Joe 2009 (section 3.2,
doi:10.1016/j.jmva.2009.04.008): row :math:k (zero-based) of
:math:L is :math:(\sqrt{y}\, u, \sqrt{1 - y}) for
:math:y \sim \mathrm{Beta}(k/2, \eta + (K - 1 - k)/2) and
:math:u uniform on the unit sphere in :math:\mathbb{R}^k. The
construction is shared with the QIEC reference machine, and the
draws are differentiable in :math:\eta.
| PARAMETER | DESCRIPTION |
|---|---|
dim
|
Correlation-matrix size :math:
TYPE:
|
eta
|
Concentration :math:
TYPE:
|
domain
|
The morphism's source (parameter conditioning); typically the program's input space. The LKJ prior itself does not consume per-observation conditioning, so the rsample path broadcasts the prior across the batch dimension.
TYPE:
|
Source code in src/quivers/continuous/families.py
rsample
¶
Draw one Cholesky factor per input row, by the onion method.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input; only its row count, device, and dtype are read.
TYPE:
|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Flat factors, shape |
Source code in src/quivers/continuous/families.py
log_prob
¶
Normalized log density of the LKJ prior at Cholesky factors.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input; it carries no parameters.
TYPE:
|
y
|
Factors, flat
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
One log density per factor. |
Source code in src/quivers/continuous/families.py
Truncated
¶
Truncated(base: ContinuousMorphism, lower: float | None = None, upper: float | None = None, max_rejection_iterations: int = 64)
Bases: ContinuousMorphism
Truncate a base family to an interval :math:[a, b].
Categorical denotation: given a base family
:math:F : \Theta \to \mathcal{G}(\mathbb{R}) and constants
:math:a, b \in \bar{\mathbb{R}} with :math:a < b, the
truncated family has density
.. math::
p_{F_{|[a,b]}}(x) = \frac{p_F(x)}{F_{\text{cdf}}(b)
- F_{\text{cdf}}(a)} \cdot \mathbb{1}_{[a,b]}(x)
and the morphism :math:F_{|[a,b]} : \Theta \to
\mathcal{G}([a,b]). Independent output coordinates are conditioned
separately; coupled events require a joint rectangle probability
and are rejected. Normalizing masses are deterministic and retain
parameter gradients supported by the base CDF. Normal sampling uses
a log-space inverse CDF; other bases use bounded rejection.
| PARAMETER | DESCRIPTION |
|---|---|
base
|
The base distribution-family morphism. Must expose
TYPE:
|
lower
|
Lower bound :math:
TYPE:
|
upper
|
Upper bound :math:
TYPE:
|
max_rejection_iterations
|
Cap on rejection-sampling attempts before raising.
TYPE:
|
Source code in src/quivers/continuous/families.py
rsample
¶
Condition each independent coordinate on the supplied interval.
Source code in src/quivers/continuous/families.py
cox_spline_basis
¶
cox_spline_basis(event_times: Sequence[float], observed_times: Sequence[float], *, df: int = 5, degree: int = 3) -> MSplineBasis
Choose event-quantile knots within the full observed-time boundary span.
| PARAMETER | DESCRIPTION |
|---|---|
event_times
|
Finite nonnegative times of exact, uncensored events.
TYPE:
|
observed_times
|
Finite nonnegative training follow-up times, including censored rows.
TYPE:
|
df
|
Requested number of normalized M-spline components, including the
intercept component. Must be at least
TYPE:
|
degree
|
Polynomial degree; three gives cubic M-splines.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MSplineBasis
|
Immutable knots, degree, zero lower boundary, and constant hazard tail. The upper boundary exceeds maximum follow-up by one fiftieth of its full span, or one fiftieth of the maximum when the span is zero. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If training evidence cannot determine the requested distinct interior event quantiles or a positive finite boundary. Supply an explicit MSplineBasis when automatic knot selection is underdetermined. |
Notes
This function belongs to training-data preparation. Prediction retains its returned basis and never selects knots from fresh covariates or responses. Censoring times can extend support but cannot move interior event quantiles.
Source code in src/quivers/_spline_design.py
Asymmetric Laplace quantiles¶
AsymmetricLaplace(loc, scale, quantile) models a selected response quantile;
ConditionalAsymmetricLaplace learns all three parameters from its input. The
native distribution provides differentiable sampling, density, CDF, inverse CDF,
mean, variance, and entropy. Its scale follows the check-loss convention used in
brms quantile regression:
at quantile 0.5, it equals Laplace(loc, 2 * scale).
_asymmetric_laplace
¶
Asymmetric Laplace distributions in the quantile regression parameterization.
AsymmetricLaplace
¶
AsymmetricLaplace(loc: Tensor | float, scale: Tensor | float, quantile: Tensor | float, validate_args: bool | None = None)
Bases: Distribution
Asymmetric Laplace distribution parameterized by a response quantile.
The density is q * (1-q) / scale * exp(-rho_q((y-loc)/scale)),
where rho_q(u) = u * (q - I[u < 0]). Thus P(Y < loc) = q;
loc is the modeled quantile, and generally differs from the mean.
At q=0.5, this is Laplace(loc, 2 * scale).
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Location of the specified quantile.
TYPE:
|
scale
|
Strictly positive scale in the check-loss parameterization.
TYPE:
|
quantile
|
Probability strictly between zero and one.
TYPE:
|
validate_args
|
Whether to validate distribution parameters and evaluation points.
TYPE:
|
Notes
Sampling uses the difference of independent exponential variables. It is reparameterized in all three parameters and requires no rejection loop, inverse-CDF endpoint clamp, or discrete branch draw.
Source code in src/quivers/continuous/_asymmetric_laplace.py
mean
property
¶
mean: Tensor
Expected response, which generally differs from the quantile location.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Response mean. |
mode
property
¶
mode: Tensor
Most probable continuous response.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Component quantile location. |
variance
property
¶
variance: Tensor
Response variance from the two exponential components.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Response variance. |
expand
¶
Expand parameter views over a new batch.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Target batch dimensions.
TYPE:
|
_instance
|
Optional reusable distribution instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AsymmetricLaplace
|
Expanded parameter views. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
log_prob
¶
Evaluate the check-loss density.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log Lebesgue density. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
log_cdf
¶
log_survival_function
¶
Evaluate strict survival probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real evaluation points.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log probability of a response strictly above each point. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
cdf
¶
icdf
¶
Invert cumulative probabilities with safe endpoint derivatives.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Continuous response quantiles. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If probabilities are outside the closed unit interval. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
entropy
¶
entropy() -> Tensor
Differential entropy of the component law.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Entropy in natural logarithmic units. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
rsample
¶
Draw reparameterized differences of independent exponentials.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the parameter batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Reparameterized response samples. |
Source code in src/quivers/continuous/_asymmetric_laplace.py
COM-Poisson counts¶
COMPoisson accepts exactly one of rate and log_rate, together with
positive dispersion. ConditionalCOMPoisson learns native rate and
dispersion. The family has mass proportional to
rate**k / factorial(k)**dispersion; zero rate is a point mass at zero.
Parameters, log scores, and moments use float64; samples use int64 and
provide no pathwise gradient.
Centered sums certify omitted mass and weighted moments with default
normalization_rtol=1e-12 and max_terms=262144 candidate cells.
Failure to certify within the budget raises NotImplementedError.
The exact log-concave rejection sampler has its own
max_proposals=10000 round budget and raises RuntimeError on proposal
or count-capacity failure. It does not sample a truncated normalization
table. Native and checked-reference execution are supported; all 11
external targets refuse this family. CDF and inverse-CDF operations,
thus censoring and interval truncation, remain unavailable.
_com_poisson
¶
Conway--Maxwell--Poisson counts with certified sums and exact rejection.
COMPoisson
¶
COMPoisson(rate=None, dispersion=1.0, *, log_rate=None, validate_args=None, normalization_rtol=1e-12, max_terms=262144, max_proposals=10000)
Bases: Distribution
Counts proportional to rate**k / (k!)**dispersion.
| PARAMETER | DESCRIPTION |
|---|---|
rate
|
Nonnegative rate. Supply exactly one of rate and log_rate.
TYPE:
|
dispersion
|
Strictly positive dispersion exponent.
TYPE:
|
log_rate
|
Logarithm of the rate, permitting rates beyond floating-point range.
TYPE:
|
validate_args
|
Whether to validate parameters and samples.
TYPE:
|
normalization_rtol
|
Certified relative tail tolerance for normalization and moments.
TYPE:
|
max_terms
|
Maximum centered count cells per row before an explicit refusal.
TYPE:
|
max_proposals
|
Maximum rejection rounds per requested sample.
TYPE:
|
Source code in src/quivers/continuous/_com_poisson.py
mean
property
¶
Return a certified response mean.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response means. |
variance
property
¶
Return a certified response variance.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response variances. |
expand
¶
Expand parameter views while retaining the numerical policy.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Unused torch expansion hook.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
COMPoisson
|
Expanded distribution. |
Source code in src/quivers/continuous/_com_poisson.py
log_prob
¶
Score counts with a certified centered normalizer.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate count values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 log masses, negative infinity off support. |
Source code in src/quivers/continuous/_com_poisson.py
sample
¶
sample(sample_shape=Size())
Sample from a log-concave envelope without truncating the law.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 count samples. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a proposal exceeds exact count capacity or the round budget. |
Source code in src/quivers/continuous/_com_poisson.py
Vector count events¶
Multinomial(total_count, probs=...) and
Multinomial(total_count, logits=...) choose exclusive parameterizations;
DirichletMultinomial(total_count, concentration) adds a positive concentration
vector. Their trailing category axis is one event, independent of batch axes.
A batch may have heterogeneous trial counts. Every event has nonnegative
integer coordinates summing to its trial count; zero trials give an all-zero
vector, including for a single category.
Trial counts are checked before floating conversion and lie in 0..2**53.
Parameters, scores, means, and variances use float64; discrete samples use
int64 without pathwise reparameterization. Dirichlet-multinomial concentration
sums must remain finite. ConditionalMultinomial learns category logits and
ConditionalDirichletMultinomial learns positive concentrations, with fixed
trials passed to each conditional constructor.
Native and checked-reference execution support both kernels. The source example keeps row dimensions separate from the category event axis. External rendering is a separate capability from these native interfaces.
_multinomial
¶
Vector counts with heterogeneous trials and stable conditional scores.
Multinomial
¶
Bases: Distribution
Multinomial events with a separate trial count on each batch row.
| PARAMETER | DESCRIPTION |
|---|---|
total_count
|
Nonnegative integer trials, exactly representable through 2**53.
TYPE:
|
probs
|
Finite nonnegative category weights with a positive row total.
TYPE:
|
logits
|
Alternative category log weights; provide exactly one representation.
TYPE:
|
validate_args
|
Whether to validate observation support through torch.
TYPE:
|
Source code in src/quivers/continuous/_multinomial.py
mean
property
¶
Expected category counts.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 counts on the batch and category axes. |
variance
property
¶
Marginal category variances.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 variances on batch and category axes. |
probs
¶
Normalized category probabilities, retaining the original zero-trial input.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Probabilities on batch and category axes. |
Source code in src/quivers/continuous/_multinomial.py
logits
¶
Normalized category log weights with exact structural zeros.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log probabilities on batch and category axes. |
expand
¶
Expand parameter views while preserving category event axes.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Optional torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Multinomial
|
Expanded distribution with unchanged category count. |
Source code in src/quivers/continuous/_multinomial.py
log_prob
¶
Score whole count vectors by stable conditional binomial masses.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Count events with the declared trailing category axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
One Float64 log mass per sample and batch event. |
Source code in src/quivers/continuous/_multinomial.py
sample
¶
Draw Int64 events in O(categories times rows) work.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 events with exactly the requested trial totals. |
Source code in src/quivers/continuous/_multinomial.py
DirichletMultinomial
¶
Bases: Distribution
Multinomial events with Dirichlet-distributed category probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
total_count
|
Nonnegative integer trials through 2**53 on the batch axes.
TYPE:
|
concentration
|
Finite strictly positive category concentrations.
TYPE:
|
validate_args
|
Whether torch validates normalized parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_multinomial.py
mean
property
¶
Expected category counts.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 counts including exact zero-trial rows. |
variance
property
¶
Marginal category variances, including Dirichlet overdispersion.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 marginal variances. |
expand
¶
Expand trials and concentration views without merging event axes.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch shape.
TYPE:
|
_instance
|
Optional torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DirichletMultinomial
|
Expanded count-vector distribution. |
Source code in src/quivers/continuous/_multinomial.py
log_prob
¶
Score the event using its exact conditional beta-binomial factorization.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Count vectors on the trailing category axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 log masses on the sample and batch axes. |
Source code in src/quivers/continuous/_multinomial.py
sample
¶
Draw Dirichlet weights and use the shared heterogeneous-trial sampler.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 count events with exact trial totals. |
Source code in src/quivers/continuous/_multinomial.py
Bernstein and spline baseline hazards¶
BernsteinHazard(breaks, controls, rate=...) defines a positive-time
proportional-hazards law. breaks has intrinsic shape [s + 1] and
controls has shape [s, k]; the event itself is scalar. The dependent
family signature checks this relation independently of observation batch
axes. Boundaries start at zero and increase strictly. Positive Bernstein
coefficients integrate to one over the retained interval, within numerical
simplex tolerance, fixing baseline scale separately from the rate.
After the final boundary, the endpoint hazard continues constantly and
positively. Survival thus tends to zero; the kernel retains all tail mass.
Pass exactly one of rate and log_rate. The latter avoids forming an
unnecessary exponential. The native implementation evaluates parameters and
scores in float64, preserving gradients to original learned tensors.
CoxPH(basis, weights, ...) contracts an immutable MSplineBasis with
positive simplex weights and delegates to this same kernel. It retains
knots, degree, and tail policy. cox_spline_basis places interior knots
using event times and sets the upper boundary from all follow-up times;
new observations reuse the resulting basis. Explicit knots are required
when the requested distinct event quantiles are unavailable.
ConditionalBernsteinHazard learns only the log rate over explicitly
given fixed baseline tables. It validates and copies those tables;
neural heads do not construct unconstrained knots or coefficients. Source
programs can pass differentiable controls explicitly instead.
Both kernels provide density, CDF, log tails, inverse CDF, and pathwise sampling. The inverse uses a bounded safeguarded solve within the interval and an analytic constant-hazard tail; numerical capacity or convergence failures raise explicitly. Analytic response moments are unavailable. Native and checked-reference execution support the typed source family; external family rendering remains an explicit capability check.
_bernstein_hazard
¶
Normalized positive Bernstein baseline hazards with an explicit tail.
BernsteinHazard
¶
Bases: Distribution
A normalized positive baseline hazard and a proportional rate.
| PARAMETER | DESCRIPTION |
|---|---|
breaks
|
Strictly increasing finite boundaries with trailing shape
TYPE:
|
controls
|
Positive Bernstein coefficients of trailing shape
TYPE:
|
rate
|
Positive hazard multiplier, exclusive with log_rate.
TYPE:
|
log_rate
|
Finite log hazard multiplier.
TYPE:
|
validate_args
|
Torch parameter-validation policy.
TYPE:
|
Notes
The final hazard value continues constantly beyond the upper boundary. This positive tail retains total probability one. Normalizing the finite baseline integral identifies its shape separately from the rate. The immutable finite_moment_orders certificate records the first two finite moments; an analytic formula for those moments is not provided.
Source code in src/quivers/continuous/_bernstein_hazard.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
rate
property
¶
Return the proportional multiplier when representable.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exponentiated log rate. Density and tail calculations retain log-rate arithmetic even when this view overflows. |
expand
¶
Expand parameter views without rebuilding the integrated table.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested leading batch dimensions.
TYPE:
|
_instance
|
Optional instance populated through the Torch expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BernsteinHazard
|
Distribution retaining the same baseline and integrated table. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_prob
¶
Evaluate the normalized time density on the nonnegative support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Normalized log density, negative infinity outside the support. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the time is NaN. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_survival_function
¶
Evaluate log survival directly from the integrated hazard.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log survival, evaluated directly from cumulative hazard. |
Source code in src/quivers/continuous/_bernstein_hazard.py
cdf
¶
Evaluate cumulative event probability, including exact support tails.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Cumulative event probability. |
Source code in src/quivers/continuous/_bernstein_hazard.py
log_cdf
¶
Evaluate log CDF without subtracting small survival probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Event time; negative and infinite values use the exact support limits.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probability, retaining small positive probabilities. |
Source code in src/quivers/continuous/_bernstein_hazard.py
icdf
¶
Invert the integrated hazard with a bounded, checked root solve.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probability in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Event quantile; the endpoints return zero and positive infinity. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If a probability is NaN or outside the unit interval. |
FloatingPointError
|
If the finite positive quantile is unrepresentable. |
RuntimeError
|
If the bounded root solver does not converge. |
Source code in src/quivers/continuous/_bernstein_hazard.py
rsample
¶
rsample(sample_shape=Size())
Draw vectorized event times by inverse cumulative hazard.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Independent sample dimensions preceding batch dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Pathwise event times from the full normalized law. |
Source code in src/quivers/continuous/_bernstein_hazard.py
_cox
¶
M/I-spline adapters for normalized Bernstein baseline hazards.
CoxPH
¶
Bases: BernsteinHazard
Proportional hazards with a retained normalized M-spline basis.
| PARAMETER | DESCRIPTION |
|---|---|
basis
|
Immutable fitted knots, degree, and constant endpoint tail.
TYPE:
|
weights
|
Strictly positive simplex weights over basis components.
TYPE:
|
rate
|
Positive proportional multiplier, exclusive with log_rate.
TYPE:
|
log_rate
|
Finite log multiplier.
TYPE:
|
validate_args
|
Torch parameter-validation policy.
TYPE:
|
Source code in src/quivers/continuous/_cox.py
expand
¶
Expand distribution views while retaining the original fitted basis.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested leading batch dimensions.
TYPE:
|
_instance
|
Optional instance populated by the Torch expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CoxPH
|
Expanded view retaining the fitted basis and weights. |
Source code in src/quivers/continuous/_cox.py
spline_values
¶
spline_values(basis: MSplineBasis, value: Tensor) -> tuple[Tensor, Tensor]
Lift the retained M/I-spline basis to differentiable tensor arguments.
| PARAMETER | DESCRIPTION |
|---|---|
basis
|
Retained normalized M/I-spline structure.
TYPE:
|
value
|
Evaluation times.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Tensor, Tensor]
|
M-spline hazards and integrated I-spline values, including the tail. |
Source code in src/quivers/continuous/_cox.py
MSplineBasis
dataclass
¶
MSplineBasis(boundary_knots: tuple[float, float] = (0.0, 1.0), interior_knots: tuple[float, ...] = (), degree: int = 3, tail: str = 'constant')
Normalized M-splines, integrated I-splines, and a constant hazard tail.
| PARAMETER | DESCRIPTION |
|---|---|
boundary_knots
|
Finite increasing endpoints of the fitted spline interval.
TYPE:
|
interior_knots
|
Strictly increasing knots inside the boundary interval.
TYPE:
|
degree
|
Nonnegative polynomial degree of the M-splines.
TYPE:
|
tail
|
Hazard continuation; currently
TYPE:
|
Notes
Every M-spline integrates to one over the fitted interval. Below its lower boundary both bases are zero. The retained knots and tail policy are part of value equality, so prediction cannot silently rebuild a training basis.
size
property
¶
Return the number of retained spline components.
| RETURNS | DESCRIPTION |
|---|---|
int
|
Number of retained normalized spline components. |
__post_init__
¶
Validate immutable knots and construct normalized basis tables.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If knots, degree, tail policy, or basis normalization are invalid. |
NotImplementedError
|
If the retained table exceeds the explicit coefficient budget. |
Source code in src/quivers/_splines.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
evaluate
¶
Evaluate the hazard basis and its integral, including the tail.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Evaluation time, including support endpoints and infinities.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[tuple[float, ...], tuple[float, ...]]
|
M-spline values and integrated I-spline values in component order. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the time is NaN. |
Source code in src/quivers/_splines.py
cox_spline_basis
¶
cox_spline_basis(event_times: Sequence[float], observed_times: Sequence[float], *, df: int = 5, degree: int = 3) -> MSplineBasis
Choose event-quantile knots within the full observed-time boundary span.
| PARAMETER | DESCRIPTION |
|---|---|
event_times
|
Finite nonnegative times of exact, uncensored events.
TYPE:
|
observed_times
|
Finite nonnegative training follow-up times, including censored rows.
TYPE:
|
df
|
Requested number of normalized M-spline components, including the
intercept component. Must be at least
TYPE:
|
degree
|
Polynomial degree; three gives cubic M-splines.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MSplineBasis
|
Immutable knots, degree, zero lower boundary, and constant hazard tail. The upper boundary exceeds maximum follow-up by one fiftieth of its full span, or one fiftieth of the maximum when the span is zero. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If training evidence cannot determine the requested distinct interior event quantiles or a positive finite boundary. Supply an explicit MSplineBasis when automatic knot selection is underdetermined. |
Notes
This function belongs to training-data preparation. Prediction retains its returned basis and never selects knots from fresh covariates or responses. Censoring times can extend support but cannot move interior event quantiles.
Source code in src/quivers/_spline_design.py
Censored extended Beta responses¶
ExtendedBeta(mu, phi, kappa) starts from
X ~ Beta(mu*phi, (1-mu)*phi) and returns
clamp((1+2*kappa)*X-kappa, 0, 1). The parameter mu is the
underlying Beta mean; the response mean generally differs. Precision
phi is positive, 0 < mu < 1, and the extension kappa is nonnegative.
At zero extension the law reduces to an ordinary Beta, with no endpoint
atoms. Positive extension places the exact censored tail masses at zero
and one. Scoring an endpoint evaluates its atom mass; interior observations
use the affine Beta density.
Parameters, scores, moments, and draws use float64. Complementary Beta
coordinates retain small endpoint distances before subtraction or sampling
rounding. log_cdf includes boundary atoms, while log_cdf_left excludes
them; the two survival methods use complementary strict/inclusive events.
Pathwise sampling differentiates the affine map and censoring pushforward.
It requires both Beta concentrations to be at least the square root of
float64's smallest normal value, keeping shape-gradient denominators
representable. Ordinary sampling retains the shared log-Gamma underflow
fallback for smaller shapes.
A mathematically interior draw that cannot be represented strictly between
zero and one raises RuntimeError, rather than adding numerical atom mass.
Response means and variances use positive adaptive quadrature, bounded by
moment_atol=1e-12, moment_rtol=1e-10, and
moment_max_panels=4096 per batch row, processed in chunks of at most 64
rows. Tiny extensions use partial-Beta moment corrections; zero extension
retains the exact Beta moments and their one-sided first extension
derivatives. These derivatives do not imply that every second extension
derivative exists at zero. A failed convergence or interval-resolution
check raises explicitly. An inverse CDF is unavailable because the shared
Beta base does not implement one. Native and checked-reference execution
support this law; external renderers refuse it by family name.
_extended_beta
¶
Symmetrically extended Beta responses censored to the unit interval.
ExtendedBeta
¶
ExtendedBeta(mu, phi, kappa, *, moment_atol=1e-12, moment_rtol=1e-10, moment_max_panels=4096, validate_args=None)
Bases: Censored
Extend a mean/precision Beta law and censor its tails at zero and one.
| PARAMETER | DESCRIPTION |
|---|---|
mu
|
Underlying Beta mean, strictly between zero and one.
TYPE:
|
phi
|
Strictly positive Beta precision.
TYPE:
|
kappa
|
Nonnegative extension:
TYPE:
|
moment_atol
|
Deterministic bounded-moment quadrature error budgets.
TYPE:
|
moment_rtol
|
Deterministic bounded-moment quadrature error budgets.
TYPE:
|
moment_max_panels
|
Per-row adaptive panel limit; work is chunked over at most64 rows.
TYPE:
|
validate_args
|
Torch validation policy; parameter validity is always checked.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If parameters or numerical budgets are invalid. |
RuntimeError
|
If the symmetric extension cannot retain its censoring bounds in Float64. |
Source code in src/quivers/continuous/_extended_beta.py
mean
property
¶
mean: Tensor
True censored response mean, computed with deterministic error bounds.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Mean on the parameter batch axes, generally different from mu. |
variance
property
¶
variance: Tensor
Positive within/between response variance without raw-moment cancellation.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Variance on the parameter batch axes. |
expand
¶
Broadcast the same law and deterministic moment budgets.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested parameter batch shape.
TYPE:
|
_instance
|
Optional Torch expansion instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ExtendedBeta
|
Expanded distribution, retaining the same numerical policy. |
Source code in src/quivers/continuous/_extended_beta.py
sample
¶
Draw censoring atoms before rounding complementary Beta weights.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading independent sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Distribution result on the requested sample and batch axes. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If the evaluation or sample exceeds the documented numerical capacity. |
Source code in src/quivers/continuous/_extended_beta.py
rsample
¶
Draw pathwise responses, refusing unrepresentable interior samples.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading independent sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Distribution result on the requested sample and batch axes. |
Source code in src/quivers/continuous/_extended_beta.py
Additive log-ratio Normal events¶
AdditiveLogRatioNormal(loc, scale_tril, reference=None) maps a correlated
Normal vector of dimension d to a simplex of dimension d + 1. By default,
the final component is the reference: log(y[:-1] / y[-1]) has that Normal
distribution. An integer reference selects another component without
reordering the response; Normal coordinates follow the remaining components
in their original order. Batched reference indices may vary by observation.
scale_tril is a lower-triangular Cholesky factor with a positive diagonal.
Batch axes broadcast separately from the coordinate and matrix event axes.
ConditionalAdditiveLogRatioNormal learns both Normal heads.
The density includes the change-of-variables term -sum(log(y)).
Every component is strictly positive, and components must sum to one
within the native simplex tolerance. Native sampling is pathwise;
native and checked-reference scores retain the entire simplex as one event.
This family differs from LogisticNormal, which retains its existing
stick-breaking transform of independent Normal coordinates. Neither the
Normal location nor its softmax is generally the simplex expectation.
The checked response extent is nat_add(d, 1), expressing the same
dimension relationship used by native construction. All external targets
report this family's missing rendering capability explicitly.
_additive_log_ratio
¶
Correlated Gaussian additive log ratios on a simplex.
AdditiveLogRatioNormal
¶
Bases: Distribution
A Gaussian law for log ratios against a selected simplex component.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Gaussian location with trailing width
TYPE:
|
scale_tril
|
Lower-triangular Gaussian scale with trailing shape
TYPE:
|
reference
|
Reference component, broadcast over Gaussian batch dimensions. None selects the final component. Free coordinates retain the relative order of every other component.
TYPE:
|
validate_args
|
Torch distribution validation policy.
TYPE:
|
Notes
A draw has D + 1 components. The nonreference components retain their
original order; their log ratios against the reference have the joint
Gaussian law. The final component is the default reference. Analytic
response means and variances are unavailable.
Source code in src/quivers/continuous/_additive_log_ratio.py
expand
¶
Broadcast the batch dimensions while retaining the coordinate event.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
New broadcast-compatible batch shape.
TYPE:
|
_instance
|
Optional instance populated by Torch's expansion protocol.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AdditiveLogRatioNormal
|
Distribution with the requested batch shape. |
Source code in src/quivers/continuous/_additive_log_ratio.py
rsample
¶
rsample(sample_shape=Size())
Draw simplex values by reparameterizing the Gaussian log ratios.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Independent sample dimensions preceding the batch dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Strictly positive simplex draws. |
| RAISES | DESCRIPTION |
|---|---|
FloatingPointError
|
If floating point underflow cannot represent an interior draw. |
Source code in src/quivers/continuous/_additive_log_ratio.py
log_prob
¶
Score an interior simplex event, including the ALR Jacobian.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate simplex events with the trailing component axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Gaussian log density minus the sum of log components; negative infinity outside the simplex interior. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the event has the wrong number of components. |
Source code in src/quivers/continuous/_additive_log_ratio.py
Discrete Weibull counts¶
DiscreteWeibull(probs, concentration) has nonnegative integer support,
with survival P(Y >= k) = probs**(k**concentration). The probability
lies in [0, 1) and the concentration is positive; zero probability
gives a point mass at zero. ConditionalDiscreteWeibull learns these
native parameters, which are distinct from a response mean.
Parameters, scores, and moments use float64; samples use int64 and
are non-reparameterized. Finite samples and finite requested quantiles
above 2**53 are refused before integer conversion. Moment calculation
uses adaptive sums with survival-integral remainder bounds. Native
moment_rtol=1e-10 and moment_max_terms=262144 control its relative
tolerance and count-term budget, retained by expand. A failure to
certify the requested tolerance raises explicitly; mathematical moments
still exist throughout the admitted parameter domain.
_discrete_weibull
¶
Discrete Weibull counts with stable tails and bounded moment calculations.
DiscreteWeibull
¶
DiscreteWeibull(probs, concentration, validate_args=None, *, moment_rtol=1e-10, moment_max_terms=262144)
Bases: Distribution
Counts with survival P(Y >= k) = probs**(k**concentration).
| PARAMETER | DESCRIPTION |
|---|---|
probs
|
Survival parameter in [0, 1), with zero giving the point mass at zero.
TYPE:
|
concentration
|
Strictly positive power parameter.
TYPE:
|
validate_args
|
Whether to validate distribution parameters.
TYPE:
|
moment_rtol
|
Relative tolerance certified by omitted-moment integral bounds.
TYPE:
|
moment_max_terms
|
Maximum number of count cells used for a moment calculation.
TYPE:
|
Notes
Density and inverse-transform sampling require constant work per row. Moments use adaptive blocks and analytic upper bounds on the omitted tails. Failure to certify the requested tolerance raises explicitly. Native count arithmetic uses Float64 and integer samples use Int64.
Source code in src/quivers/continuous/_discrete_weibull.py
mean
property
¶
Compute the mean with an analytic omitted-tail error bound.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 response means within the configured relative tolerance. |
variance
property
¶
Compute variance without subtracting two large raw moments.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 variances within the configured relative tolerance. |
expand
¶
Expand the parameter views and retain the moment resource policy.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Target batch dimensions.
TYPE:
|
_instance
|
Optional reusable instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DiscreteWeibull
|
Expanded distribution. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_prob
¶
Evaluate a count mass in Float64.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Candidate integer counts.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log mass, negative infinity outside the support. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_interval_mass
¶
Evaluate an integer interval without subtracting rounded tail values.
| PARAMETER | DESCRIPTION |
|---|---|
low
|
Real endpoints; None leaves a side unbounded.
TYPE:
|
high
|
Real endpoints; None leaves a side unbounded.
TYPE:
|
lower_closed
|
Endpoint membership, optionally varying across batch rows.
TYPE:
|
upper_closed
|
Endpoint membership, optionally varying across batch rows.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exact factored log probabilities on the distribution batch. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an endpoint is NaN. |
TypeError
|
If endpoint membership is not Boolean. |
Source code in src/quivers/continuous/_discrete_weibull.py
log_cdf
¶
log_survival_function
¶
cdf
¶
icdf
¶
Invert the staircase cumulative distribution.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Float64 count quantiles, positive infinity at probability one except for the degenerate-zero law. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a finite requested quantile exceeds exact Float64 count capacity. |
Source code in src/quivers/continuous/_discrete_weibull.py
sample
¶
sample(sample_shape=Size())
Draw integer counts by a vectorized exponential transform.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the parameter batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Int64 counts on the parameters' device. |
| RAISES | DESCRIPTION |
|---|---|
RuntimeError
|
If a generated count exceeds exact Float64 integer capacity. |
Source code in src/quivers/continuous/_discrete_weibull.py
Zero-inflated asymmetric Laplace responses¶
ZeroInflatedAsymmetricLaplace(zero_prob, loc, scale, quantile) has an
exact atom at zero and a continuous asymmetric Laplace component.
Its score at zero is log(zero_prob), independently of the component's
density there. loc is the component's selected quantile, with positive
scale and a quantile strictly between zero and one. Its CDF includes
the atom at zero; strict survival excludes it there. The
formal definition
specifies the mixed dominating measure and response mean.
ConditionalZeroInflatedAsymmetricLaplace learns the native parameters.
The mixture sampler selects its branch before drawing a continuous
response and provides no pathwise sampling gradient. Native and
checked-reference execution support this family and DiscreteWeibull;
all 11 external renderers explicitly refuse both.
_zero_inflated_asymmetric_laplace
¶
An exact zero atom combined with an asymmetric Laplace component.
ZeroInflatedAsymmetricLaplace
¶
Bases: Distribution
Structural zeros and a continuous asymmetric Laplace response.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Probability of the atom at zero, including zero and one.
TYPE:
|
loc
|
Quantile location of the continuous component.
TYPE:
|
scale
|
Positive component scale in the check-loss parameterization.
TYPE:
|
quantile
|
Component quantile strictly between zero and one.
TYPE:
|
validate_args
|
Whether to validate distribution parameters.
TYPE:
|
Notes
Density is relative to the sum of a zero atom and Lebesgue measure: the continuous density does not contribute to the mass at zero. Sampling selects the mixture branch before sampling its component.
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
mean
property
¶
Expected mixed response.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Component mean multiplied by its mixture probability. |
variance
property
¶
Variance including uncertainty about the mixture branch.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Component variance and between-component mean contribution. |
expand
¶
Expand parameter views over a new batch.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Target broadcast batch dimensions.
TYPE:
|
_instance
|
Optional reusable distribution instance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ZeroInflatedAsymmetricLaplace
|
Distribution with expanded parameter views. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_prob
¶
Evaluate the zero atom or continuous component density.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real responses, broadcastable with the parameter batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log atom mass at zero and log Lebesgue density elsewhere. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_cdf
¶
Evaluate log probability at or below a response.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probabilities, including the atom at zero. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
log_survival_function
¶
Evaluate log probability strictly above a response.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log survival probabilities, excluding the atom at zero. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
cdf
¶
Evaluate cumulative probabilities.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Real response bounds.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Cumulative probabilities. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
icdf
¶
Invert the continuous tails and the jump at zero.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Generalized quantiles, with zero throughout the atom's jump. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
sample
¶
sample(sample_shape=Size())
Select branches before sampling active continuous responses.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the parameter batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Floating responses, including exact structural zeros. |
Source code in src/quivers/continuous/_zero_inflated_asymmetric_laplace.py
Response-time distributions¶
ExGaussian(loc, scale, rate) is the sum of independent Normal and Exponential
variables, with response mean loc + 1/rate. InverseGaussian(mu, shape) uses
the response mean and positive shape directly. Both provide native densities,
CDFs, moments, broadcasting, and reparameterized sampling. Inverse Gaussian
samples use an exact vectorized transformation and implicit CDF derivatives;
its discrete sampler branch is not differentiated as though it were fixed.
Both laws expose log_cdf and log_survival_function. These methods use
Float64 arithmetic and retain the smaller tail before complementing it;
cdf projects the result to the promoted parameter/query dtype. Interval
normalization uses the paired tails once per endpoint. A positive local
density rule handles narrow intervals whose endpoint tails round to the
same number, including adjacent representable bounds.
The Gaussian divided-difference calculation checks agreement between fixed
eight- and 32-node rules for short separations. Nonconvergence, a scaled argument magnitude above
1e150, or a separation above 1e150 raises RuntimeError; the scalar
reference backend raises DistributionError. This is a bounded numerical algorithm,
with no uniform accuracy guarantee across all parameter regimes. Finite
log-tail and local-interval calculations support first and second parameter
derivatives and forward automatic differentiation.
_response_time
¶
Exponentially modified Gaussian and inverse Gaussian response distributions.
ExGaussian
¶
ExGaussian(loc: Tensor | float, scale: Tensor | float, rate: Tensor | float, validate_args: bool | None = None)
Bases: Distribution
Sum of independent Normal and Exponential random variables.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Mean of the Normal component, distinct from the response mean.
TYPE:
|
scale
|
Strictly positive standard deviation of the Normal component.
TYPE:
|
rate
|
Strictly positive rate of the Exponential component.
TYPE:
|
validate_args
|
Whether to validate parameters and evaluation points.
TYPE:
|
Notes
The response mean is loc + 1/rate. The brms formula interface
predicts that mean and calls the exponential mean beta.
Source code in src/quivers/continuous/_response_time.py
log_cdf
¶
Return log P(Y <= value), retaining small Gaussian-exponential tails.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Extended-real evaluation points, broadcast with the batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probabilities. Computed in Float64 to retain probabilities that ordinary CDF evaluation rounds away. |
Source code in src/quivers/continuous/_response_time.py
log_survival_function
¶
Return log P(Y > value), without subtracting a rounded CDF.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Extended-real evaluation points, broadcast with the batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log strict upper-tail probabilities. Computed in Float64 to retain probabilities that ordinary CDF evaluation rounds away. |
Source code in src/quivers/continuous/_response_time.py
log_density_variation
¶
Bound the absolute log-density change across a finite interval.
| PARAMETER | DESCRIPTION |
|---|---|
lower
|
Finite interval endpoints, broadcast against the parameters.
TYPE:
|
upper
|
Finite interval endpoints, broadcast against the parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
A nonnegative Float64 variation bound, or infinity outside a finite positive-width interval. The inverse Mills ratio obeys m(t) <= max(-t, 0) + 1, yielding a conservative score bound. |
Source code in src/quivers/continuous/_response_time.py
InverseGaussian
¶
Bases: Distribution
Inverse Gaussian distribution in mean/shape parameterization.
| PARAMETER | DESCRIPTION |
|---|---|
mu
|
Strictly positive response mean.
TYPE:
|
shape
|
Strictly positive shape, conventionally lambda.
TYPE:
|
validate_args
|
Whether to validate parameters and evaluation points.
TYPE:
|
Notes
Sampling uses the exact Michael–Schucany–Haas transformation without
rejection loops. Its gradients use implicit differentiation of the
CDF, rather than differentiating the sampler's discrete branch choice.
The gradient is -partial_theta CDF(y) / density(y); common
exponential factors cancel analytically before numerical evaluation.
Source code in src/quivers/continuous/_response_time.py
log_cdf
¶
Return log P(Y <= value), retaining finite extreme-tail values.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Extended-real evaluation points, broadcast with the batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log cumulative probabilities. Computed in Float64 to retain probabilities that ordinary CDF evaluation rounds away. |
Source code in src/quivers/continuous/_response_time.py
log_survival_function
¶
Return log P(Y > value), retaining the Gaussian divided difference.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Extended-real evaluation points, broadcast with the batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log strict upper-tail probabilities. Computed in Float64 to retain probabilities that ordinary CDF evaluation rounds away. |
Source code in src/quivers/continuous/_response_time.py
log_density_variation
¶
Bound the absolute log-density change over a positive interval.
| PARAMETER | DESCRIPTION |
|---|---|
lower
|
Interval endpoints, broadcast against the parameters.
TYPE:
|
upper
|
Interval endpoints, broadcast against the parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
A nonnegative Float64 variation bound, or infinity outside finite strictly positive endpoints. |
Source code in src/quivers/continuous/_response_time.py
Skew, shifted, and extreme-value distributions¶
SkewNormal(loc, scale, skewness) uses the native Azzalini
location/scale parameters. ShiftedLogNormal(loc, scale, shift) shifts
a lognormal component by a nonnegative amount.
Frechet(scale, concentration) has a positive concentration;
GeneralizedExtremeValue(loc, scale, concentration) has a real one,
with the Gumbel limit at zero. These scalar response laws have different
moment domains and support endpoints; see the
native-family guide.
The formula interface performs its own response-parameter conversions.
The four native distributions provide cdf, log_cdf,
log_survival_function, icdf, and direct vectorized pathwise samples.
Their ConditionalSkewNormal, ConditionalShiftedLogNormal,
ConditionalFrechet, and ConditionalGeneralizedExtremeValue wrappers
learn the native constructor parameters. Checked-reference execution is
supported; all 11 external renderers explicitly refuse these four laws.
Skew-normal CDF and quantile evaluation uses float64 intermediate
arithmetic and deterministic quadrature, with no uniform error guarantee.
Those two methods require a device with float64 support.
_skew_normal
¶
Skew-normal responses with stable positive-integral tail probabilities.
SkewNormal
¶
Bases: Distribution
Skew-normal law in Azzalini location, scale, and skewness parameters.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Location of the underlying skewed normal, distinct from its mean.
TYPE:
|
scale
|
Positive scale, distinct from its standard deviation.
TYPE:
|
skewness
|
Real Azzalini shape parameter, conventionally alpha.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_skew_normal.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_skew_normal.py
_shape_families
¶
Shifted lognormal, Frechet, and generalized extreme-value response laws.
ShiftedLogNormal
¶
Bases: Distribution
A lognormal response plus a nonnegative location shift.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Mean of the underlying normal log response.
TYPE:
|
scale
|
Positive standard deviation of the underlying normal.
TYPE:
|
shift
|
Nonnegative lower support endpoint.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
support
¶
Return the parameter-dependent response support.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
Frechet
¶
Bases: Distribution
Frechet distribution on positive responses.
| PARAMETER | DESCRIPTION |
|---|---|
scale
|
Positive response scale.
TYPE:
|
concentration
|
Positive tail shape. The first moment exists above one and the second moment above two.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
GeneralizedExtremeValue
¶
Bases: Distribution
Generalized extreme-value law with a differentiable Gumbel limit.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
Response location, distinct from the expectation.
TYPE:
|
scale
|
Positive scale.
TYPE:
|
concentration
|
Real extreme-value shape; zero gives Gumbel. SciPy's genextreme uses the opposite sign for its shape parameter.
TYPE:
|
validate_args
|
Whether to validate parameters.
TYPE:
|
Source code in src/quivers/continuous/_shape_families.py
mean
property
¶
Return the response expectation, or infinity when its first moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
variance
property
¶
Return the response variance, or infinity when its second moment does not exist.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
support
¶
Return the parameter-dependent response support.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
expand
¶
Expand parameter views without copying their underlying storage.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested broadcast batch dimensions.
TYPE:
|
_instance
|
Optional instance supplied by PyTorch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Distribution
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_prob
¶
Evaluate log densities, returning negative infinity outside the support.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_cdf
¶
Evaluate cumulative probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
log_survival_function
¶
Evaluate complementary probabilities directly in log space.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
cdf
¶
icdf
¶
Transform probabilities to response quantiles.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Response values; for icdf, probabilities in the closed unit interval.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
rsample
¶
rsample(sample_shape=Size())
Draw responses with pathwise gradients through the distribution parameters.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample dimensions. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Broadcast result with the parameter device and dtype. |
Source code in src/quivers/continuous/_shape_families.py
Truncating conditional families¶
Truncated denotes a normalized restriction of the base conditional
distribution. For independent scalar coordinates, it sums each coordinate's
log interval mass; a coupled event requires a joint rectangle-mass
operation. The formal definition
distinguishes this conditioning from interval censoring.
The wrapper reads the base distribution through _get_dist(x) and
uses deterministic CDF or log-tail interval masses. Normal tails have a
stable specialized calculation; Gamma and Poisson use incomplete-gamma
probabilities. Unsupported base/event contracts and zero or nonfinite
computed interval masses raise explicit errors. Normal sampling uses a
stable inverse CDF; other bases use bounded rejection controlled by
max_rejection_iterations. The rejection branch does not establish a
general pathwise derivative through the acceptance event.
Gamma interval masses use float64 lower-tail series, upper-tail continued fractions, and small-shape complement calculations. Shape and rate derivatives propagate through converged recurrences; nonconvergence within 512 iterations raises explicitly. These numerical and derivative contracts do not assert a uniform accuracy or convergence guarantee.
Generalized Pareto tails¶
ConditionalGeneralizedPareto learns loc, positive scale, and real
concentration, the tail index. The registered GeneralizedPareto
family supports native and QIEC reference execution, with density, CDF,
inverse CDF, and reparameterized draws. Its finite endpoint for negative
indices and its exponential limit at zero are described in the
tail-family guide.
The native distribution implementation is private; the public API is
the conditional wrapper and its registered
FamilySpec.
Positive hurdle distributions¶
HurdleGamma(zero_prob, concentration, rate) and
HurdleLogNormal(zero_prob, loc, scale) combine an exact zero atom with a
strictly positive component. ConditionalHurdleGamma and
ConditionalHurdleLogNormal learn those parameters from their input.
Both native distributions provide log mass at zero, positive-response log
density, CDF, response mean/variance, broadcasting, and sampling. The structural
zero gate makes sampling non-reparameterized. Their scoring and moment
parameters remain differentiable, including finite permitted-event gradients
at zero probabilities of zero and one. The Gamma CDF inherits PyTorch's
incomplete-gamma derivative limitations for its concentration parameter.
_positive_hurdle
¶
Exact zero atoms combined with strictly positive response distributions.
HurdleGamma
¶
HurdleGamma(zero_prob: Tensor | float, concentration: Tensor | float, rate: Tensor | float, validate_args: bool | None = None)
Bases: _PositiveHurdle
A zero atom and Gamma concentration/rate response component.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability, including zero and one.
TYPE:
|
concentration
|
Positive Gamma shape.
TYPE:
|
rate
|
Positive Gamma rate.
TYPE:
|
validate_args
|
Whether to validate parameters and scored observations.
TYPE:
|
Source code in src/quivers/continuous/_positive_hurdle.py
HurdleLogNormal
¶
HurdleLogNormal(zero_prob: Tensor | float, loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)
Bases: _PositiveHurdle
A zero atom and LogNormal log-location/log-scale response component.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability, including zero and one.
TYPE:
|
loc
|
Mean of the underlying Normal log response.
TYPE:
|
scale
|
Positive standard deviation of the underlying Normal log response.
TYPE:
|
validate_args
|
Whether to validate parameters and scored observations.
TYPE:
|
Source code in src/quivers/continuous/_positive_hurdle.py
Zero-inflated and hurdle counts¶
ZeroInflatedNegativeBinomial(zero_prob, total_count, probs),
ZeroInflatedBinomial(zero_prob, total_count, probs), and
ZeroInflatedBetaBinomial(zero_prob, total_count, concentration1, concentration0)
add a structural zero to their count component. Their total zero probability
includes both that atom and the component's own zero mass.
HurdleNegativeBinomial(zero_prob, total_count, probs) instead assigns the
whole zero probability to the atom and normalizes its component over
positive counts. Negative-binomial probs follows PyTorch's convention;
its component mean is total_count * probs / (1-probs).
These scalar count distributions provide differentiable log masses and
moments, batch broadcasting, and non-reparameterized sampling. Binomial
trial counts may be zero, giving a point mass at zero. At negative-binomial
probs=0, the hurdle's positive component uses its limiting point mass at
one. Its sampler uses a compound-Poisson representation with logarithmic
counts, avoiding rejection from an almost-always-zero count distribution.
The count guide
relates these native parameters to regression means, precision, and links.
Native and QIEC reference execution support all four. Each of the 11
external renderers refuses them with a family:<Family>
diagnostic; native registration alone does not provide a target mapping.
Native Binomial, BetaBinomial, NegativeBinomial, Poisson, and these four count mixtures
compute parameters, log scores, and mean/variance in float64. Promotion
preserves gradients to learned float32 parameter heads, whose gradients
retain their original dtype. Finite trial counts must satisfy
0 <= total_count <= 2**53 before conversion, preserving exact integer
representation; the general Int carrier remains signed 64-bit. Large
counts should arrive as integer arrays or integer literals, since promotion
cannot recover a value already rounded in float32. Discrete samples remain
integer-valued and non-reparameterized.
Arithmetic count observations are checked before conversion as well: a finite
original value outside [-2**53, 2**53] is refused. With argument validation
disabled, fractional, nonfinite, or other off-support values return negative
infinity rather than being truncated. Finite category indices retain their
separate support contract without imposing the arithmetic-count bound.
The count density kernels use stable deviance, Stirling, and
gamma-increment formulas where applicable; this precision policy does
not assert a uniform numerical error bound over all parameter regimes.
For Poisson, negative-binomial, and their inflated or hurdle samplers,
nonfinite generated intensities or counts, or values above 2**53,
raise RuntimeError natively and DistributionError in the reference
backend. No truncation, renormalization, or overflow-hiding redraw is
performed. Structural-zero outcomes skip the unreachable count branch.
See the count guide
for the distinction between sampling limits and density evaluation.
_zero_inflated_count
¶
Zero atoms combined with normalized binomial and negative-binomial counts.
BetaBinomial
¶
Bases: _CountCDF, Distribution
A broadcast beta-binomial component, including zero trials.
| PARAMETER | DESCRIPTION |
|---|---|
total_count
|
Nonnegative integer trial count.
TYPE:
|
concentration1
|
Positive success concentration.
TYPE:
|
concentration0
|
Positive failure concentration.
TYPE:
|
validate_args
|
Whether to validate arguments.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
mean
property
¶
mean: Tensor
Expected successes.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Trial count times the beta mean. |
variance
property
¶
variance: Tensor
Variance after integrating over the beta probability.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Beta-binomial response variance. |
log_prob
¶
Evaluate the finite count mass in the parameter dtype.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Counts broadcastable with the parameter batch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Log mass, negative infinity outside the trial support. |
Source code in src/quivers/continuous/_zero_inflated_count.py
sample
¶
Draw a beta probability followed by a binomial count.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Sample dimensions prepended to the batch. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Nonnegative integer counts. |
Source code in src/quivers/continuous/_zero_inflated_count.py
ZeroInflatedNegativeBinomial
¶
Bases: _InflatedCount
Structural zeros plus NB successes before total_count failures.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative negative-binomial shape.
TYPE:
|
probs
|
Success probability in [0, 1), with count mean r*p/(1-p).
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
ZeroInflatedBinomial
¶
Bases: _InflatedCount
Structural zeros plus a binomial, including zero trials.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative integer trial counts.
TYPE:
|
probs
|
Binomial success probability in [0, 1].
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
support
¶
Counts between zero and the trial count.
| RETURNS | DESCRIPTION |
|---|---|
Constraint
|
The parameter-dependent integer support. |
Source code in src/quivers/continuous/_zero_inflated_count.py
ZeroInflatedBetaBinomial
¶
ZeroInflatedBetaBinomial(zero_prob, total_count, concentration1, concentration0, validate_args=None)
Bases: ZeroInflatedBinomial
Structural zeros plus a beta-binomial with integrated success probability.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Structural zero probability in [0, 1].
TYPE:
|
total_count
|
Nonnegative integer trial counts.
TYPE:
|
concentration1
|
Positive beta success concentration.
TYPE:
|
concentration0
|
Positive beta failure concentration.
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
HurdleNegativeBinomial
¶
Bases: ZeroInflatedNegativeBinomial
Zero atom plus a normalized strictly positive negative binomial.
| PARAMETER | DESCRIPTION |
|---|---|
zero_prob
|
Hurdle probability in [0, 1].
TYPE:
|
total_count
|
Strictly positive negative-binomial shape.
TYPE:
|
probs
|
Success probability in [0, 1). At zero the positive component is its point-mass-at-one limit.
TYPE:
|
validate_args
|
Whether to validate parameters and observations.
TYPE:
|
Source code in src/quivers/continuous/_zero_inflated_count.py
mean
property
¶
mean: Tensor
Expected hurdle count.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Positive conditional mean times the nonzero probability. |
variance
property
¶
variance: Tensor
Variance of the full hurdle response.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Second moment minus the squared full mean. |
log_prob
¶
Score the atom or normalized positive component without p=0 divisions.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Nonnegative integer counts.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Exact log probabilities including the p=0 limit. |
Source code in src/quivers/continuous/_zero_inflated_count.py
sample
¶
Draw structural zeros and efficiently conditioned positive NB counts.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Dimensions prepended to the batch shape. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Nonnegative integer draws without reparameterized gradients. |
Source code in src/quivers/continuous/_zero_inflated_count.py
Multivariate Student events¶
The Gaussian scale matrix is distinct from the Student response covariance. See the multivariate Student guide for event axes, moment boundaries, and constructor alternatives.
MultivariateStudentT
¶
MultivariateStudentT(df: Tensor | float, loc: Tensor, covariance_matrix: Tensor | None = None, precision_matrix: Tensor | None = None, scale_tril: Tensor | None = None, validate_args: bool | None = None)
Bases: Distribution
A multivariate Student law with one shared radial scale per vector.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Positive degrees of freedom, broadcast over Gaussian batch axes.
TYPE:
|
loc
|
Location with trailing event dimension
TYPE:
|
covariance_matrix
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
precision_matrix
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
scale_tril
|
Exactly one Gaussian scale representation. The scale matrix is not
the response covariance; the latter is
TYPE:
|
validate_args
|
Torch argument and observation validation policy.
TYPE:
|
Notes
A single chi-squared variate scales every coordinate in each vector. Independent univariate Student distributions have a different joint law. The location is the response mean only for degrees of freedom above one.
Source code in src/quivers/continuous/_multivariate_student_t.py
arg_constraints
property
¶
arg_constraints: dict[str, Constraint]
Read the checked heads without materializing covariance properties.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Constraint]
|
Actual stored Gaussian factor and Student head constraints. |
covariance_matrix
property
¶
covariance_matrix: Tensor
Return the Gaussian scale matrix, following Torch parameter names.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Scale matrices with trailing shape |
precision_matrix
property
¶
precision_matrix: Tensor
Return the inverse Gaussian scale matrix.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Inverse scale matrices with trailing shape |
mean
property
¶
mean: Tensor
Return the finite response mean where it exists.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Location for |
variance
property
¶
variance: Tensor
Return marginal variances with Student moment existence boundaries.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Finite variances above two degrees of freedom, infinity between one and two, and NaN at or below one. |
log_prob
¶
Evaluate the marginal vector density without auxiliary latent sites.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
Observations ending in the declared vector event axis.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
One log density per sample and batch coordinate. |
Source code in src/quivers/continuous/_multivariate_student_t.py
rsample
¶
Draw pathwise using one radial chi-squared scale per vector.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
Draws with sample, batch, and final vector event dimensions. |
Source code in src/quivers/continuous/_multivariate_student_t.py
expand
¶
expand(batch_shape: Sequence[int], _instance=None) -> MultivariateStudentT
Expand only batch axes while retaining the shared factor.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Broadcast-compatible new batch dimensions.
TYPE:
|
_instance
|
Optional uninitialized expansion instance, following Torch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MultivariateStudentT
|
Expanded distribution without another matrix factorization. |
Source code in src/quivers/continuous/_multivariate_student_t.py
ConditionalMultivariateStudentT
¶
ConditionalMultivariateStudentT(domain: AnySpace, codomain: ContinuousSpace, hidden_dim: int | Sequence[int] | None = None, param_source: ParamSource | None = None, param_source_option: str | None = None)
Bases: ConditionalMultivariateNormal
Learn a Student radial scale alongside the existing Gaussian heads.
| PARAMETER | DESCRIPTION |
|---|---|
domain
|
Input carrier and real-vector response space.
TYPE:
|
codomain
|
Input carrier and real-vector response space.
TYPE:
|
hidden_dim
|
Parameter-network hidden dimensions.
TYPE:
|
param_source
|
Reusable source emitting location, packed Cholesky, and one df head.
TYPE:
|
param_source_option
|
Existing parameter-source strategy.
TYPE:
|
Source code in src/quivers/continuous/families.py
Matrix-normal factors¶
MatrixNormal accepts independently exclusive row_covariance /
row_scale_tril and col_covariance / col_scale_tril arguments. Factor
inputs use triangular solves and draws directly; covariance properties are
materialized lazily. mean, entrywise variance, and batch expand retain
rectangular event dimensions. See the matrix-prior guide.
MatrixNormal
¶
MatrixNormal(loc: Tensor, row_covariance: Tensor | None = None, col_covariance: Tensor | None = None, validate_args: bool | None = None, *, row_scale_tril: Tensor | None = None, col_scale_tril: Tensor | None = None)
Bases: Distribution
The normal law on n x p matrices with Kronecker covariance.
X ~ MN(M, U, V) when its row-major vectorization is normal with
mean that of M and covariance U (x) V: entries X[i, j] and
X[k, l] covary as U[i, k] V[j, l]. With
U = A A^T and V = B B^T a draw is M + A Z B^T for a
standard normal Z, and the log density is
-(np/2) log 2 pi - (p/2) log det U - (n/2) log det V
- tr(V^-1 R^T U^-1 R) / 2 at a residual R = X - M.
| PARAMETER | DESCRIPTION |
|---|---|
loc
|
The mean,
TYPE:
|
row_covariance
|
The row covariance
TYPE:
|
col_covariance
|
The column covariance
TYPE:
|
row_scale_tril
|
Lower Cholesky factors of the respective covariances. Supplying factors avoids covariance construction and factorization during scoring.
TYPE:
|
col_scale_tril
|
Lower Cholesky factors of the respective covariances. Supplying factors avoids covariance construction and factorization during scoring.
TYPE:
|
validate_args
|
Whether to validate the arguments and values.
TYPE:
|
Source code in src/quivers/continuous/_matrix.py
mean
property
¶
mean: Tensor
The broadcast mean matrix.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
variance
property
¶
variance: Tensor
Entrywise variances from the two factor row norms.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
row_covariance
¶
row_covariance() -> Tensor
The row covariance, materialized only when requested.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
Source code in src/quivers/continuous/_matrix.py
col_covariance
¶
col_covariance() -> Tensor
The column covariance, materialized only when requested.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
Source code in src/quivers/continuous/_matrix.py
row_scale_tril
¶
row_scale_tril() -> Tensor
The row Cholesky factor, computed once for covariance inputs.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
Source code in src/quivers/continuous/_matrix.py
col_scale_tril
¶
col_scale_tril() -> Tensor
The column Cholesky factor, computed once for covariance inputs.
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The corresponding batched matrix values. |
Source code in src/quivers/continuous/_matrix.py
expand
¶
Expand batch axes without factoring or materializing covariances.
| PARAMETER | DESCRIPTION |
|---|---|
batch_shape
|
Requested batch dimensions.
TYPE:
|
_instance
|
Optional distribution instance used by Torch expansion.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MatrixNormal
|
A distribution sharing the existing parameter tensors. |
Source code in src/quivers/continuous/_matrix.py
rsample
¶
Draw M + A Z B^T.
| PARAMETER | DESCRIPTION |
|---|---|
sample_shape
|
Leading sample axes. |
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The draws, |
Source code in src/quivers/continuous/_matrix.py
log_prob
¶
The log density at a matrix.
| PARAMETER | DESCRIPTION |
|---|---|
value
|
The matrices,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The log densities. |