[PYTHON] I tried to organize about MCMC.

About Markov Chain Monte Carlo Method (MCMC Method) ・ What is the MCMC method? -MCMC method types and Python modules I tried to summarize.

0. What is the Markov chain Monte Carlo method (MCMC method)?

By using Markov chains, the Monte Carlo method is strengthened.

I will write in detail later, The Monte Carlo method is for sampling truly randomly. ・ Calculation cost is high ・ Accuracy does not improve There is a problem. So the Markov chain Monte Carlo method This problem was improved by using Markov chains.

1. 1. What is the Monte Carlo method?

"Introduction to Monte Carlo Method with Python" http://aidiary.hatenablog.com/entry/20140620/1403272044 The Monte Carlo method is carefully explained from the beginning, Moreover, it comes with a Python implementation.

You can learn the theory with very detailed explanations while trying this amount. I have the original book, but it's better to read this page I think it should be much less laborious and easy to understand.

There are quite a few types of Monte Carlo methods. ・ Inverse conversion method ・ Box-Muller method ・ Acceptance rejection law ・ Priority sampling

2. What is a Markov chain?

Roughly, to make a stochastic transition in time series It performs matrix operations. (Not accurate ...) You can also think of it as an automaton that makes a stochastic transition.

"Introduction to Markov chain : simplified!" http://www.analyticsvidhya.com/…/07/markov-chain-simplified/ English, but good article.

3. 3. Markov chain Monte Carlo method (MCMC method)

1) What is the MCMC method?

The Monte Carlo method is for sampling truly randomly. ・ Calculation cost is high ・ Accuracy does not improve There is a problem.

Markov chain Monte Carlo method By sampling with a Markov chain as a steady distribution, This is a method that improves the above problems.

2) MCMC algorithm

step1. Determine the initial point step2. Determine the distribution for the next sampling by Markov chain

4. Practice with Python

1) First MCMC (Metropolis-Hastings method)

https://tatsyblog.wordpress.com/

From the side of reading the source code I feel like MCMC can understand.

The Metropolis-Hastings method is based on the most natural idea It is an orthodox method designed. In a certain probability when going to the lower probability It is a stopper to prevent the steady distribution from transitioning.

2) Types of MCMC method

Other, ・ Gibbs sampling method ・ Hybrid Monte Carlo method ・ Slice sampling method Is introduced, but see ↑ article.

3) Python module

↑ The link uses the mcmc module, Besides that, it seems that the pymc3 module is also often used. http://qiita.com/kenmatsu4/items/a0c703762a2429e21793

5. To learn the theoretical system

The Institute of Statistical Mathematics by Professor Yukito Iba MCMC Lecture (https://www.youtube.com/watch?v=-H28H1unn0M)

From the stationary distribution to the nature of Markov chains and the physical aspects The explanation is simple and easy to understand. If you look at this, you can easily understand the foundation of MCMC.

6. Finally

MCMC method is a wonderful commentary on a recently talked-about book [Special feature] Bayesian inference and MCMC free software support page https://sites.google.com/site/iwanamidatascience/vol1/support_tokushu It may be enough to see.

But here,

  1. The entrance to what the Markov chain Monte Carlo method is
  2. How to use the Python module I wrote the basics of, and I wondered if I could differentiate ...

Recommended Posts

I tried to organize about MCMC.
I tried to debug.
I tried to paste
I tried to learn PredNet
I tried to implement PCANet
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to find out the outline about Big Gorilla
I tried to implement Deep VQE
I tried to create Quip API
I tried to touch Python (installation)
I tried to implement adversarial validation
I tried Watson Speech to Text
[Python] I tried to visualize tweets about Corona with WordCloud
I tried to touch Tesla's API
I tried to implement hierarchical clustering
I tried to implement Realness GAN
I tried to move the ball
I tried to estimate the interval.
[Updated as appropriate] I tried to organize the basic visualization methods
I tried to let Pepper talk about event information and member information
I tried to create a linebot (implementation)
I tried to implement Autoencoder with TensorFlow
I tried to summarize the umask command
I tried to implement permutation in Python
I tried to create a linebot (preparation)
I tried to visualize AutoEncoder with TensorFlow
I tried to recognize the wake word
I tried to get started with Hy
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to classify text using TensorFlow
I tried to summarize the graphical modeling.
I tried adding post-increment to CPython Implementation
I tried to implement ADALINE in Python
I tried to let optuna solve Sudoku
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement CVAE with PyTorch
I tried to make a Web API
I tried to solve TSP with QAOA
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I tried my best to return to Lasso
I tried to summarize Ansible modules-Linux edition
I tried to predict Covid-19 using Darts
I tried to implement a blockchain that actually works with about 170 lines
I tried scraping
I tried PyQ
I tried to summarize the logical way of thinking about object orientation.
I tried papermill
I tried django-slack
I tried Django
I tried spleeter
I tried cgo
I tried to predict next year with AI
I tried to build a super-resolution method / ESPCN
I tried to program bubble sort by language
I tried web scraping to analyze the lyrics.