Package gmisclib :: Module mcmc :: Class position_repeatable
[frames] | no frames]

Class position_repeatable

source code


This is for the common case where logp is a well-behaved function of its arguments. It caches positions and their corresponding values of log(P).

Instance Methods
 
__init__(self, x, problem_def, logp=None)
You need this function and this signature if you are going to pass it to make_list_of_positions(), but not necessarily otherwise.
source code
 
invalidate_cache(self)
This can be called when the mapping between parameters (x) and value changes.
source code
 
logp(self)
Compute the log of the probability for the position.
source code
 
logp_nocompute(self)
Shows a recent logp value.
source code
position_base or a subclass
new(self, shift, logp=None)
Returns a new position, shifted by the specified amount.
source code
 
__repr__(self)
repr(x)
source code
 
__cmp__(self, other)
This is used when the archive is sorted. (Inherited from gmisclib.mcmc.position_base)
source code
 
prms(self)
The result of this function is to be handed to problem_definition.logp(). (Inherited from gmisclib.mcmc.position_base)
source code
 
uid(self) (Inherited from gmisclib.mcmc.position_base) source code
 
vec(self)
Returns a numpy vector. (Inherited from gmisclib.mcmc.position_base)
source code

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

Class Variables
  EPS = 1e-07
When we check for reproducibility, how closely must answers match?
  HUGE = 1e+38
  CACHE_LIFE = 50
  FIXER_CHECK = 100
How often should we recompute cached values to make sure that the same parameters always lead to the same results?
Properties

Inherited from object: __class__

Method Details

__init__(self, x, problem_def, logp=None)
(Constructor)

source code 

You need this function and this signature if you are going to pass it to make_list_of_positions(), but not necessarily otherwise.

Parameters:
  • x (numpy.ndarray)
  • logp (float or None) - the value of log(P) at x, or None to indicate that it hasn't been computed yet.
  • problem_def (problem_definition or a subclass thereof.)
Decorators:
  • @g_implements.make_optional
Raises:
Overrides: object.__init__

invalidate_cache(self)

source code 

This can be called when the mapping between parameters (x) and value changes. You might use it if you wanted to change the probability distribution (i.e. log(P)).

logp(self)

source code 

Compute the log of the probability for the position.

Overrides: position_base.logp
(inherited documentation)

logp_nocompute(self)

source code 

Shows a recent logp value. It should not compute a value unless necessary. The intent is to look up a value in a cache.

Overrides: position_base.logp_nocompute
(inherited documentation)

new(self, shift, logp=None)

source code 

Returns a new position, shifted by the specified amount.

Parameters:
  • shift - How much of a move to make to the new position?
  • logp - (optional) If this is supplied, is is used to set the log(P) value for the newly created position structure.
Returns: position_base or a subclass
a new position
Overrides: position_base.new

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)