scipy.stats.qmc.Halton.

integers#

Halton.integers(l_bounds, *, u_bounds=None, n=1, endpoint=False, workers=1)[source]#

l_bounds (包含) 到 u_bounds (不包含) 绘制 n 个整数,或者如果 endpoint=True,则从 l_bounds (包含) 到 u_bounds (包含)。

参数:
l_boundsint 或 int 的类数组对象

要绘制的最低(有符号)整数(除非 u_bounds=None,在这种情况下,此参数为 0,并且此值用于 u_bounds)。

u_boundsint 或 int 的类数组对象,可选

如果提供,则为要绘制的最大(有符号)整数之上的一个(有关 u_bounds=None 时的行为,请参见上文)。 如果是类数组对象,则必须包含整数值。

nint,可选

在参数空间中生成的样本数。 默认为 1。

endpointbool,可选

如果为 true,则从区间 [l_bounds, u_bounds] 中采样,而不是默认的 [l_bounds, u_bounds)。 默认为 False。

workersint,可选

用于并行处理的工作进程数。 如果给定 -1,则使用所有 CPU 线程。 仅在使用 Halton 时支持。 默认为 1。

返回:
samplearray_like (n, d)

QMC 样本。

注释

对于 QMC,可以安全地仅使用与 MC 相同的 [0, 1) 到整数的映射。 您仍然可以获得无偏性、强大的大数定律、渐近无限方差缩减和有限样本方差界。

要将样本从 \([0, 1)\) 转换为 \([a, b), b>a\),其中 \(a\) 是下限,\(b\) 是上限,则使用以下转换

\[\text{floor}((b - a) \cdot \text{sample} + a)\]