LatinHypercubeSampling Class

The LatinHypercubeSampling class is imported using the following command:

>>> from UQpy.sampling.stratified_sampling.LatinHypercubeSampling import LatinHypercubeSampling

Methods

class LatinHypercubeSampling(distributions, nsamples, criterion=<UQpy.sampling.stratified_sampling.latin_hypercube_criteria.Random.Random object>, random_state=None)[source]

Perform Latin hypercube sampling (LHS) of random variables.

All distributions in LatinHypercubeSampling must be independent. LatinHypercubeSampling does not generate correlated random variables. Therefore, for multi-variate designs the distributions must be a list of DistributionContinuous1D objects or an object of the JointIndependent class.

Parameters:
  • distributions (Union[Distribution, list[Distribution]]) – List of Distribution objects corresponding to each random variable.

  • nsamples (int) – Number of samples to be drawn from each distribution.

  • random_state (Union[None, int, RandomState]) – Random seed used to initialize the pseudo-random number generator. If an int is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

  • criterion (Criterion) –

    The criterion for pairing the generating sample points. This parameter must be of type Criterion.

    Options:

    1. Random - completely random.

    2. Centered - points only at the centre.

    3. MaxiMin - maximizing the minimum distance between points.

    4. MinCorrelation - minimizing the correlation between the points.

    5. User-defined criterion class, by providing an implementation of the abstract class Criterion

run(nsamples)[source]

Execute the random sampling in the LatinHypercubeSampling class.

Parameters:

nsamples (int) – If the run() method is invoked multiple times, the newly generated samples will overwrite the existing samples.

The run() method is the function that performs random sampling in the LatinHypercubeSampling class. If nsamples is provided, the run() method is automatically called when the LatinHypercubeSampling object is defined. The user may also call the run() method directly to generate samples. The run() method of the LatinHypercubeSampling class cannot be invoked multiple times for sample size extension.

The run() method has no returns, although it creates and/or appends the samples and samplesU01 attributes of the LatinHypercubeSampling object.

Attributes

LatinHypercubeSampling.samples

The generated LHS samples.

LatinHypercubeSampling.samplesU01: ndarray

The generated LHS samples on the unit hypercube.

Examples