Sampling as search


Gergely Flamich

25/02/2026

gergely-flamich.github.io

random variate simulation

  • target distribution \(Q\)
  • want to simulate \(X \sim Q\)
  • BUT what does "simulate" really mean?
  • depends on computational framework

inverse transform sampling

Let \(X \in \mathbb{R}\) with CDF \(F\). Then, \(F(X) \sim ?\)

\[ \mathbb{P}[F(X) \leq u] = \mathbb{P}[X \leq F^{-1}(u)] = F(F^{-1}(u)) = u \]

\(F(X) = U \sim \mathrm{Unif}(0, 1)\), hence \(F^{-1}(U) \sim X\)

Assumption: can simulate from \(\mathrm{Unif}(0, 1)\)

rejection sampling

Let \(X \in \Omega, Q \ll P\) and \(r = dQ/dP\) with \(r < M\)

For \(i = 1, 2, \dots\) let \(X_i \sim P\) and \(U_i \sim \mathrm{Unif}(0, 1)\)

\[ K = \min\{k \in \mathbb{N} \mid U_i \leq r(X_i) / M \} \]

Then, \(X_K \sim Q\)

Assumption: can simulate from \(P\) and \(\mathrm{Unif}(0, 1)\)

how hard is sampling?

Hard.

(in general)

Example: \(X_i \sim P\) and need to pick one of them

Average sample complexity \(\mathbb{E}[K]\) is at least \(\Vert r \Vert_\infty\)

In what settings can we do better?

poisson processes

  • Collection of random points in space
  • Focus on processes over \(\mathbb{R}^D \times \mathbb{R}^+\)
  • Exponential inter-arrival times
  • Spatial distribution \(P\)
  • Mean measure: \(P \times \lambda\)

Example with \(P = \mathcal{N}(0, 1)\)

pp.gif

a* sampling

Idea: Start with a \(P \times \lambda\) process and "turn it" into a \(Q \times \lambda\) process!

\(\Pi = \{(X_i, T_i)\}\) be a \(P \times \lambda\) process.

\(g(x, t) = (x, t / r(x))\) where \(r = dQ/dP\)

Mapping theorem: \(g(\Pi)\) is a \(Q \times \lambda\) process.

a* sampling visually

mapthm.gif

basic a* sampling as search

First arrival of the mapped process: \[ K = \mathrm{argmin}_{k \in \mathbb{N}}\left\{\frac{T_k}{r(X_k)}\right\} \]

\(X_K \sim Q\)

implementing a* sampling

To find it: \[ \tau_k = \mathrm{min}_{i \in [1:k]}\left\{\frac{T_i}{r(X_i)}\right\} \]

For \(r < M\): \[ \frac{T_K}{r(X_K)} \geq \frac{T_K}{M} \]

basic a* sampling visually

basic_a_star.gif

advanced sampling as search: idea

basic_a_star_05b.png

advanced sampling as search

Superlevel set \[ S_r(h) = \{x \in \Omega \mid r(x) \geq h\} \]

Best restriction: \(X_{i + 1} \in S_r(T_i / \tau_i)\)

Might be easier to use some bounding sets \(B_{i + 1} \supseteq S_r(T_i / \tau_i)\)