graph_tool.inference.mcmc_anneal#
- graph_tool.inference.mcmc_anneal(state, beta_range=(1.0, 10.0), niter=100, history=False, mcmc_equilibrate_args={}, verbose=False)[source]#
Equilibrate a MCMC at a specified target temperature by performing simulated annealing.
- Parameters:
- stateAny state class (e.g.
BlockState) Initial state. This state will be modified during the algorithm.
- beta_range
tupleof two floats (optional, default:(1., 10.)) Inverse temperature range.
- niter
int(optional, default:100) Number of steps (in logspace) from the starting temperature to the final one.
- history
bool(optional, default:False) If
True, a list of tuples of the form(nattempts, nmoves, beta, entropy)- mcmc_equilibrate_args
dict(optional, default:{}) Arguments to be passed to
mcmc_equilibrate().- verbose
boolortuple(optional, default:False) If
True, progress information will be shown. Optionally, this accepts arguments of the typetupleof the form(level, prefix)wherelevelis a positive integer that specifies the level of detail, andprefixis a string that is prepended to the all output messages.
- stateAny state class (e.g.
- Returns:
- historylist of tuples of the form
(nattempts, nmoves, beta, entropy) Summary of the MCMC run. This is returned only if
history == True.- entropy
float Current entropy value after run. This is returned only if
history == False.- nattempts
int Number of node move attempts.
- nmoves
int Number of node moves.
- historylist of tuples of the form
Notes
This algorithm employs exponential cooling, where the value of beta is multiplied by a constant at each iteration, so that starting from beta_range[0] the value of beta_range[1] is reached after niter iterations.
At each iteration, the function
mcmc_equilibrate()is called with the current value of beta (via themcmc_argsparameter).References
[peixoto-efficient-2014]Tiago P. Peixoto, “Efficient Monte Carlo and greedy heuristic for the inference of stochastic block models”, Phys. Rev. E 89, 012804 (2014), DOI: 10.1103/PhysRevE.89.012804 [sci-hub, @tor], arXiv: 1310.4378