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

Class position_base

source code


This class is used internally in the MCMC sampling process to represent a position. It stores a parameter vector, a reference to the problem definition, and (optionally) caches computed values of log(P).

Instance Methods
 
__init__(self, x, problem_def)
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
 
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
 
prms(self)
The result of this function is to be handed to problem_definition.logp().
source code
 
vec(self)
Returns a numpy vector.
source code
 
__repr__(self)
repr(x)
source code
 
__cmp__(self, other)
This is used when the archive is sorted.
source code
 
uid(self) source code

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

Properties

Inherited from object: __class__

Method Details

__init__(self, x, problem_def)
(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.

Decorators:
  • @g_implements.make_optional
Overrides: object.__init__

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.

new(self, shift, logp=None)

source code 

Returns a new position, shifted by the specified amount.

Parameters:
  • shift (numpy.ndarray) - How much of a move to make to the new position?
  • logp (float or None) - (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

prms(self)

source code 

The result of this function is to be handed to problem_definition.logp(). This result must contain all the information specifying the position. Normally, this is a vector of floats, but conceivably, you could include other information.

vec(self)

source code 

Returns a numpy vector. The result should contain all the information specifying the position; if not all, it should at least contain all the information that can be usefully expressed as a vector of floating point numbers.

Normally, vec() and prms() are identical.

__repr__(self)
(Representation operator)

source code 

repr(x)

Decorators:
  • @g_implements.make_optional
Overrides: object.__repr__
(inherited documentation)