Skip to main content
`Ctrl`+`K`

# SALib.sample.ff module

The sampling implementation of fractional factorial method

This implementation is based on the formulation put forward in [Saltelli et al. 2008]

SALib.sample.ff.cli_action(args)

  Run sampling method

  Parameters:

    args (argparse namespace)

SALib.sample.ff.extend_bounds(problem)

  Extends the problem bounds to the nearest power of two.

  Parameters:

    problem (dict) – The problem definition

SALib.sample.ff.find_smallest(num_vars)

  Find the smallest exponent of two that is greater than the number of variables.

  Parameters:

    num_vars (int) – Number of variables

  Returns:

    x – Smallest exponent of two greater than num_vars

  Return type:

    int

SALib.sample.ff.generate_contrast(problem)

  Generates the raw sample from the problem file.

  Parameters:

    problem (dict) – The problem definition

SALib.sample.ff.sample(problem, seed: int | Generator | None = None)

  Generates model inputs using a fractional factorial sample.

  Returns a NumPy matrix containing the model inputs required for a fractional factorial analysis. The resulting matrix has D columns, where D is smallest power of 2 that is greater than the number of parameters. These model inputs are intended to be used with `SALib.analyze.ff.analyze()`.

  The problem file is padded with a number of dummy variables called `dummy_0` required for this procedure. These dummy variables can be used as a check for errors in the analyze procedure.

  This algorithm is an implementation of that contained in Saltelli et al [Saltelli et al. 2008]

  Parameters:

    - problem (dict) – The problem definition

    - seed ({None, int, numpy.random.Generator}, optional) – If seed is None the numpy.random.Generator generator is used. If seed is an int, a new `Generator` instance is used, seeded with seed. If seed is already a `Generator` instance then that instance is used. Default is None.

  Returns:

    sample

  Return type:

    `numpy.array`

  References

  1. Saltelli, A., Ratto, M., Andres, T., Campolongo, F., Cariboni, J., Gatelli, D., Saisana, M., Tarantola, S., 2008. Global Sensitivity Analysis: The Primer. Wiley, West Sussex, U.K. http://doi.org/10.1002/9780470725184