Skip to content

Interface overview

The public surface of Reactant.ProbProg is partitioned into four groups: modeling primitives, inference drivers, persistent state, and data types. The full signatures and semantics are documented in the API reference; the tables below are a quick index.

Modeling primitives

SymbolSignatureRole
samplesample(rng, dist; symbol)  /  sample(rng, f, args...; symbol, logpdf, support, bounds)Record a random choice from a distribution or user-defined sampler.
untraced_calluntraced_call(rng, f, args...)Execute a probabilistic function without recording its choices.
simulate  /  simulate_simulate(rng, f, args...)Forward-simulate a model; return its trace and prior log-density.
generate  /  generate_generate(rng, constraint, f, args...)Execute a model conditioned on observations; return the trace and log importance weight.

Inference

SymbolSignatureRole
mhmh(rng, trace, weight, f, args...; selection)One Metropolis-Hastings step regenerating the selected addresses.
mcmcmcmc(rng, trace, f, args...; selection, algorithm, num_samples, ...)Trace-based HMC or NUTS.
mcmc_logpdfmcmc_logpdf(rng, logdensity_fn, initial_position, args...; algorithm, ...)HMC or NUTS over a user-supplied log-density.
run_chainrun_chain(rng, logpdf_fn, initial_position, args...; num_warmup, num_samples, chunk_size, ...)Chunked chain driver with progress bar and resumable state.

State and persistence

SymbolSignatureRole
MCMCState(struct) position, gradient, potential_energy, step_size, inverse_mass_matrix, rngResume token returned by every inference entry point.
save_statesave_state(filename, state)Serialise an MCMCState to disk.
load_stateload_state(filename)Reload an MCMCState from disk.

Data types and distributions

SymbolRole
TraceExecuted-model record: choices, subtraces, retval, weight.
ConstraintDict-like Address → value mapping for observations.
AddressImmutable symbol path identifying a sample site.
SelectionOrdered set of addresses; constructed with select.
Normal  /  Exponential  /  LogNormal  /  BernoulliBuilt-in distributions, each carrying a static shape::Tuple and registered sampler / log-density.