Probabilistic Input#

Module with an implementation of ProbInput class.

The ProbInput class represents a probabilistic input model. Each probabilistic input has a set of one-dimensional marginals each of which is defined by an instance of the UnivDist class.

class uqtestfuns.core.prob_input.probabilistic_input.ProbInput(marginals: Union[List[uqtestfuns.core.prob_input.univariate_distribution.UnivDist], Tuple[uqtestfuns.core.prob_input.univariate_distribution.UnivDist, ...]], copulas: Optional[Any] = None, name: Optional[str] = None, description: Optional[str] = None, rng_seed: Optional[int] = None)#

A class for multivariate input variables.

Parameters
  • marginals (Union[List[UnivDist], Tuple[UnivDist, ...]]) – A list of one-dimensional marginals (univariate random variables).

  • copulas (Any) – Copulas between univariate inputs that define dependence structure (currently not used).

  • name (str, optional) – The name of the probabilistic input model.

  • description (str, optional) – The short description regarding the input model.

  • 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.

spatial_dimension#

Number of constituents (random) input variables.

Type

int

_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

classmethod from_spec(prob_input_spec: Union[uqtestfuns.core.prob_input.input_spec.ProbInputSpecFixDim, uqtestfuns.core.prob_input.input_spec.ProbInputSpecVarDim], *, spatial_dimension: Optional[int] = None, rng_seed: Optional[int] = None)#

Create an instance from a ProbInputSpec instance.

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

Get a random sample from the distribution.

Parameters

sample_size (int) – The number of sample points in the generated sample.

Returns

The generated sample in an \(N\)-by-\(M\) array where \(N\) and \(M\) are the sample size and the number of spatial dimensions, respectively.

Return type

np.ndarray

pdf(xx: numpy.ndarray) numpy.ndarray#

Get the PDF value of the distribution on a set of values.

Parameters

xx (np.ndarray) – Sample values (realizations) from a distribution.

Returns

PDF values of the distribution on the sample values.

Return type

np.ndarray

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: numpy.ndarray, other: uqtestfuns.core.prob_input.probabilistic_input.ProbInput)#

Transform a sample from the distribution to another.