gemseo / uncertainty / distributions

Show inherited members

composed module

Joint probability distribution.

Overview

ComposedDistribution is an abstract class implementing the concept of joint probability distribution.

The joint probability distribution of a set of random variables is the probability distribution of the random vector consisting of these random variables.

It takes into account both the marginal probability distributions of these random variables and their dependency structure.

A ComposedDistribution is defined from a list of Distribution instances defining the marginals of the random variables and a copula defining the dependency structure between them.

Note

A copula is a mathematical function used to define the dependence between random variables from their cumulative density functions. See more.

By definition, a joint probability distribution is a probability distribution Therefore, ComposedDistribution inherits from the abstract class Distribution.

Construction

The ComposedDistribution of a list of given uncertain variables is built from a list of Distribution objects implementing the probability distributions of these variables and from a copula.

Capabilities

Because ComposedDistribution inherits from Distribution, we can easily get statistics, such as ComposedDistribution.mean, ComposedDistribution.standard_deviation. We can also get the numerical ComposedDistribution.range and mathematical ComposedDistribution.support.

Note

We call mathematical support the set of values that the random variable can take in theory, e.g. \(]-\infty,+\infty[\) for a Gaussian variable, and numerical range the set of values that it can take in practice, taking into account the values rounded to zero double precision. Both support and range are described in terms of lower and upper bounds

We can also evaluate the cumulative density function (ComposedDistribution.compute_cdf()) for the different marginals of the random variable, as well as the inverse cumulative density function (ComposedDistribution.compute_inverse_cdf()). We can plot them, either for a given marginal (ComposedDistribution.plot()) or for all marginals (ComposedDistribution.plot_all()).

Lastly, we can compute realizations of the random variable by means of the ComposedDistribution.compute_samples() method.

class gemseo.uncertainty.distributions.composed.ComposedDistribution(distributions, copula=None, variable='')[source]

Bases: Distribution

Joint probability distribution.

Parameters:
  • distributions (Sequence[Distribution]) – The marginal distributions.

  • copula (Any) – A copula distribution defining the dependency structure between random variables; if None, consider an independent copula.

  • variable (str) –

    The name of the variable, if any; otherwise, concatenate the names of the random variables defined by distributions.

    By default it is set to “”.

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,

The number of columns is equal to the dimension of the variable and the number of lines is equal to the number of samples.

Return type:

ndarray

dimension: int

The number of dimensions of the random variable.

distribution: type

The probability distribution of the random variable.

distribution_name: str

The name of the probability distribution.

marginals: list[type]

The marginal distributions of the components of the random variable.

math_lower_bound: ndarray

The mathematical lower bound of the random variable.

math_upper_bound: ndarray

The mathematical upper bound of the random variable.

property mean: ndarray

The analytical mean of the random variable.

num_lower_bound: ndarray

The numerical lower bound of the random variable.

num_upper_bound: ndarray

The numerical upper bound of the random variable.

parameters: tuple[Any] | dict[str, Any]

The parameters of the probability distribution.

property standard_deviation: ndarray

The analytical standard deviation of the random variable.

standard_parameters: dict[str, str] | None

The standard representation of the parameters of the distribution, used for its string representation.

transformation: str

The transformation applied to the random variable, e.g. ‘sin(x)’.

variable_name: str

The name of the random variable.