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 (包含) 繪製。

Parameters:
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。

Returns:
samplearray_like (n, d)

QMC 樣本。

Notes

可以安全地將相同的 [`0`, `1`) 對整數的映射與 QMC 一起使用,就像您對 MC 使用的一樣。您仍然可以獲得不偏性、強大數法則、漸近無限的變異數縮減和有限樣本變異數界限。

若要將樣本從 \([0, 1)\) 轉換為 \([a, b), b>a\),其中 \(a\) 是下界,\(b\) 是上界,則使用以下轉換

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