scipy.stats.qmc.LatinHypercube.integers#
- LatinHypercube.integers(l_bounds, *, u_bounds=None, n=1, endpoint=False, workers=1)[source]#
Draw n integers from l_bounds (inclusive) to u_bounds (exclusive), or if endpoint=True, l_bounds (inclusive) to u_bounds (inclusive).
- Parameters:
- l_boundsint or array-like of ints
Lowest (signed) integers to be drawn (unless
u_bounds=None
, in which case this parameter is 0 and this value is used for u_bounds).- u_boundsint or array-like of ints, optional
If provided, one above the largest (signed) integer to be drawn (see above for behavior if
u_bounds=None
). If array-like, must contain integer values.- nint, optional
Number of samples to generate in the parameter space. Default is 1.
- endpointbool, optional
If true, sample from the interval
[l_bounds, u_bounds]
instead of the default[l_bounds, u_bounds)
. Defaults is False.- workersint, optional
Number of workers to use for parallel processing. If -1 is given all CPU threads are used. Only supported when using
Halton
Default is 1.
- Returns:
- samplearray_like (n, d)
QMC sample.
Notes
It is safe to just use the same
[0, 1)
to integer mapping with QMC that you would use with MC. You still get unbiasedness, a strong law of large numbers, an asymptotically infinite variance reduction and a finite sample variance bound.To convert a sample from \([0, 1)\) to \([a, b), b>a\), with \(a\) the lower bounds and \(b\) the upper bounds, the following transformation is used:
\[\text{floor}((b - a) \cdot \text{sample} + a)\]