準モンテカルロ法 (Quasi Monte Carlo Method; QMC)
Table of Contents
準モンテカルロおよび、それに付随する研究・テクニックについてまとめたページです。 このページより圧倒的に詳しく厳密に書いてある日本語の解説1 があるのでそちらを読むとより深い理解が得られると思います。
準モンテカルロ法の背景
ある関数
という形で求めることができます。
モンテカルロ積分は一様乱数を用いて積分区間から
という形で近似計算を行います。
モンテカルロ積分の利点は、積分変数の次元
で、
よって誤差のオーダーは
入力次元
準モンテカルロ法
準モンテカルロ法は、low-discrepancy sequence (LDS) を用いた数値積分方法です。
これが使われている応用場面は多岐にわたり、
最初に Discrepancy という不一致さの量を定義し、Discrepancy と積分誤差の評価を関係付ける Koksma-Hlawka inequality を説明し、最後に LDS を紹介します。
Discrepancy
ただし、
の集合で、
Star-discrepancy
である。
Koksma-Hlawka inequality
Van der Corput sequence 4
具体的に数式で表してみましょう。
正の整数
となります。ここで全ての
で表されます。
この式の定義があまり直感的でないと思う人は次のように考えても良いと思います。
| 整数 | 逆 | 10進表記 | |
|---|---|---|---|
| 1 | 1 | 0.1 | 0.5 |
| 2 | 10 | 0.01 | 0.25 |
| 3 | 11 | 0.11 | 0.75 |
| 4 | 100 | 0.001 | 0.125 |
| 5 | 101 | 0.101 | 0.625 |
| 6 | 110 | 0.011 | 0.375 |
| 7 | 111 | 0.111 | 0.875 |
このテーブルの一番右の列の値が van der Corput sequence に対応します。
van der Corput sequence の最初の
数値シミュレーションをしてみましょう。
import jax; jax.config.update("jax_enable_x64", True)
import jax.numpy as jnp
import numpy as np
import matplotlib.pyplot as plt
from sympy.ntheory.factor_ import totient
def van_der_corput(n: int, b: int):
x = 0
inv_b = 1.0 / b
while n > 0:
x += (n % b) * inv_b
n //= b
inv_b /= b
return x
def van_der_corput_seq(n: int, b: int) -> jnp.ndarray:
return jnp.array([van_der_corput(_n, b) for _n in range(n)])
base = 10
N = int(3e2)
n_list = range(N)
seq = van_der_corput_seq(N, base)
fig, ax = plt.subplots(figsize=(6, 6), tight_layout=True)
for n in n_list:
# Note: 縦軸の n に応じて今までに得られた数列 seq[:n] をプロットしている
s = seq[:n]
ax.scatter(s, [n] * len(s), s=1, c='royalblue', alpha=0.2)
ax.set_ylabel(r'$n$')
ax.set_xlabel(r'$x_n$')
ax.set_xlim([0, 1])
ax.set_ylim([0, N])
ax.invert_yaxis()
ax.set_title('Van der Corput sequence (base 10)')
plt.show()上図より、Van der Corput sequence が稠密に
Halton Sequence 5
ハルトン数列は van der Corput sequence の多次元版です。
例) 基数が (2, 3) の Halton sequence
N = 100
x1 = van_der_corput_seq(N, 2)
x2 = van_der_corput_seq(N, 3)
cs = jnp.linspace(0, N, N)
fig, ax = plt.subplots(figsize=(7, 6))
sc = ax.scatter(x1, x2, c=cs, s=10)
cb = fig.colorbar(sc)
cb.set_label(r'$n$')
ax.set_xlabel(r'$x_1$')
ax.set_ylabel(r'$x_2$')
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_title('(2, 3) Halton sequence')
plt.show()例) (17, 19) の Halton sequence
N = 100
x1 = van_der_corput_seq(N, 17)
x2 = van_der_corput_seq(N, 19)
cs = jnp.linspace(0, N, N)
fig, ax = plt.subplots(figsize=(7, 6))
sc = ax.scatter(x1, x2, c=cs, s=10)
cb = fig.colorbar(sc)
cb.set_label(r'$n$')
ax.set_xlabel(r'$x_1$')
ax.set_ylabel(r'$x_2$')
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_title('(17, 19) Halton sequence')
plt.show()Sobol Sequence 6
ある奇数
で表すことにする。
Original Sobol sequence は
で表される。ここで
| 1 | 1 | 0.1 |
| 2 | 3 | 0.11 |
| 3 | 7 | 0.111 |
| 4 | 5 | 0.0101 |
| 5 | 7 | 0.00111 |
| 6 | 43 | 0.101011 |
となる。ここで
を利用する。
で計算する。
https://i05nagai.github.io/memorandum/math/sobol_sequence.html
Antonov と Saleev ら 7 によると、Sobol 列の
で表しても asymptotic discrepancy には影響しない。ここで
Sobol sequence の
で定義する。ここで
Kuronecker sequence
で定義する。
Footnotes
-
Kosuke Suzuki and Takashi Aida, 準モンテカルロ法の最前線, 日本応用数理学会論文誌 Vol. 30, No. 4, pp. 320--374 (2020) ↩
-
Matt Pharr and Wenzel Jakob and Greg Humphreys, Physically Based Rendering: From theory to implementation, Morgan Kaufmann (2016) ↩
-
Balandat, Maximilian and Karrer, Brian and Jiang, Daniel and Daulton, Samuel and Letham, Ben and Wilson, Andrew G and Bakshy, Eytan, BoTorch: A framework for efficient Monte-Carlo Bayesian optimization, Advances in neural information processing systems Vol. 33, pp. 21524--21538 (2020) ↩
-
Van der Corput, JG and Schaake, G, Ungleichungen für Polynome und trigonometrische Polynome, Compositio Mathematica Vol. 2, pp. 321--361 (1935) ↩
-
Halton, John H, On the efficiency of certain quasi-random sequences of points in evaluating multi-dimensional integrals, Numerische Mathematik Vol. 2, pp. 84--90 (1960) ↩
-
Bratley, Paul and Fox, Bennett L, Algorithm 659: Implementing Sobol's quasirandom sequence generator, ACM Transactions on Mathematical Software (TOMS) Vol. 14, No. 1, pp. 88--100 (1988) ↩
-
Antonov Ilya A and Saleev VM, An economic method of computing LP
-sequences, USSR Computational Mathematics and Mathematical Physics Vol. 19, No. 1, pp. 252--256 (1979) ↩
tatsukawa