Tomographerv1.0a
Tomographer C++ Framework Documentation
|
A Metropolis-Hastings Random Walk. More...
#include <tomographer/mhrw.h>
Public Types | |
enum | |
typedef Rng_ | Rng |
Random number generator type (see C++ std::random) | |
typedef MHWalker_ | MHWalker |
The random walker type which knows about the state space and jump function. | |
typedef MHRWStatsCollector_ | MHRWStatsCollector |
The stats collector type (see MHRWStatsCollector Interface) | |
typedef LoggerType_ | LoggerType |
The logger type (see Logging and Loggers) | |
typedef CountIntType_ | CountIntType |
The type used for counting numbers of iterations (see, e.g. n_sweep()) | |
typedef MHWalker::PointType | PointType |
The type of a point in the random walk. | |
typedef MHWalker::RealScalar | RealScalar |
The type of a step size of the random walk. | |
typedef _FnValueType | FnValueType |
The type of the Metropolis-Hastings function value. (See class documentation) | |
Public Member Functions | |
MHRandomWalk (CountIntType n_sweep, CountIntType n_therm, CountIntType n_run, RealScalar step_size, MHWalker &mhwalker, MHRWStatsCollector &stats, Rng &rng, LoggerType &logger_) | |
Simple constructor, initializes the given fields. | |
CountIntType | n_sweep () const |
Required for RandomWalk Interface. Number of iterations in a sweep. | |
CountIntType | n_therm () const |
Required for RandomWalk Interface. Number of thermalizing sweeps. | |
CountIntType | n_run () const |
Required for RandomWalk Interface. Number of live run sweeps. | |
RealScalar | step_size () const |
Get the step size of the random walk. | |
void | init () |
Required for RandomWalk Interface. Resets counts and relays to the MHWalker and the MHRWStatsCollector. | |
void | thermalizing_done () |
Required for RandomWalk Interface. Relays to the MHWalker and the MHRWStatsCollector. | |
void | done () |
Required for RandomWalk Interface. Relays to the MHWalker and the MHRWStatsCollector. | |
const PointType & | get_curpt () const |
Access the current state of the random walk. More... | |
const FnValueType & | get_curptval () const |
Access the current function value of the random walk. More... | |
void | set_curpt (const PointType &pt) |
Force manual state of random walk. More... | |
void | move (CountIntType k, bool is_thermalizing, bool is_live_iter) |
Required for RandomWalk Interface. Processes a single move in the random walk. More... | |
bool | has_acceptance_ratio () const |
Query whether we have any statistics about acceptance ratio. This is false , for example, during the thermalizing runs. | |
template<typename RatioType = double> | |
RatioType | acceptance_ratio () const |
Return the acceptance ratio so far. | |
void | process_sample (CountIntType k, CountIntType n) |
Required for RandomWalk Interface. Process a new live sample in the random walk. Relays the call to the MHRWStatsCollector (see MHRWStatsCollector Interface). | |
void | run () |
A Metropolis-Hastings Random Walk.
Implements a Metropolis-Hastings random walk. This takes care of accepting or rejecting a new point and taking samples.
The MHWalker is responsible for dealing with the state space, providing a new proposal point and calculating the function value at different points. See MHWalker Interface.
A MHRWStatsCollector takes care of collecting useful data during a random walk. It should be a type implementing a MHRWStatsCollector interface, see MHRWStatsCollector Interface.
anonymous enum |
|
inline |
|
inline |
Access the current function value of the random walk.
MHRandomWalk::UseFnSyntaxType
. It is either the value of the function, its logarithm, or a dummy value.
|
inline |
Required for RandomWalk Interface. Processes a single move in the random walk.
This function gets a new move proposal from the MHWalker object, and calculates the a value, which tells us with which probability we should accept the move. This a value is calculated according to the documentation in Role of UseFnSyntaxType.
|
inline |