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

Class stepper

source code


Instance Methods
 
__init__(self, x, maxloops=-1, logger=None, share=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
reset_loops(self, maxloops=-1) source code
 
run_to_change(self, ncw=1, acceptable_step=None, update_T=False)
Run the Markov Chain Monte-Carlo until it finds an acceptable step.
source code
 
communicate_hook(self, id) source code
 
close(self)
After calling close(), it is no longer legal to call run_to_change(), run_to_ergodic(), or run_to_bottom().
source code
 
run_to_ergodic(self, ncw=1, T=1.0)
Run the stepper until it has explored all of parameter space ncw times (as best as we can estimate).
source code
 
run_to_bottom(self, ns=3, acceptable_step=None)
Run the Markov Chain Monte-Carlo until it converges near a minimum.
source code
 
synchronize_start(self, id) source code
 
synchronize_end(self, id) source code
 
synchronize_abort(self, id) source code
 
note(self, s, lvl) source code

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

Properties

Inherited from object: __class__

Method Details

__init__(self, x, maxloops=-1, logger=None, share=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

run_to_change(self, ncw=1, acceptable_step=None, update_T=False)

source code 

Run the Markov Chain Monte-Carlo until it finds an acceptable step.

Parameters:
  • ncw (int) - How many steps should be accepted before it stops?
  • acceptable_step (function(float) -> bool, often mcmc.T_acceptor or step_acceptor) - A function that decides what steps are acceptable and what are not. This is passed to the MCMC stepper, mcmc.BootStepper.
  • update_T (boolean.) - Obsolete. Must be False.
Raises:
  • TooManyLoops - if it takes a long time before enough steps are accepted.

close(self)

source code 

After calling close(), it is no longer legal to call run_to_change(), run_to_ergodic(), or run_to_bottom(). Logging is shut down, but the contents of the stepper are still available for inspection.

run_to_ergodic(self, ncw=1, T=1.0)

source code 

Run the stepper until it has explored all of parameter space ncw times (as best as we can estimate). Note that this is a pretty careful routine. If the stepper finds a better region of parameter space so that log(P) improves part way through the process, the routine will reset itself and begin again.

NOTE: this sets T and sortstrategy for the stepper.

Parameters:
  • ncw (int.) - how many times (or what fraction) of an ergodic exploration to make.
  • T (float or None.) - temperature at which to run the Monte-Carlo process. This is normally 1.0. If it is None, then the current temperature is not modified.
Returns:
a position at the end of the process.

run_to_bottom(self, ns=3, acceptable_step=None)

source code 

Run the Markov Chain Monte-Carlo until it converges near a minimum.

The general idea of the termination condition is that it keeps track of the angle between successive sequences of steps, where each sequence contains ns steps. If the angle is less than 90 degrees, it is evidence that the solution is still drifting in some consistent direction and therefore not yet at the maximum. Angles of greater than 90 degrees suggest that the optimization is wandering aimlessly near a minimum. It will run until a sufficient number of large angles are seen since the last BMCMC reset. A similar check is made on individual components of the parameter vector.

Parameters:
  • ns (int) - This controls how carefully if checks that it has really found a minimum. Large values will take longer but will assure more accurate convergence.
  • acceptable_step - A callable object (i.e. class or function) that returns True or False, depending on whether a proposed step is acceptable. See mcmc.T_acceptor for an example.
Raises: