Convergence of markov chains

Hi Prof. Peixoto,
My question is about convergence of Merge-split Markov chain Monte Carlo (in this paper: DOI: 10.1103/PhysRevE.102.012305).

You check for convergence/mixing of chains by diagnosing with Be (effective number of blocks), autocorrelation function, and ESS (effective sample size).
But is there a way to check for convergence in graph-tool?
I am using graph-tool version 2.59 on ubuntu 22.04.

I am inferring modular structure of networks following the cookbook.
I use mcmc_equilibrate() and pass a callback function to collect all partitions b’s and their description lengths dl’s.
I presume I can collect Be in the same callback function and plot them.
But how do I compute the autocorrelation function and ESS?

Also, should I run multiple chains in parallel–like you show in the paper?

Many thanks,
Govinda

In the graph-tool codes I found the following functions/classes:

  1. MulticanonicalState(); has its equilibration function multicanonical_equilibrate().
  2. TemperingState(); meant to be used to mcmc_equilibrate().

The wikipedia page says that using TemperingState has two advantages over running a single MCMC sampler: lower computational cost than running parallel MCMC samplers, and faster convergence to global optimum.

Would these functions/classes help in better convergence/mixing times? If so, how do I use them with mcmc_equilibrate() and diagnose convergence (by plotting Be, etc.)?

mcmc_equilibrate() can return history of sweeps, will it help in diagnosing convergence?

Many thanks,

Hi,

I cannot give you a full lecture on MCMC diagnosis here. There’s no fully automatized way to do it with graph-tool, you have to follow the steps as described in the paper using your own implementation.

To compute the autocorrelation function, you can use scipy: scipy.signal.correlate — SciPy v1.13.0 Manual

To run multiple chains, you can run multiple scripts, or use the multiprocessing module: multiprocessing — Process-based parallelism — Python 3.12.3 documentation

Thank you so much!

So is there no way to use TemperingState()?

Of course if you can use it. But I don’t recommend using methods you do not understand.

1 Like