Package gmisclib :: Module mcmc_helper :: Class step_acceptor
[frames] | no frames]

Class step_acceptor

source code


This class defines the annealing schedule when mcmc is used as an optimizer. It corresponds to n extra degrees of freedom that exchange probability (i.e. `energy') with each other, and the system to be optimized. Over time, the excess log(probability) gradually oozes away.

Instance Methods
 
__init__(self, n, T0, T=1.0, maxT=None, probestep=None, tau_probe=None, jitterdroop=None)
Create a step_acceptor and define it's properties.
source code
float
T(self)
Returns: the current effective temperature.
source code
bool
__call__(self, delta)
Returns: Whether to accept the candidate step or not.
source code
 
__repr__(self)
repr(x)
source code
 
is_root(self)
This is a stub for compatibility with MPI code.
source code
 
size(self)
This is a stub for compatibility with MPI code.
source code
 
rank(self)
This is a stub for compatibility with MPI code.
source code
float
jitter(self)
In the acoustic distances paper, it is called $\bar{delta}$. (Inherited from gmisclib.mcmc.rough_acceptor_base)
source code
 
probe(self, currentpos, stepper)
This computes logP() near the current step position, and sees how much that differs from logP() _at_ the current step position. (Inherited from gmisclib.mcmc.rough_acceptor_base)
source code
 
reset(self)
In order to make the overal algorithm asymptotically a Markovian, we need to make sure that (asymptotically) the acceptor function depends only on long-term averages, not on recent history. (Inherited from gmisclib.mcmc.rough_acceptor_base)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables
  last_probe
A pair of position_base instances showing the position and logP at each end of the most recent probe for a discontinuity. (Inherited from gmisclib.mcmc.acceptor_base)
  since_last_reset
Number of iterations since the last overall MCMC reset. (Inherited from gmisclib.mcmc.rough_acceptor_base)
Properties

Inherited from object: __class__

Method Details

__init__(self, n, T0, T=1.0, maxT=None, probestep=None, tau_probe=None, jitterdroop=None)
(Constructor)

source code 

Create a step_acceptor and define it's properties.

Parameters:
  • n (int) - How many degrees of freedom should the step acceptor store? Note that the energy of the step acceptor is gradually equilibrated to the desired temperature. Each step, there is a 1/n chance of equibrilating one DOF. So, when n=1, this is exactly a T_acceptor. When n>>1, the acceptor is very nearly leak-free, and exchanges energy with the system to be optimized, but hardly at all with the heat bath. So, for n=1, the temperature is fixed at T. When n>>1, the temperature can rise as logP goes up, and will fall when logP goes down.
  • T (float) - What's the temperature of the heat bath? This is the final temperature that the annealing schedule will eventually approach. Default: 1.0.
  • T0 (float) - The starting temperature.
  • maxT (float or None) - In optimization mode, it's normal for the system being optimized to increase it's log(P). That dumps log(P) or `energy' into the step_acceptor's degrees of freedom and raises its temperature. This parameter lets you define an approximate maximum temperature. Setting this may speed up convergence, though there is a corresponding risk of getting trapped in a local minimum.
Overrides: object.__init__

T(self)

source code 
Returns: float
the current effective temperature.
Overrides: mcmc.acceptor_base.T

__call__(self, delta)
(Call operator)

source code 

Accept a step or not?

Parameters:
  • delta (float) - How much did the candidate step change log(P)?
Returns: bool
Whether to accept the candidate step or not.
Overrides: mcmc.acceptor_base.__call__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)