Computing Library › Optimization
Optimization

Latin Hypercube Sampling

A stratified sampling scheme that spreads points evenly across every input dimension, ideal for computer experiments.

Even coverage per dimension

Latin hypercube sampling (LHS) generates n sample points so that, when projected onto any single input axis, exactly one point falls in each of n equal-probability intervals. This guarantees uniform coverage of every dimension individually, avoiding the clumping and gaps that plague purely random sampling with small n.

How it is built

For each input dimension, divide its range into n equal-probability strata and place one sample in each. Then randomly permute the stratum assignments independently across dimensions and pair them up to form the n points. The random permutations ensure the design differs each time while preserving the one-per-stratum property in every dimension.

Why it beats plain Monte Carlo

Improving multidimensional spread

Basic LHS controls only one-dimensional projections; points can still cluster in higher dimensions. Maximin LHS maximizes the minimum distance between points, and orthogonal-array-based LHS improves coverage of low-dimensional projections. Optimized LHS designs are the standard initial sample for building surrogate models.

Use in computer experiments

Because deterministic simulations have no measurement noise, replicating a point gives no new information; spreading points to fill the input space matters most. LHS and its optimized variants are the default space-filling designs for initializing surrogate-based and Bayesian optimization of expensive simulations.

python
from scipy.stats.qmc import LatinHypercube
sampler = LatinHypercube(d=5)
samples = sampler.random(n=50)   # 50 points in the unit 5-cube

Latin hypercube designs provide the initial, well-spread set of simulation runs from which surrogate models of a complex device are built.