Budgets, initialization and stopping
Make the run controls reproducible while keeping prior assumptions in the model.
Set a budget appropriate to the route
ComputeBudget records draws, warmup, chains, iteration and wall-clock limits where applicable. None means a knob is unspecified; it is not zero. Not every task can honor every control. Read the compiler's refusal when a required control has no implementation.
Compose a posterior request
from bayesmith.artifacts import (
ComputeBudget, DiagnosticPolicy, InitializationPolicy,
PosteriorTask, StoppingPolicy, new_task_meta,
)
task = PosteriorTask(
meta=new_task_meta(label="production posterior"),
budget=ComputeBudget(draws=2000, warmup=1000, chains=4),
diagnostics=DiagnosticPolicy(max_parameters=64),
initialization=InitializationPolicy(max_attempts=32),
stopping=StoppingPolicy(mode="fixed"),
)The bounded diagnostic preflight can report structural and geometric concerns. Partial initial values are represented as named arrays and masks; they do not redefine the prior. Setting initialization=None retains the legacy NumPyro initializer.
Separate a budget stop from convergence
Fixed-budget sampling is the default. Checkpoint stopping can inspect cumulative diagnostics on one warmed NUTS/HMCGibbs state, with minimum draws, batch sizes and consecutive successful checks. Consult StoppingPolicy for supported modes and fields before enabling it.
A run should preserve actual draw counts, initial values, diagnostics and stop reasons. Never infer convergence from the fact that the maximum budget was used. A failure to meet required convergence can be an execution error.
Declare proposal correction explicitly
ProposalBlockPolicy describes an ordered block proposal; proposal_options serializes it into bounded task options. The default mh_correction=True accounts for both forward and reverse proposal densities against the full target. False marks the schedule approximate; applied proposals and MH acceptances are then different quantities.
Dense-work controls such as parameter and matrix-element limits are material: a locally Gaussian proposal may require expensive factorizations even if the graph itself is compact. See diagnostics before interpreting acceptance as a model check.