mixle.doe.sensitivity module¶
Global sensitivity analysis: variance-based Sobol indices and Morris screening.
Which inputs actually drive a model’s output? Sobol indices decompose the output variance into the contribution of each input (first order) and of each input including all its interactions (total order). Morris screening is a cheaper one-at-a-time elementary-effects method for an initial factor ranking. These tell you which survey parameters / forcings to refine and which to fix – the front of the UQ loop.
- sobol_indices(func, bounds, n=4096, *, seed=0, names=None)[source]
First- and total-order Sobol sensitivity indices (Saltelli sampling, Jansen estimators).
- Parameters:
func (Callable[[ndarray], ndarray]) – a vectorized model
f(X) -> ymapping an(m, d)array of inputs to an(m,)array of scalar outputs.bounds (Sequence[tuple[float, float]]) –
[(lo, hi), ...]per input – the input is taken uniform on the box.n (int) – base sample size; the total number of model evaluations is
n * (d + 2).seed (int) – RNG seed for the (Sobol) base samples.
names (Sequence[str] | None) – optional input names for the returned dict.
- Returns:
{'S1': (d,), 'ST': (d,), 'names': [...], 'var': float}– first-orderS1[i]is the fraction of output variance from inputialone; total-orderST[i]includes all interactions involvingi(soST[i] - S1[i]measuresi’s interaction strength, andST[i] ~ 0means inputican be fixed).- Return type:
- morris_screening(func, bounds, *, trajectories=20, levels=4, seed=0, names=None)[source]
Morris elementary-effects screening – a cheap first factor ranking.
Walks
trajectoriesone-factor-at-a-time paths on alevels-grid; the mean absolute elementary effectmu_star[i]ranks influence and the spreadsigma[i]flags nonlinearity/interactions. Cost:trajectories * (d + 1)evaluations – far fewer than Sobol, for an initial screen.
- fast_indices(func, bounds, n=600, *, harmonics=6, seed=0, names=None)[source]
First-order sensitivity indices via Random Balance Designs FAST (RBD-FAST).
A Fourier alternative to
sobol_indices()for the first-order indices: every input is driven along the same triangle-wave search curve but under an independent random permutation, the model is evaluated once over thenpoints, and for each input the output – reordered along that input’s curve – has its variance concentrated at the base frequency’s firstharmonicsharmonics. The ratio of that power to the total is the first-order index (with the Tarantola bias correction). Cost is a single batch ofnevaluations, independent of dimension.Returns
{'S1': (d,), 'names': [...], 'var': float}.
- dgsm(func, bounds, n=1024, *, seed=0, rel_step=1.0e-4, names=None)[source]
Derivative-based global sensitivity measures (DGSM): mean squared partial derivatives.
nu[i] = E[(df/dx_i)^2]over the input box, estimated by central finite differences atnlow-discrepancy points. Unlike the first-order Sobol index, a DGSM is nonzero whenever an input matters anywhere – including purely through interactions – so it is a cheap, robust screen that upper-bounds the total Sobol index (Sobol & Kucherenko, via the Poincare inequality:ST[i] <= (L_i / pi)^2 * nu[i] / Var(y)for a uniform input of widthL_i). The reportedimportanceisL_i^2 * nu[i]normalized to sum to one – a dimensionless influence ranking.Returns
{'nu': (d,), 'importance': (d,), 'names': [...]}.