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
LatinHypercubeSamplingmust be independent.LatinHypercubeSamplingdoes not generate correlated random variables. Therefore, for multi-variate designs the distributions must be a list ofDistributionContinuous1Dobjects or an object of theJointIndependentclass.- Parameters:
distributions (
Union[Distribution,list[Distribution]]) – List ofDistributionobjects 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 anintis 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
LatinHypercubeSamplingclass.- 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 theLatinHypercubeSamplingclass. If nsamples is provided, therun()method is automatically called when theLatinHypercubeSamplingobject is defined. The user may also call therun()method directly to generate samples. Therun()method of theLatinHypercubeSamplingclass cannot be invoked multiple times for sample size extension.The
run()method has no returns, although it creates and/or appends thesamplesandsamplesU01attributes of theLatinHypercubeSamplingobject.
Attributes
- LatinHypercubeSampling.samples
The generated LHS samples.