scipy.stats.qmc.

update_discrepancy#

scipy.stats.qmc.update_discrepancy(x_new, sample, initial_disc)[原始碼]#

使用新樣本更新中心化差異。

參數:
x_newarray_like (1, d)

要加入到 sample 中的新樣本。

samplearray_like (n, d)

初始樣本。

initial_discfloat

sample 的中心化差異。

回傳值:
discrepancyfloat

x_newsample 組成的樣本的中心化差異。

範例

我們也可以透過使用 iterative=True 迭代地計算差異。

>>> import numpy as np
>>> from scipy.stats import qmc
>>> space = np.array([[1, 3], [2, 6], [3, 2], [4, 5], [5, 1], [6, 4]])
>>> l_bounds = [0.5, 0.5]
>>> u_bounds = [6.5, 6.5]
>>> space = qmc.scale(space, l_bounds, u_bounds, reverse=True)
>>> disc_init = qmc.discrepancy(space[:-1], iterative=True)
>>> disc_init
0.04769081147119336
>>> qmc.update_discrepancy(space[-1], space[:-1], disc_init)
0.008142039609053513