gemseo / uncertainty / distributions / scipy

Hide inherited members

uniform module

The SciPy-based uniform distribution.

class gemseo.uncertainty.distributions.scipy.uniform.SPUniformDistribution(minimum=0.0, maximum=1.0)[source]

Bases: SPDistribution

The SciPy-based uniform distribution.

Examples

>>> from gemseo.uncertainty.distributions.scipy.uniform import (
...     SPUniformDistribution,
... )
>>> distribution = SPUniformDistribution(-1, 1)
>>> print(distribution)
uniform(lower=-1, upper=1)

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

Parameters:
  • minimum (float) –

    The minimum of the uniform random variable.

    By default it is set to 0.0.

  • maximum (float) –

    The maximum of the uniform random variable.

    By default it is set to 1.0.

JOINT_DISTRIBUTION_CLASS

alias of SPJointDistribution

compute_cdf(value)

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)

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, random_state=None)

Sample the random variable.

Parameters:
  • n_samples (int) –

    The number of samples.

    By default it is set to 1.

  • random_state (None | int | Generator | RandomState) – The SciPy random state.

Returns:

The samples of the random variable.

Return type:

RealArray

plot(show=True, save=False, file_path='', directory_path='', file_name='', file_extension='')

Plot both probability and cumulative density functions.

Parameters:
  • save (bool) –

    Whether to save the figure.

    By default it is set to False.

  • show (bool) –

    Whether to display the figure.

    By default it is set to True.

  • file_path (str | Path) –

    The path of the file to save the figure. If the extension is missing, use file_extension. If empty, create a file path from directory_path, file_name and file_extension.

    By default it is set to “”.

  • directory_path (str | Path) –

    The path of the directory to save the figures. If empty, use the current working directory.

    By default it is set to “”.

  • file_name (str) –

    The name of the file to save the figures. If empty, use a default one generated by the post-processing.

    By default it is set to “”.

  • file_extension (str) –

    A file extension, e.g. 'png', 'pdf', 'svg', … If empty, use a default file extension.

    By default it is set to “”.

Returns:

The figure.

Return type:

Figure

DEFAULT_VARIABLE_NAME: Final[str] = 'x'

The default name of the variable.

distribution: _DistributionT

The probability distribution of the random variable.

math_lower_bound: _VariableT

The mathematical lower bound of the random variable.

math_upper_bound: _VariableT

The mathematical upper bound of the random variable.

property mean: float

The expectation of the random variable.

num_lower_bound: _VariableT

The numerical lower bound of the random variable.

num_upper_bound: _VariableT

The numerical upper bound of the random variable.

property range: RealArray

The numerical range.

The numerical range is the interval defined by the lower and upper bounds numerically reachable by the random variable.

property standard_deviation: float

The standard deviation of the random variable.

property support: RealArray

The mathematical support.

The mathematical support is the interval defined by the theoretical lower and upper bounds of the random variable.

transformation: str

The transformation applied to the random variable noted "x".

E.g. "sin(x)".