Skip to content

Reference families

These samplers and densities implement the structured and compositional families of the reference backend, beyond its scalar core, for the declared families. A family that several backends implement may differ in its event shapes and supports.

The count-mixture reference kernels include ZeroInflatedNegativeBinomial, ZeroInflatedBinomial, ZeroInflatedBetaBinomial, and HurdleNegativeBinomial. They preserve count support and distinguish a structural-zero mixture from positive truncation; the formal count semantics states their masses and endpoint conventions. All 11 external renderers refuse these four count families with a family:<Family> diagnostic, independently of native and reference support.

GeneralizedPareto(loc, scale, concentration) also has a reference density and sampler. Its real tail index controls the finite or infinite upper endpoint, with the exponential limit at zero; see the native tail-family guide. Reference support does not establish an external target mapping.

SkewNormal, ShiftedLogNormal, Frechet, and GeneralizedExtremeValue also have checked-reference densities and samplers, independently checked against their native laws. Their formal parameter maps distinguish native location/scale parameters from regression means. All 11 external renderers refuse these four families explicitly.

DiscreteWeibull and ZeroInflatedAsymmetricLaplace also have native and checked-reference implementations, with nonnegative count and mixed zero-atom/real supports, respectively. Their formal definitions distinguish a survival parameter from a response mean and an atom's mass from a continuous density. Both are explicitly refused by all 11 external renderers. The formula-only negbinomial2 parameterization reuses the existing NegativeBinomial reference kernel.

reference_families

The reference backend's samplers and densities beyond the scalar core.

Every family of the semantic registry has a plain-Python sampler and log density here or in :mod:quivers.qiec.distributions, so the reference machine runs any model end to end and can be held to an independent oracle. The structured families work on nested tuples: a vector is a tuple of floats and a matrix a tuple of rows. The small linear algebra they need, Cholesky factors, triangular solves, and determinants, is written out here rather than taken from a host library, which is the point of a reference.

relaxation_temperature

relaxation_temperature(a: Mapping[str, object], family: str) -> float

The temperature a relaxed family is constructed at.

PARAMETER DESCRIPTION
a

The family's named parameters.

TYPE: Mapping[str, object]

family

The family, for the diagnostic.

TYPE: str

RETURNS DESCRIPTION
float

The temperature parameter, or the default when absent.

RAISES DESCRIPTION
DistributionError

If the temperature is not a positive number.

Source code in src/quivers/qiec/reference_families.py
def relaxation_temperature(a: Mapping[str, object], family: str) -> float:
    """The temperature a relaxed family is constructed at.

    Parameters
    ----------
    a : Mapping[str, object]
        The family's named parameters.
    family : str
        The family, for the diagnostic.

    Returns
    -------
    float
        The ``temperature`` parameter, or the default when absent.

    Raises
    ------
    DistributionError
        If the temperature is not a positive number.
    """
    if "temperature" not in a:
        return RELAXATION_TEMPERATURE
    temperature = real_parameter(a, "temperature", family)
    if not temperature > 0.0:
        raise DistributionError(f"{family} needs a positive temperature")
    return temperature