The not-so-frequently asked questions that still have useful answers
What are “walkers”?¶
Walkers are the members of the ensemble. They are almost like separate Metropolis-Hastings chains but, of course, the proposal distribution for a given walker depends on the positions of all the other walkers in the ensemble. See Goodman & Weare (2010) for more details.
How should I initialize the walkers?¶
The best technique seems to be to start in a small ball around the a priori preferred position. Don’t worry, the walkers quickly branch out and explore the rest of the space.
Wrapping C++ code¶
There are numerous ways to do it, see the python wiki.
Extra care has to be taken if mpi support is needed as the mpi4py module used by emcee depends on the pickle module to send a function call to different processors/cores.
A minimal extension of the mpi.py example in which the target density is coded in C++ and wrapped with the swig library is shown in this gist. It also demonstrates the hacks needed to get the pickling to work.
In order to confine the walkers to a finite volume of the parameter space, have your function return negative infinity outside of the volume corresponding to the logarithm of 0 prior probability using:
Note: if your function is written in C++, use:
as it does not have the desired effect.
I’m getting weird spikes in my data/I have low acceptance fractions/both… what should I do?
Double the number of walkers. If that doesn’t work, double it again. And again. Until you run out of RAM. At that point, I don’t know!
The walkers are getting stuck in “islands” of low likelihood. How can I fix that?
Try increasing the number of walkers. If that doesn’t work, you can try pruning using a clustering algorithm like the one found in arxiv:1104.2612.