Parameter samples

Value sets and ranges

class Range(vmin=0, vmax=1, vdef=None)[source]

A range of parameter values that can be used to create a Sample.

Parameters
  • vmin (float, optional) – Minimum value for this parameter (default 0).

  • vmax (float, optional) – Maximum value for this parameter (default 1).

  • vdef (float, optional) – Default value. Default value. If none is passed, vmin is used.

class IntRange(vmin=0, vmax=1, vdef=None)[source]

A range of integer parameter values that can be used to create a Sample. Similar to Range, but sampled values will be rounded and converted to integer.

Parameters
  • vmin (int, optional) – Minimum value for this parameter (default 0).

  • vmax (int, optional) – Maximum value for this parameter (default 1).

  • vdef (int, optional) – Default value. If none is passed, vmin is used.

class Values(*args, vdef=None)[source]

A pre-defined set of discrete parameter values that can be used to create a Sample.

Parameters
  • *args – Possible values for this parameter.

  • vdef – Default value. If none is passed, the first passed value is used.

Sample generation

class Sample(parameters, n=None, method='linspace', randomize=True, **kwargs)[source]

A sequence of parameter combinations that can be used for Experiment.

Parameters
  • parameters (dict) – Dictionary of parameter keys and values. Entries of type Range and Values will be sampled based on chosen method and n. Other types wil be interpreted as constants.

  • n (int, optional) – Sampling factor used by chosen method (default None).

  • method (str, optional) –

    Method to use to create parameter combinations from entries of type Range. Options are:

    • linspace (default): Arange n evenly spaced values for each Range and combine them with given Values and constants. Additional keyword arguments:

      • product (bool, optional): Return all possible combinations (default True). If False, value sets are ‘zipped’ so that the i-th parameter combination contains the i-th entry of each value set. Requires all value sets to have the same length.

    • saltelli: Apply Saltelli’s sampling scheme, using SALib.sample.saltelli.sample() with N=n. This enables the analysis of Sobol Sensitivity Indices with DataDict.calc_sobol() after the experiment. Additional keyword arguments:

      • calc_second_order (bool, optional): Whether to calculate second-order indices (default True).

  • randomize (bool, optional) – Whether to use the constant parameter ‘seed’ to generate different random seeds for every parameter combination (default True). If False, every parameter combination will have the same seed. If there is no constant parameter ‘seed’, this option has no effect.

  • **kwargs – Additional keyword arguments for chosen method.