SALib.sample.shapley module#

SALib.sample.shapley.cli_action(args)[source]#

Generate a Shapley trajectory design from command-line arguments.

SALib.sample.shapley.sample(problem: dict, N: int, seed: int | Generator | None = None) → ndarray[source]#

Generate inputs for Goda’s Shapley effects estimator.

The method draws two independent input vectors for each Monte Carlo replication. A random permutation then defines a trajectory that replaces one coordinate at a time from the first vector with the corresponding coordinate from the second. The resulting matrix contains N * (D + 1) rows and D columns.

Results from these model inputs are intended to be used with SALib.analyze.shapley.analyze().

Notes

Goda’s estimator assumes mutually independent input variables. SALib problem definitions specify marginal distributions, so this sampler draws every input independently. Grouped parameters are not supported.

Parameters:
  • problem (dict) – The problem definition.

  • N (int) – Number of independent Monte Carlo trajectories. The model is evaluated N * (D + 1) times.

  • seed ({None, int, numpy.random.Generator}, optional) – Seed or random generator used to draw the sample and permutations.

Returns:

Model inputs arranged as N consecutive trajectories.

Return type:

numpy.ndarray

References

  1. Goda, T. (2021). A simple algorithm for global sensitivity analysis with Shapley effects. Reliability Engineering & System Safety, 213, 107702. https://doi.org/10.1016/j.ress.2021.107702