# Latin Hypercube sampling¶

The LHS design is a statistical method for generating a quasi-random sampling distribution. It is among the most popular sampling techniques in computer experiments thanks to its simplicity and projection properties with high-dimensional problems. LHS is built as follows: we cut each dimension space, which represents a variable, into n sections where n is the number of sampling points, and we put only one point in each section.

The LHS method uses the pyDOE package (Design of Experiments for Python) [1]. Five criteria for the construction of LHS are implemented in SMT:

Center the points within the sampling intervals.

Maximize the minimum distance between points and place the point in a randomized location within its interval.

Maximize the minimum distance between points and center the point within its interval.

Minimize the maximum correlation coefficient.

Optimize the design using the Enhanced Stochastic Evolutionary algorithm (ESE).

The four first criteria are the same than in pyDOE (for more details, see [1]). The last criterion, ESE, is implemented by the authors of SMT (more details about such method could be found in [2]).

## Usage¶

```
import matplotlib.pyplot as plt
import numpy as np
from smt.sampling_methods import LHS
xlimits = np.array([[0.0, 4.0], [0.0, 3.0]])
sampling = LHS(xlimits=xlimits)
num = 50
x = sampling(num)
print(x.shape)
plt.plot(x[:, 0], x[:, 1], "o")
plt.xlabel("x")
plt.ylabel("y")
plt.show()
```

```
(50, 2)
```

## Options¶

Option |
Default |
Acceptable values |
Acceptable types |
Description |
---|---|---|---|---|

xlimits |
None |
None |
[‘ndarray’] |
The interval of the domain in each dimension with shape nx x 2 (required) |

criterion |
c |
[‘center’, ‘maximin’, ‘centermaximin’, ‘correlation’, ‘c’, ‘m’, ‘cm’, ‘corr’, ‘ese’] |
[‘str’] |
criterion used to construct the LHS design c, m, cm and corr are abbreviation of center, maximin, centermaximin and correlation, respectively |

random_state |
None |
None |
[‘NoneType’, ‘int’, ‘RandomState’] |
Numpy RandomState object or seed number which controls random draws |