Univariate Distribution#

Module with an implementation of the UnivDist class.

The UnivDist class represents a univariate random variable. Each random variable has a (parametric) probability distribution.

class uqtestfuns.core.prob_input.univariate_distribution.UnivDist(distribution: str, parameters: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]], name: Optional[str] = None, description: Optional[str] = None, rng_seed: Optional[int] = None)#

A class for univariate random variables.

Parameters
  • distribution (str) – The type of the probability distribution

  • parameters (ArrayLike) – The parameters of the chosen probability distribution

  • name (str, optional) – The name of the random variable

  • description (str, optional) – The short text description of the random variable

  • rng_seed (int, optional.) – The seed used to initialize the pseudo-random number generator. If not specified, the value is taken from the system entropy.

lower#

The lower bound of the distribution

Type

float

upper#

The upper bound of the distribution

Type

float

_rng#

The default pseudo-random number generator of NumPy. The generator is only created if or when needed (e.g., generating a random sample from the distribution).

Type

Generator

cdf(xx: Union[float, numpy.ndarray]) numpy.ndarray[Any, numpy.dtype[numpy.float64]]#

Compute the CDF of the distribution on a set of values.

The function transforms the sample values in the domain of the distribution to the [0, 1] domain.

classmethod from_spec(marginal_spec: uqtestfuns.core.prob_input.input_spec.UnivDistSpec, rng_seed: Optional[int] = None)#

Create an instance of UnivDist from a marginal specification.

Parameters
  • marginal_spec (UnivDistSpec) – The specification for the univariate marginal.

  • rng_seed (int, optional) – The seed used to initialize the pseudo-random number generator. If not specified, the value is taken from the system entropy.

get_sample(sample_size: int = 1) numpy.ndarray#

Get a random sample from the distribution.

icdf(xx: Union[float, numpy.ndarray]) numpy.ndarray[Any, numpy.dtype[numpy.float64]]#

Compute the inverse CDF of the distribution on a set of values.

The function transforms values in the [0,1] domain to the domain of the distribution.

pdf(xx: Union[float, numpy.ndarray]) numpy.ndarray[Any, numpy.dtype[numpy.float64]]#

Compute the PDF of the distribution on a set of values.

reset_rng(rng_seed: Optional[int]) None#

Reset the random number generator.

Parameters

rng_seed (int, optional.) – The seed used to initialize the pseudo-random number generator. If not specified, the value is taken from the system entropy.

transform_sample(xx: Union[float, numpy.ndarray], other: uqtestfuns.core.prob_input.univariate_distribution.UnivDist) numpy.ndarray#

Transform a sample from a given distribution to another.