DiscreteSampling

class farn.sampling.sampling.DiscreteSampling(seed: int | None = None)

Bases: object

Class providing methods to run a discrete sampling of a specific layer, i.e. of all variables defined in the given layer.

__init__(seed: int | None = None) None

Methods

__init__([seed])

generate_samples()

Return a dict with all generated samples for the layer this sampling is run on.

set_sampling_parameters(sampling_parameters)

Set the sampling parameters.

set_sampling_type(sampling_type)

Set the sampling type.

generate_samples() dict[str, list[Any]]

Return a dict with all generated samples for the layer this sampling is run on.

The first element in the returned dict contains the case names generated. All following elements (second to last) contain the values sampled for each variable defined in the layer this sampling is run on. I.e. “names”: (case_name_1, case_name_2, .., case_name_n) “variable_1”: (value_1, value_2, .., value_n) … “variable_m”: (value_1, value_2, .., value_n)

Returns:

the dict with all generated samples

Return type:

Dict[str, List[Any]]

set_sampling_parameters(sampling_parameters: Mapping[str, Any], layer_name: str = '') None

Set the sampling parameters.

The passed-in sampling parameters will be validated. Upon successful validation, the sampling is configured using the provided parameters.

set_sampling_type(sampling_type: str) None

Set the sampling type.

Valid values:

“fixed” “linSpace” “uniformLhs” “normalLhs” “sobol” “arbitrary” “hilbertCurve”