rexfw.samplers.rwmc module

A Metropolis-Hastings sampler as an example for the sampler interface

class rexfw.samplers.rwmc.RWMCSampleStats(accepted, total, stepsize)

Bases: tuple

_asdict()

Return a new OrderedDict which maps field names to their values

_fields = ('accepted', 'total', 'stepsize')
classmethod _make(iterable, new=<built-in method __new__ of type object>, len=<built-in function len>)

Make a new RWMCSampleStats object from a sequence or iterable

_replace(**kwds)

Return a new RWMCSampleStats object replacing specified fields with new values

accepted

Alias for field number 0

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

stepsize

Alias for field number 2

total

Alias for field number 1

class rexfw.samplers.rwmc.RWMCSampler(pdf, state, stepsize, variable_name='x')[source]

Bases: rexfw.samplers.AbstractSampler

last_draw_stats
sample()[source]

draws a sample, possibly using self.state (for MCMC)