Skip to content

Internal API

Documentation for ComposableTuringIDModels's unexported internal helpers and supertypes. These are not part of the stable public API; they are documented because the public docstrings cross-reference them.

Index

ComposableTuringIDModels.ARStep Type

Autoregressive step for use with accumulate_scan.

source
ComposableTuringIDModels.AbstractAccumulationStep Type

Abstract supertype for accumulation step structs used with accumulate_scan.

A concrete AbstractAccumulationStep is a callable (step)(state, ϵ) returning the next state. It is backend-agnostic: it contains no Turing/DynamicPPL machinery and is reused unchanged across model components (RandomWalk, AR, MA, LatentDelay).

source
ComposableTuringIDModels.AbstractBroadcastRule Type

Abstract supertype for broadcast rules used by BroadcastLatentModel. A rule defines broadcast_n (how long an inner series to generate) and broadcast_rule (how to expand it to length n).

source
ComposableTuringIDModels.AbstractConstantRenewalStep Type

Abstract supertype for renewal accumulation steps (constant generation interval, with or without susceptible depletion).

source
ComposableTuringIDModels.AbstractIDMethod Type

Abstract supertype for inference / generative-modelling methods.

source
ComposableTuringIDModels.AbstractIDSamplingMethod Type

Abstract supertype for sampling-based methods (e.g. NUTS).

source
ComposableTuringIDModels.AbstractRenewalModifier Type

Abstract supertype for renewal modifiers used with ComposedRenewalStep.

A modifier transforms the proposed new incidence and carries its own substate across the scan. Concrete modifiers implement

  • modifier_init_state(mod) — the modifier's initial substate.

  • apply_modifier(mod, incidence, substate) — return (new_incidence, new_substate).

source
ComposableTuringIDModels.ComposedRenewalStep Type

A renewal accumulation step assembled from a force-of-infection core (a ConstantRenewalStep) and a tuple of modifiers (AbstractRenewalModifiers), sharing one incidence window.

Its state is [window, substate₁, …, substateₙ]: the incidence window followed by one substate per modifier. Each step computes the core force of infection, threads it through the modifiers (each transforming the incidence and updating its own substate), then advances the shared window once with the final incidence.

ComposedRenewalStep(ConstantRenewalStep(g), (SusceptibleDepletion(N),)) reproduces ConstantRenewalWithPopulationStep(g, N); this equivalence is the acceptance test for the composable contract (#48).

source
ComposableTuringIDModels.ConstantRenewalStep Type

Renewal step with a constant generation interval (stored reversed).

source
ComposableTuringIDModels.ConstantRenewalWithPopulationStep Type

Renewal step with a constant generation interval and a fixed population (with susceptible depletion).

source
ComposableTuringIDModels.LDStep Type

LatentDelay step for use with accumulate_scan.

source
ComposableTuringIDModels.MAStep Type

Moving-average step for use with accumulate_scan.

source
ComposableTuringIDModels.RWStep Type

Random walk step for use with accumulate_scan.

source
ComposableTuringIDModels.SafeIntValued Type

A value-support tag for real-valued count distributions whose eltype must stay integer-typed inside a Turing model even when rand is called.

source
ComposableTuringIDModels.SusceptibleDepletion Type

Susceptible-depletion modifier for ComposedRenewalStep.

Scales the proposed incidence by the available susceptible fraction and depletes the susceptible pool,

with population size = pop_size. Its substate is the current susceptible count . Composing it over a ConstantRenewalStep reproduces ConstantRenewalWithPopulationStep exactly.

source
ComposableTuringIDModels._expand_dist Function

Expand a vector of distributions into a single product distribution.

If every element of dist is equal, a filldist is returned for efficiency; otherwise an arraydist over the heterogeneous vector is returned.

source
ComposableTuringIDModels.neg_MGF Function

Negative moment generating function of a discrete generation interval w at rate r: .

Arguments

  • r: the exponential growth rate.

  • w: the discrete generation interval weights.

Examples

@example
using ComposableTuringIDModels
ComposableTuringIDModels.neg_MGF(0.1, [0.2, 0.3, 0.5])
source
ComposableTuringIDModels.remake_ode_problem Function

Rebuild an ODEProcess's ODEProblem with freshly sampled state u0 and parameters p.

This is the single seam through which ODEProcess re-instantiates its problem on every sample. The default applies the plain-vector remake(prob; u0, p) that the hand-coded SIRParams / SEIRParams problems expect.

Parameter models whose problem stores parameters differently — e.g. a ModelingToolkit/Catalyst-built problem carrying a structured MTKParameters object plus an initialization system — specialise this on their own type to inject the remake form they need. The Catalyst extension uses the plain-vector build_initializeprob = false path to bypass the init system (and stay reverse-mode differentiable). Dispatching on the parameter model keeps ODEProcess itself backend-agnostic.

Arguments

  • params: the ODE parameter model (the ODEProcess's params field).

  • prob: the template ODEProblem to rebuild.

  • u0: the sampled initial state vector.

  • p: the sampled parameter vector.

source
ComposableTuringIDModels.renewal_foi Function

Force of infection for a constant-generation-interval renewal step: the reproduction number times the convolution of the recent incidence window with the (reversed) generation interval,

This is the raw new-incidence term before any modifier (e.g. susceptible depletion) is applied. It is shared by ConstantRenewalStep and the composable ComposedRenewalStep so the two cannot drift.

source