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 ofDistributionContinuous1D
objects or an object of theJointIndependent
class.- Parameters:
distributions (
Union
[Distribution
,list
[Distribution
]]) – List ofDistribution
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 anint
is provided, this sets the seed for an object ofnumpy.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:
Random
- completely random.Centered
- points only at the centre.MaxiMin
- maximizing the minimum distance between points.MinCorrelation
- minimizing the correlation between the points.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 therun()
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 theLatinHypercubeSampling
class. If nsamples is provided, therun()
method is automatically called when theLatinHypercubeSampling
object is defined. The user may also call therun()
method directly to generate samples. Therun()
method of theLatinHypercubeSampling
class cannot be invoked multiple times for sample size extension.The
run()
method has no returns, although it creates and/or appends thesamples
andsamplesU01
attributes of theLatinHypercubeSampling
object.
Attributes
- LatinHypercubeSampling.samples
The generated LHS samples.