gemseo / uncertainty / distributions

ot_dist module

Distributions based on OpenTURNS

Overview

The OTDistribution class is a concrete class inheriting from Distribution which is an abstract one. OT stands for OpenTURNS which is the library it relies on.

Similarly, the OTComposedDistribution class is a concrete class inheriting from ComposedDistribution which is an abstract one.

Construction

The OTDistribution of a given uncertain variable is built from mandatory arguments:

  • a variable name,

  • a distribution name recognized by OpenTURNS,

  • a set of parameters provided as a tuple of positional arguments filled in the order specified by the OpenTURNS constructor of this distribution.

Warning

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

The constructor has also optional arguments:

  • a variable dimension (default: 1),

  • a standard representation of these parameters (default: use the parameters provided in the tuple),

  • a transformation of the variable (default: no transformation),

  • lower and upper bounds for truncation (default: no truncation),

  • a threshold for the OpenTURNS truncation tool (more details).

Classical distributions

This module also implements a deliberately limited selection of standard probability distributions in a user-friendly way: OTExponentialDistribution, OTNormalDistribution, OTTriangularDistribution, and OTUniformDistribution. More precisely, the argument whose nature is a tuple of positional parameters is replaced with several user-defined keyword arguments. In this way, the use writes OTUniformDistribution('x', -1., 3.) or OTUniformDistribution('x', lower=-1., upper=3.) instead of OTDistribution('x', 'Normal', (-1., 3.)). Furthermore, these classes inheriting from OTDistribution are documented in such a way that a newbie could easily apprehend them.

class gemseo.uncertainty.distributions.ot_dist.OTDistribution(variable, distribution, parameters, dimension=1, standard_parameters=None, transformation=None, l_b=None, u_b=None, threshold=0.5)[source]

Bases: gemseo.uncertainty.distributions.distribution.Distribution

Interface to an OpenTURNS distribution.

Constructor

Parameters
  • variable (str) – variable name.

  • distribution (str) – distribution name.

  • parameters (tuple) – distribution parameters.

  • dimension (int) – variable dimension.

  • standard_parameters (dict) – standard parameters.

  • transformation (str) – standard variable transformation, e.g. ‘sin(x)’. If None, no transformation. Default: None.

  • l_b (float) – lower bound for truncation. If None, no lower truncation. Default: None.

  • u_b (float) – upper bound for truncation. If None, no upper truncation. Default: None.

  • threshold (float) – threshold value in [0,1].

COMPOSED_DISTRIBUTION

alias of gemseo.uncertainty.distributions.ot_cdist.OTComposedDistribution

cdf(vector)[source]

Evaluate the cumulative density function of the random variable marginals for a given instance.

Parameters

vector (array) – instance of the random variable.

Returns

cdf values

Return type

array

get_sample(n_samples=1)[source]

Get several samples.

Parameters

n_samples (int) – number of samples.

Returns

samples

Return type

list(array)

inverse_cdf(vector)[source]

Evaluate the inverses of the cumulative density functions of the random variable marginals for a given unit vector .

Parameters

vector (array) – vector of values comprised between 0 and 1 with same dimension as the random variable.

Returns

inverse cdf values

Return type

array

property mean

Get the mean of the random variable.

Returns

mean of the random variable.

Return type

array

property standard_deviation

Get the standard deviation of the random variable.

Returns

standard deviation of the random variable.

Return type

array

class gemseo.uncertainty.distributions.ot_dist.OTExponentialDistribution(variable, rate=1.0, loc=0.0, dimension=1, transformation=None, l_b=None, u_b=None, threshold=0.5)[source]

Bases: gemseo.uncertainty.distributions.ot_dist.OTDistribution

Create a exponential distribution.

Constructor.

Parameters
  • variable (str) – variable name.

  • rate (float) – rate parameter.

  • loc (float) – location parameter.

  • dimension (int) – dimension.

  • transformation (str) – standard variable transformation, e.g. ‘sin(x)’. If None, no transformation. Default: None.

  • l_b (float) – lower bound for truncation. If None, no lower truncation. Default: None.

  • u_b (float) – upper bound for truncation. If None, no upper truncation. Default: None.

  • threshold (float) – threshold value in [0,1].

class gemseo.uncertainty.distributions.ot_dist.OTNormalDistribution(variable, mu=0.0, sigma=1.0, dimension=1, transformation=None, l_b=None, u_b=None, threshold=0.5)[source]

Bases: gemseo.uncertainty.distributions.ot_dist.OTDistribution

Create a normal distribution.

Constructor.

Parameters
  • variable (str) – variable name.

  • mu (float) – mean.

  • sigma (float) – standard deviation.

  • dimension (int) – dimension.

  • transformation (str) – standard variable transformation, e.g. ‘sin(x)’. If None, no transformation. Default: None.

  • l_b (float) – lower bound for truncation. If None, no lower truncation. Default: None.

  • u_b (float) – upper bound for truncation. If None, no upper truncation. Default: None.

  • threshold (float) – threshold value in [0,1].

class gemseo.uncertainty.distributions.ot_dist.OTTriangularDistribution(variable, lower=0.0, mode=0.5, upper=1.0, dimension=1, transformation=None, l_b=None, u_b=None, threshold=0.5)[source]

Bases: gemseo.uncertainty.distributions.ot_dist.OTDistribution

Create a triangular distribution.

Constructor.

Parameters
  • variable (str) – variable name.

  • lower (float) – lower bound.

  • mode (float) – mode.

  • upper (float) – upper bound.

  • dimension (int) – dimension.

  • transformation (str) – standard variable transformation, e.g. ‘sin(x)’. If None, no transformation. Default: None.

  • l_b (float) – lower bound for truncation. If None, no lower truncation. Default: None.

  • u_b (float) – upper bound for truncation. If None, no upper truncation. Default: None.

  • threshold (float) – threshold value in [0,1].

class gemseo.uncertainty.distributions.ot_dist.OTUniformDistribution(variable, lower=0.0, upper=1.0, dimension=1, transformation=None, l_b=None, u_b=None, threshold=0.5)[source]

Bases: gemseo.uncertainty.distributions.ot_dist.OTDistribution

Create a uniform distribution.

Constructor.

Parameters
  • variable (str) – variable name.

  • lower (float) – lower bound.

  • upper (float) – upper bound.

  • dimension (int) – dimension.

  • transformation (str) – standard variable transformation, e.g. ‘sin(x)’. If None, no transformation. Default: None.

  • l_b (float) – lower bound for truncation. If None, no lower truncation. Default: None.

  • u_b (float) – upper bound for truncation. If None, no upper truncation. Default: None.

  • threshold (float) – threshold value in [0,1].