Fleet  0.0.9
Inference in the LOT
Public Types | Public Member Functions | Public Attributes | List of all members
MCMCChain< _HYP > Class Template Reference

#include <MCMCChain.h>

Collaboration diagram for MCMCChain< _HYP >:
Collaboration graph
[legend]

Public Types

using HYP = _HYP
 

Public Member Functions

 MCMCChain (HYP &h0, typename HYP::data_t *d)
 
 MCMCChain (HYP &&h0, typename HYP::data_t *d)
 
 MCMCChain (const MCMCChain &m)
 
 MCMCChain (MCMCChain &&m)
 
virtual ~MCMCChain ()
 
void set_data (typename HYP::data_t *d, bool recompute_posterior=true)
 Set this data. More...
 
HYPgetCurrent ()
 
const HYPgetCurrent () const
 
void runOnCurrent ()
 
const HYPgetMax ()
 
void restart ()
 
virtual bool check (HYP &p)
 This allows us to overwrite/enforce stuff about proposals in subclasses of MCMCChain. More...
 
generator< HYP & > run (Control ctl)
 Run MCMC according to the control parameters passed in. NOTE: ctl cannot be passed by reference. More...
 
void run ()
 
double acceptance_ratio ()
 
double at_temperature (double t)
 

Public Attributes

HYP current
 
OrderedLock current_mutex
 
HYP::data_t * data
 
double maxval
 
unsigned long samples
 
unsigned long proposals
 
unsigned long acceptances
 
unsigned long steps_since_improvement
 
std::atomic< double > temperature
 
FiniteHistory< bool > history
 

Detailed Description

template<typename _HYP>
class MCMCChain< _HYP >

Author
Steven Piantadosi
Date
25/10/21

Member Typedef Documentation

◆ HYP

template<typename _HYP>
using MCMCChain< _HYP >::HYP = _HYP

Constructor & Destructor Documentation

◆ MCMCChain() [1/4]

template<typename _HYP>
MCMCChain< _HYP >::MCMCChain ( HYP h0,
typename HYP::data_t *  d 
)
inline

◆ MCMCChain() [2/4]

template<typename _HYP>
MCMCChain< _HYP >::MCMCChain ( HYP &&  h0,
typename HYP::data_t *  d 
)
inline

◆ MCMCChain() [3/4]

template<typename _HYP>
MCMCChain< _HYP >::MCMCChain ( const MCMCChain< _HYP > &  m)
inline

◆ MCMCChain() [4/4]

template<typename _HYP>
MCMCChain< _HYP >::MCMCChain ( MCMCChain< _HYP > &&  m)
inline

◆ ~MCMCChain()

template<typename _HYP>
virtual MCMCChain< _HYP >::~MCMCChain ( )
inlinevirtual

Member Function Documentation

◆ acceptance_ratio()

template<typename _HYP>
double MCMCChain< _HYP >::acceptance_ratio ( )
inline

Get my acceptance ratio

Returns

◆ at_temperature()

template<typename _HYP>
double MCMCChain< _HYP >::at_temperature ( double  t)
inline

Return my current posterior at a given temperature t

Parameters
t
Returns

◆ check()

template<typename _HYP>
virtual bool MCMCChain< _HYP >::check ( HYP p)
inlinevirtual

This allows us to overwrite/enforce stuff about proposals in subclasses of MCMCChain.

Parameters
p
Returns

Reimplemented in ConstrainedMCMC< HYP >.

◆ getCurrent() [1/2]

template<typename _HYP>
HYP& MCMCChain< _HYP >::getCurrent ( )
inline

get a reference to the current value

Returns

◆ getCurrent() [2/2]

template<typename _HYP>
const HYP& MCMCChain< _HYP >::getCurrent ( ) const
inline

get a reference to the current value

Returns

◆ getMax()

template<typename _HYP>
const HYP& MCMCChain< _HYP >::getMax ( )
inline

◆ restart()

template<typename _HYP>
void MCMCChain< _HYP >::restart ( )
inline

◆ run() [1/2]

template<typename _HYP>
generator<HYP&> MCMCChain< _HYP >::run ( Control  ctl)
inline

Run MCMC according to the control parameters passed in. NOTE: ctl cannot be passed by reference.

Parameters
ctl

◆ run() [2/2]

template<typename _HYP>
void MCMCChain< _HYP >::run ( )
inline

Run forever

◆ runOnCurrent()

template<typename _HYP>
void MCMCChain< _HYP >::runOnCurrent ( )
inline

This is called by the constructor to compute the posterior. NOTE it does not callback

◆ set_data()

template<typename _HYP>
void MCMCChain< _HYP >::set_data ( typename HYP::data_t *  d,
bool  recompute_posterior = true 
)
inline

Set this data.

Parameters
d- what data to set
recompute_posterior- should I recompute the posterior on current?

Member Data Documentation

◆ acceptances

template<typename _HYP>
unsigned long MCMCChain< _HYP >::acceptances

◆ current

template<typename _HYP>
HYP MCMCChain< _HYP >::current

◆ current_mutex

template<typename _HYP>
OrderedLock MCMCChain< _HYP >::current_mutex
mutable

◆ data

template<typename _HYP>
HYP::data_t* MCMCChain< _HYP >::data

◆ history

template<typename _HYP>
FiniteHistory<bool> MCMCChain< _HYP >::history

◆ maxval

template<typename _HYP>
double MCMCChain< _HYP >::maxval

◆ proposals

template<typename _HYP>
unsigned long MCMCChain< _HYP >::proposals

◆ samples

template<typename _HYP>
unsigned long MCMCChain< _HYP >::samples

◆ steps_since_improvement

template<typename _HYP>
unsigned long MCMCChain< _HYP >::steps_since_improvement

◆ temperature

template<typename _HYP>
std::atomic<double> MCMCChain< _HYP >::temperature

The documentation for this class was generated from the following file: