aquakin.monte_carlo#
- aquakin.monte_carlo(fn, distributions, *, input_names=None, output_names=None, n_samples=128, sampler='sobol', seed=0, batched=True)[source]#
Propagate uncertain inputs through
fnand return the output ensemble.- Parameters:
fn (callable) –
fn(x) -> outputmapping an input vectorx(shape(d,), in the order ofdistributions) to a scalar or(m,)vector output. As inaquakin.dgsm(),fnbuilds the params / initial state and runs the solve itself.distributions (mapping or sequence) – One distribution per input, either a
name -> specmapping (then the keys are the input names) or a sequence of specs. Each spec is a(low, high)tuple (uniform) or a mapping{"dist": ...}–uniform(low, high),normal(mean, std)orlognormal(mean, std)(mean / std in physical space).input_names (sequence of str, optional) – Names for the input columns (defaults to the mapping keys or
z0..) and output columns (defaults tooutput/y0..).output_names (sequence of str, optional) – Names for the input columns (defaults to the mapping keys or
z0..) and output columns (defaults tooutput/y0..).n_samples (int) – Number of points to draw. For
sampler='sobol'it is rounded to the nearest power of two.sampler ({'sobol', 'lhs', 'random'}) – Low-discrepancy scrambled Sobol (default), Latin hypercube, or plain pseudo-random. Sampling is in the unit cube and mapped to the marginals by inverse-transform, so non-uniform inputs still get a good design.
seed (int) – Sampler seed; fixing it makes the result reproducible.
batched (bool) – Evaluate the whole sample through one
jax.vmap()(default) or one call per point (lower peak memory).
- Return type: