86
5 Sampling
where x is a sampling from the desired probability distribution P (x). This is called
the inverse transform sampling. To actually execute the inverse transform method,
it is necessary that F and F −1 can be calculated analytically.
Box–Muller method
As a specific example of the inverse transform method, let us consider how we can
achieve a sampling of (x, y) from a two-dimensional Gaussian distribution
P (x, y) =
1
2π
e
−
1
2 (x 2 +y 2 ) .
(5.26)
It is recommended to remember the derivation of the Gaussian integral with the
polar coordinates. First, consider the two-dimensional polar coordinates
x = r cos θ , y = r sin θ .
(5.27)
Then, with λ =
r 2
2 , the probability density is
P (x, y)dxdy =
dθ
2π
· e
−λ dλ .
(5.28)
Hence, θ is found to follow a uniform distribution of [0, 2π]. On the other hand,
λ now follows a probability distribution called the exponential distribution on
the [0, ∞] interval. Since it is assumed that a uniform distribution is possible, if
sampling from λ is possible, then set r =
√
2λ, and apply (5.27), then (x, y) is
sampled. The inverse transform method can be used to sample λ. In fact, since
e
−λ dλ = d(−e
−λ ) ,
(5.29)
we find F (λ) = −e −λ . The inverse function is obtained by solving z = F (λ) =
−e −λ for λ, as
λ = − log(−z) = F
−1 (z) .
(5.30)
So this value should be λ. This is called the Box–Muller method [64]. In this way,
from the uniform distribution sampling, by using the inverse transform method, the
sampling is possible in the case when we can find F (x) satisfying (5.24), namely
in the case of a probability density function whose indefinite integral can be exactly
written down.
Précédent

- 94/211

Suivant