Abstract Base Classes#

This module provides abstract base classes for defining a test function class.

UQTestFunBareABC Abstract Base Class#

class uqtestfuns.core.uqtestfun_abc.UQTestFunBareABC(prob_input: uqtestfuns.core.prob_input.probabilistic_input.ProbInput, parameters: Optional[Any] = None, name: Optional[str] = None)#

An abstract class for a bare UQ test functions.

Parameters
  • prob_input (ProbInput) – The probabilistic input model of the UQ test function.

  • parameters (Any, optional) – A set of parameters. By default, it is None.

  • name (str, optional) – The name of the UQ test function. By default, it is None.

Notes

  • A bare UQ test function only includes the evaluation function, probabilistic input model, parameters, and a (optional) name.

abstract evaluate(*args)#

Abstract method for the implementation of the UQ test function.

property name: Optional[str]#

The name of the UQ test function.

property parameters: Any#

The parameters of the UQ test function.

property prob_input: uqtestfuns.core.prob_input.probabilistic_input.ProbInput#

The probabilistic input model of the UQ test function.

property spatial_dimension: int#

The spatial dimension of the UQ test function.

transform_sample(xx: numpy.ndarray, min_value=- 1.0, max_value=1.0) numpy.ndarray#

Transform sample values from a unif. domain to the func. domain

Parameters
  • xx (np.ndarray) – Sampled input values (realizations) in a uniform bounded domain. By default, the uniform domain is [-1.0, 1.0].

  • min_value (float, optional) – Minimum value of the uniform domain. Default value is -1.0.

  • max_value (float, optional) – Maximum value of the uniform domain. Default value is 1.0.

Returns

Transformed sampled values from the specified uniform domain to the domain of the function as defined the input property.

Return type

np.ndarray

UQTestFunABC Abstract Base Class#

class uqtestfuns.core.uqtestfun_abc.UQTestFunABC(*, spatial_dimension: Optional[int] = None, prob_input_selection: Optional[str] = None, parameters_selection: Optional[str] = None, name: Optional[str] = None)#

An abstract class for (published) UQ test functions.

Parameters
  • spatial_dimension (int, optional) – The spatial dimension of the UQ test function. This is used only when the function supports variable dimension; otherwise, if specified, an exception is raised. In the case of functions with variable dimension, the default dimension is set to 2. This is a keyword only parameter.

  • prob_input_selection (str, optional) – The selection of probabilistic input model; this is used when there are multiple input specifications in the literature. This is a keyword only parameter.

  • parameters_selection (str, optional) – The selection of parameters set; this is used when there are multiple sets of parameters available in the literature. This is a keyword only parameter.

  • name (str, optional) – The name of the UQ test function. If not given, None is used as name. This is a keyword only parameter.

Notes

  • A published UQ test function includes a couple of additional metadata, namely tags and description.

Raises
  • KeyError – If selection is not in the list of available inputs and parameters.

  • TypeError – If spatial dimension is specified for a UQ test function with a fixed dimension.

property available_inputs: Union[Dict[str, uqtestfuns.core.prob_input.input_spec.ProbInputSpecFixDim], Dict[str, uqtestfuns.core.prob_input.input_spec.ProbInputSpecVarDim]]#

All the keys to the available probabilistic input specifications.

property available_parameters: Optional[Dict[str, Any]]#

All the keys to the available set of parameter values.

property default_spatial_dimension: Optional[int]#

To store the default dimension of a test function.

property description: Optional[str]#

Short description of the UQ test function.

abstract static eval_(*args)#

Static method for the concrete function implementation.

Notes

  • The function evaluation is implemented as a static method so the function can be added without being bounded to the instance.

evaluate(xx)#

Concrete implementation, actual function is delegated to eval_().

property tags: List[str]#

Tags to classify different UQ test functions.