aryagraph.sim.run_ensemble#
- aryagraph.sim.run_ensemble(fn: Callable[[...], SimulationResult], runs: int = 100, *, seed: int | None = None, n_points: int = 101, quantiles: Sequence[float] = (5, 25, 50, 75, 95), interpolation: str = 'step', keep: bool = False, **kwargs: Any) EnsembleResult[source]#
Run
fn(**kwargs, seed=...)runs times and summarise the state counts.- Parameters:
fn – Any function returning a categorical
SimulationResultand taking aseedkeyword, such asaryagraph.sim.sir(),SIR(0.3, 0.1).simulateoraryagraph.sim.independent_cascade().runs – Number of independent runs.
seed – Master seed. Child seeds come from
numpy.random.SeedSequence(seed).spawn(as 64-bit integers, so every run can be replayed on its own), which makes the runs statistically independent and the ensemble reproducible.n_points – Size of the common time grid, which spans the longest run.
interpolation –
"step"(default) holds each count until the next frame, which is exact for jump processes such as Gillespie runs or discrete steps;"linear"interpolates between frames. After its last frame a run keeps its final counts (absorbing states persist).keep – Also return every individual result (memory grows with runs).
**kwargs – Passed to fn (
g=...for the graph).