Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::MarkovChain< MarkovChainTraits > Class Template Reference

#include <mcmc.hpp>

Inheritance diagram for Arak::MarkovChain< MarkovChainTraits >:

Inheritance graph
[legend]
Collaboration diagram for Arak::MarkovChain< MarkovChainTraits >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class MarkovChainTraits>
class Arak::MarkovChain< MarkovChainTraits >

A Metropolis-Hastings Markov chain.

Definition at line 13 of file mcmc.hpp.

Public Types

typedef MarkovChainTraits::StateType StateType
typedef MarkovChainTraits::DistributionType DistributionType
typedef MarkovChainTraits::ProposalType ProposalType
typedef MarkovChainTraits::MoveType MoveType

Public Member Functions

 MarkovChain (DistributionType &dist, ProposalType &proposal, StateType &state, const Arak::Util::PropertyMap &props, Arak::Util::Random &random=Arak::Util::default_random)
 Default constructor.

const StateTypegetState () const
 Returns a const reference to the current state of the Markov chain.

double getLogLikelihood () const
 Returns the log likelihood of the current state.

StateTypegetState ()
 Returns a mutable reference to the current state of the Markov chain.

const DistributionTypegetDistribution () const
 Returns a const reference to the chain's stationary measure.

virtual bool advance ()
 Advances the Markov chain using a Metropolis-Hastings step.

unsigned long int getNumSteps () const
 Returns the number of times advance() has been called.

unsigned long int getNumSamples () const
 Returns the number of samples generated by this Markov chain.

bool isSample () const
 Returns true if the current state of the Markov chain is a sample.

unsigned long int getNumMoves () const
 Returns the number of times the state of the Markov chain has changed.

double acceptance () const
 Returns the proportion of accepted moves.


Protected Attributes

Arak::Util::Randomrandom
 A source of pseudorandomness.

DistributionTypedist
 The distribution sampled by this Markov chain.

ProposalTypeproposal
 The proposal distribution used by this Markov chain.

StateTypestate
 The current state of the Markov chain.

double logLikelihood
 The log likelihood of the current state.

unsigned long int numSteps
 The number of times advance() has been called.

unsigned long int numMoves
 The number of changes to the state of the Markov chain.

unsigned int burnIn
 The number of initial samples to discard.

unsigned int stride
 The number of steps to discard in between samples.


Member Typedef Documentation

template<class MarkovChainTraits>
typedef MarkovChainTraits::DistributionType Arak::MarkovChain< MarkovChainTraits >::DistributionType
 

Reimplemented in Arak::AnnealedMarkovChain< MarkovChainTraits >, and Arak::StochasticHillClimber< MarkovChainTraits >.

Definition at line 18 of file mcmc.hpp.

template<class MarkovChainTraits>
typedef MarkovChainTraits::MoveType Arak::MarkovChain< MarkovChainTraits >::MoveType
 

Reimplemented in Arak::AnnealedMarkovChain< MarkovChainTraits >, and Arak::StochasticHillClimber< MarkovChainTraits >.

Definition at line 20 of file mcmc.hpp.

template<class MarkovChainTraits>
typedef MarkovChainTraits::ProposalType Arak::MarkovChain< MarkovChainTraits >::ProposalType
 

Reimplemented in Arak::AnnealedMarkovChain< MarkovChainTraits >, and Arak::StochasticHillClimber< MarkovChainTraits >.

Definition at line 19 of file mcmc.hpp.

template<class MarkovChainTraits>
typedef MarkovChainTraits::StateType Arak::MarkovChain< MarkovChainTraits >::StateType
 

Reimplemented in Arak::AnnealedMarkovChain< MarkovChainTraits >, and Arak::StochasticHillClimber< MarkovChainTraits >.

Definition at line 17 of file mcmc.hpp.


Constructor & Destructor Documentation

template<class MarkovChainTraits>
Arak::MarkovChain< MarkovChainTraits >::MarkovChain DistributionType dist,
ProposalType proposal,
StateType state,
const Arak::Util::PropertyMap props,
Arak::Util::Random random = Arak::Util::default_random
[inline]
 

Default constructor.

Given a stationary distribution, a proposal distribution, and an initial state, this builds a new Markov chain.

Parameters:
dist the distribution to be sampled
proposal the proposal distribution of the Markov chain
state the initial state of the Markov chain
props a property map containing properties relevant to the Markov chain
random a source of pseudorandomness

Definition at line 83 of file mcmc.hpp.


Member Function Documentation

template<class MarkovChainTraits>
double Arak::MarkovChain< MarkovChainTraits >::acceptance  )  const [inline]
 

Returns the proportion of accepted moves.

Definition at line 203 of file mcmc.hpp.

Referenced by sampler().

template<class MarkovChainTraits>
virtual bool Arak::MarkovChain< MarkovChainTraits >::advance  )  [inline, virtual]
 

Advances the Markov chain using a Metropolis-Hastings step.

This method returns truth if the proposed move was accepted.

Returns:
true if the state of the chain changed

Reimplemented in Arak::AnnealedMarkovChain< MarkovChainTraits >, and Arak::StochasticHillClimber< MarkovChainTraits >.

Definition at line 141 of file mcmc.hpp.

template<class MarkovChainTraits>
const DistributionType& Arak::MarkovChain< MarkovChainTraits >::getDistribution  )  const [inline]
 

Returns a const reference to the chain's stationary measure.

Returns:
the Arak process

Definition at line 131 of file mcmc.hpp.

template<class MarkovChainTraits>
double Arak::MarkovChain< MarkovChainTraits >::getLogLikelihood  )  const [inline]
 

Returns the log likelihood of the current state.

Definition at line 116 of file mcmc.hpp.

template<class MarkovChainTraits>
unsigned long int Arak::MarkovChain< MarkovChainTraits >::getNumMoves  )  const [inline]
 

Returns the number of times the state of the Markov chain has changed.

Definition at line 198 of file mcmc.hpp.

Referenced by sampler().

template<class MarkovChainTraits>
unsigned long int Arak::MarkovChain< MarkovChainTraits >::getNumSamples  )  const [inline]
 

Returns the number of samples generated by this Markov chain.

This is the number of steps divided by the stride, minus the burn-in.

Definition at line 180 of file mcmc.hpp.

Referenced by Arak::PointColorEstimator::estimate(), Arak::MarkovChain< ArakMarkovChainTraits >::isSample(), Arak::PointColorEstimator::recolor(), Arak::GridColorEstimator::write(), and Arak::PointSetColorEstimator::write().

template<class MarkovChainTraits>
unsigned long int Arak::MarkovChain< MarkovChainTraits >::getNumSteps  )  const [inline]
 

Returns the number of times advance() has been called.

Definition at line 173 of file mcmc.hpp.

Referenced by sampler().

template<class MarkovChainTraits>
StateType& Arak::MarkovChain< MarkovChainTraits >::getState  )  [inline]
 

Returns a mutable reference to the current state of the Markov chain.

Returns:
the current state of the Markov chain

Definition at line 124 of file mcmc.hpp.

template<class MarkovChainTraits>
const StateType& Arak::MarkovChain< MarkovChainTraits >::getState  )  const [inline]
 

Returns a const reference to the current state of the Markov chain.

Returns:
the current state of the Markov chain

Definition at line 111 of file mcmc.hpp.

Referenced by Arak::GridColorEstimator::GridColorEstimator(), Arak::PointSetColorEstimator::PointSetColorEstimator(), and sampler().

template<class MarkovChainTraits>
bool Arak::MarkovChain< MarkovChainTraits >::isSample  )  const [inline]
 

Returns true if the current state of the Markov chain is a sample.

Definition at line 189 of file mcmc.hpp.


Member Data Documentation

template<class MarkovChainTraits>
unsigned int Arak::MarkovChain< MarkovChainTraits >::burnIn [protected]
 

The number of initial samples to discard.

Definition at line 62 of file mcmc.hpp.

template<class MarkovChainTraits>
DistributionType& Arak::MarkovChain< MarkovChainTraits >::dist [protected]
 

The distribution sampled by this Markov chain.

Definition at line 32 of file mcmc.hpp.

template<class MarkovChainTraits>
double Arak::MarkovChain< MarkovChainTraits >::logLikelihood [protected]
 

The log likelihood of the current state.

Definition at line 47 of file mcmc.hpp.

template<class MarkovChainTraits>
unsigned long int Arak::MarkovChain< MarkovChainTraits >::numMoves [protected]
 

The number of changes to the state of the Markov chain.

Definition at line 57 of file mcmc.hpp.

template<class MarkovChainTraits>
unsigned long int Arak::MarkovChain< MarkovChainTraits >::numSteps [protected]
 

The number of times advance() has been called.

Definition at line 52 of file mcmc.hpp.

template<class MarkovChainTraits>
ProposalType& Arak::MarkovChain< MarkovChainTraits >::proposal [protected]
 

The proposal distribution used by this Markov chain.

Definition at line 37 of file mcmc.hpp.

template<class MarkovChainTraits>
Arak::Util::Random& Arak::MarkovChain< MarkovChainTraits >::random [protected]
 

A source of pseudorandomness.

Definition at line 27 of file mcmc.hpp.

template<class MarkovChainTraits>
StateType& Arak::MarkovChain< MarkovChainTraits >::state [protected]
 

The current state of the Markov chain.

Definition at line 42 of file mcmc.hpp.

template<class MarkovChainTraits>
unsigned int Arak::MarkovChain< MarkovChainTraits >::stride [protected]
 

The number of steps to discard in between samples.

Definition at line 67 of file mcmc.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:41:22 2005 for Arak by doxygen 1.3.6