gemseo.uncertainty.distributions.openturns.distribution module#

The interface to OpenTURNS-based probability distributions.

class OTDistribution(interfaced_distribution='Uniform', parameters=(), standard_parameters=mappingproxy({}), transformation='', lower_bound=None, upper_bound=None, threshold=0.5)[source]#

Bases: BaseDistribution[float, tuple[Any, ...], DistributionImplementation], ScalarDistributionMixin

An OpenTURNS-based probability distribution.

Warning

The probability distribution parameters must be provided according to the signature of the OpenTURNS classes. Access the OpenTURNS documentation.

Examples

>>> from gemseo.uncertainty.distributions.openturns.distribution import (
...     OTDistribution,
... )
>>> distribution = OTDistribution("Exponential", (3, 2))
>>> print(distribution)
Exponential(3, 2)

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • interfaced_distribution (str) --

    The name of the probability distribution, typically the name of a class wrapped from an external library, such as "Normal" for OpenTURNS or "norm" for SciPy.

    By default it is set to "Uniform".

  • parameters (tuple[Any, ...]) --

    The parameters of the probability distribution.

    By default it is set to ().

  • standard_parameters (StandardParametersType) --

    The parameters of the probability distribution used for string representation only (use parameters for computation). If empty, use parameters instead. For instance, let us consider the interfaced OpenTURNS distribution "Dirac". Then, the string representation of OTDistribution("x", "Dirac", (1,), 1, {"loc": 1}) is "Dirac(loc=1)" while the string representation of OTDistribution("x", "Dirac", (1,)) is "Dirac(1)".

    By default it is set to {}.

  • transformation (str) --

    A transformation applied to the random variable, e.g. \(\sin(x)\). If empty, no transformation.

    By default it is set to "".

  • lower_bound (float | None) -- A lower bound to truncate the probability distribution. If None, no lower truncation.

  • upper_bound (float | None) -- An upper bound to truncate the probability distribution. If None, no upper truncation.

  • threshold (float) --

    A threshold in [0,1] (see OpenTURNS documentation).

    By default it is set to 0.5.

JOINT_DISTRIBUTION_CLASS#

alias of OTJointDistribution

compute_cdf(value)[source]#

Evaluate the cumulative density function (CDF).

Parameters:

value (float) -- The value of the random variable for which to evaluate the CDF.

Returns:

The value of the CDF.

Return type:

float

compute_inverse_cdf(value)[source]#

Evaluate the inverse cumulative density function (ICDF).

Parameters:

value (float) -- The probability for which to evaluate the ICDF.

Returns:

The value of the ICDF.

Return type:

float

compute_samples(n_samples=1)[source]#

Sample the random variable.

Parameters:

n_samples (int) --

The number of samples.

By default it is set to 1.

Returns:

The samples of the random variable.

Return type:

RealArray

property mean: float#

The expectation of the random variable.

property standard_deviation: float#

The standard deviation of the random variable.