base.LatinHypercube

base.LatinHypercube(size, scramble=True, seed=None)

Generate a random Latin Hypercube Design

Parameters

Name Type Description Default
size tuple of ints Output shape of \((n,d)\), where \(n\) and \(d\) are the number of rows and columns, respectively. required
scramble typing.Optional[bool] When False, center samples within cells of a multi-dimensional grid. Otherwise, samples are randomly placed within cells of the grid. Defaults to True. True
seed Optional[Union[int, np.random.Generator]]) If seed is an integer or None, a new numpy.random.Generator is created using np.random.default_rng(seed). If seed is already a Generator instance, then the provided instance is used. Defaults to None. None

Returns

Type Description
numpy.numpy.ArrayLike A Latin hypercube sample of \(n\) points generated in \([0,1)^d\)

Examples:

import pyLHD
pyLHD.LatinHypercube(size = (5,3),seed = 1)
array([[0.70930042, 0.30930042, 0.10930042],
       [0.90930042, 0.50930042, 0.90930042],
       [0.10930042, 0.70930042, 0.30930042],
       [0.50930042, 0.90930042, 0.70930042],
       [0.30930042, 0.10930042, 0.50930042]])
pyLHD.LatinHypercube(size = (5,3), seed = 1, scramble = False)
array([[0.7, 0.3, 0.1],
       [0.9, 0.5, 0.9],
       [0.1, 0.7, 0.3],
       [0.5, 0.9, 0.7],
       [0.3, 0.1, 0.5]])