Command Palette
Search for a command to run...
Markov Chain Monte Carlo Method MCMC
Date
MCMC It is an algorithm for sampling from a random distribution based on a Markov chain, which approximates the posterior distribution of the parameter of interest by randomly sampling in the probability space.
The basic theory of MCMC is Markov process. In related algorithms, in order to sample on a specified distribution, we can simulate this process from any state according to the Markov process, and continuously perform state transitions until it finally converges to a stable distribution.
The overall idea is to use a stable distribution to replace the complex distribution, and use this to sample and fit to finally get the distribution of the complex sample.
Common MCMC methods: Metropolis-Hastings sampling, Gibbs sampling
Metropolis-Hastings sampling
1: Initialize the initial state of the Markov chain latexX_0 = x_0
2: Sample the following process of latext = 0, 1, 2, … cycle
- At the latext moment, the state of the Markov chain islatexX_t = x_t , and the samplinglatexy ∼ q(xx_t)
- Sampling from a uniform distributionlatexu ∼ Uniform[0,1]
- If latex {u\text{ } < \text{ } \alpha { \left( {x\mathop{{}}\nolimits\_{{t}},y} \right) }\text{ }=\text{ }min{ \left\{ {\frac{{p{ \left( {y} \right) }q{ \left( {x\mathop{{}}\nolimits\_{{t}} \left| y\right. } \right) }}}{{p{ \left( {x\mathop{{}}\nolimits\_{{t}}} \right) }p{ \left( {y \left| {x\mathop{{}}\nolimits\_{{t}}\text{ } \to \text{ }y}, that is, latexX_t+1 = y
- Otherwise, the transfer is not accepted, that is, latexX_t+1 = x_t
Gibbs Sampling
1: Randomly initialize latexX_0 = x_0, Y_0 = y_0
2: Cyclic sampling of latext = 0, 1, 2, …
- latexy_t+1 ∼ p(yx_t)
- latexx_t+1 ∼ p(xy_t+1)
References
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.