scipy.stats.qmc.PoissonDisk.
integers#
- PoissonDisk.integers(l_bounds, *, u_bounds=None, n=1, endpoint=False, workers=1)[源代码]#
从 l_bounds (包含) 到 u_bounds (不包含) 中抽取 n 个整数,如果 endpoint=True,则从 l_bounds (包含) 到 u_bounds (包含) 中抽取。
- 参数:
- l_boundsint 或 整数类型的类数组对象
要绘制的最低(有符号)整数(除非
u_bounds=None
,在这种情况下,此参数为 0,并且此值用于 u_bounds)。- u_boundsint 或 整数类型的类数组对象, 可选
如果提供,则为要绘制的最大(有符号)整数之上的一个(有关
u_bounds=None
时的行为,请参见上文)。如果为类数组对象,则必须包含整数值。- nint, 可选
要在参数空间中生成的样本数。默认为 1。
- endpointbool, 可选
如果为 true,则从区间
[l_bounds, u_bounds]
而不是默认的[l_bounds, u_bounds)
中采样。默认为 False。- workersint, 可选
用于并行处理的 worker 数量。 如果给出 -1,则使用所有 CPU 线程。 仅在使用
Halton
时才支持。 默认值为 1。
- 返回:
- samplearray_like (n, d)
QMC 样本。
注释
可以安全地将与 MC 一起使用的相同的
[0, 1)
到整数的映射用于 QMC。 你仍然可以获得无偏性、强大的大数定律、渐近的无限方差减少和有限样本方差界限。要将样本从 \([0, 1)\) 转换为 \([a, b), b>a\),其中 \(a\) 是下限,\(b\) 是上限,则使用以下转换
\[\text{floor}((b - a) \cdot \text{sample} + a)\]