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.extend_bounds(problem)[source]#
Extends the problem bounds to the nearest power of two.
- Parameters:
problem (dict) – The problem definition
- SALib.sample.ff.find_smallest(num_vars)[source]#
Find the smallest exponent of two that is greater than the number of variables.
- SALib.sample.ff.generate_contrast(problem)[source]#
Generates the raw sample from the problem file.
- Parameters:
problem (dict) – The problem definition
- SALib.sample.ff.sample(problem, seed: int | Generator | None = None)[source]#
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_0required 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
Generatorinstance is used, seeded with seed. If seed is already aGeneratorinstance then that instance is used. Default is None.
- Returns:
sample
- Return type:
numpy.array
References
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