mixpp: bdm::BM Class Reference

bdm::BM Class Reference

Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities. More...

#include <bdmbase.h>

Inheritance diagram for bdm::BM:

bdm::root bdm::BMEF bdm::BootstrapParticle bdm::EKF_UD bdm::Kalman< sq_T > bdm::Kalman< bdm::chmat > bdm::Kalman< bdm::fsqmat > bdm::MarginalizedParticleBase bdm::MultiModel bdm::NoiseParticleXY bdm::PF bdm::ProdBMBase List of all members.

Public Types

 __VA_ARGS__
enum  log_level_enums { __VA_ARGS__ }

Public Member Functions

void from_setting (const Setting &set)
void to_setting (Setting &set) const
void validate ()
 process
Constructors
virtual BM_copy () const NOT_IMPLEMENTED(NULL)
 Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually! Prototype:.
Mathematical operations
virtual void bayes (const vec &yt, const vec &cond=empty_vec)=0
 Incremental Bayes rule.
virtual double bayes_batch (const mat &Dt, const vec &cond=empty_vec)
 Batch Bayes rule (columns of Dt are observations).
virtual double bayes_batch (const mat &Dt, const mat &Cond)
 Batch Bayes rule (columns of Dt are observations, columns of Cond are conditions).
virtual double logpred (const vec &yt, const vec &cond) const NOT_IMPLEMENTED(0.0)
virtual vec samplepred (const vec &cond=empty_vec) NOT_IMPLEMENTED(empty_vec)
 Sample from predictor(cond). Implemented as sampling the joint density $ f(y_t, \theta_t) $ and discarding the sample of $ \theta_t $.
vec logpred_mat (const mat &Yt, const mat &Cond) const
 Matrix version of logpred.
virtual epdfepredictor (const vec &cond=vec()) const NOT_IMPLEMENTED(NULL)
 Constructs a predictive density $ f(d_{t+1} |d_{t}, \ldots d_{0}) $.
virtual pdfpredictor () const NOT_IMPLEMENTED(NULL)
 Constructs conditional density of 1-step ahead predictor $ f(d_{t+1} |d_{t+h-1}, \ldots d_{t}) $.
Access to attributes
access function

const RV_rvc () const
int dimensionc () const
 access function
int dimensiony () const
 access function
int dimension () const
 access function
const RV_rv () const
 access function
const RV_yrv () const
 access function
void set_yrv (const RV &rv)
 access function
void set_rvc (const RV &rv)
 access function
void set_rv (const RV &rv)
 access to rv of the posterior
void set_dim (int dim)
 access function
double _ll () const
 return internal log-likelihood of the last data vector
void set_evalll (bool evl0)
 switch evaluation of log-likelihood on/off
virtual const epdfposterior () const =0
 return posterior density
epdfprior ()
virtual void set_prior (const epdf *pdf0) NOT_IMPLEMENTED_VOID
 set prior density -- same as posterior but writable
Logging of results
virtual void log_register (logger &L, const string &prefix="")
virtual void log_write () const
 Save results to the given logger, details of what is stored is configured by LIDs and options.

Public Attributes

log_level_template< BMlog_level

Protected Attributes

RV yrv
 Random variable of the data (optional).
int dimy
 size of the data record
RV rvc
 Name of extension variable.
int dimc
 size of the conditioning vector
double ll
 Logarithm of marginalized data likelihood.
bool evalll
 If true, the filter will compute likelihood of the data record and store it in ll . Set to false if you want to save computational time.

Friends

class log_level_intermediate< BM >

Detailed Description

Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.

This object represents exact or approximate evaluation of the Bayes rule:

\[ f(\theta_t | y_1,\ldots,y_t, u_1,\ldots,u_t) = \frac{f(y_t|\theta_t,\cdot) f(\theta_t|d_1,\ldots,d_{t-1})}{f(y_t|d_1,\ldots,d_{t-1})} \]

where: $ y_t $ is the variable Access to the resulting posterior density is via function posterior().

As a "side-effect" it also evaluates log-likelihood of the data, which can be accessed via function _ll(). It can also evaluate predictors of future values of $y_t$, see functions epredictor() and predictor().

Alternatively, it can evaluate posterior density with rvc replaced by the given values, $ c_t $:

\[ f(\theta_t | c_t, d_1,\ldots,d_t) \propto f(y_t,\theta_t|c_t,\cdot, d_1,\ldots,d_{t-1}) \]


Member Function Documentation

virtual BM* bdm::BM::_copy (  )  const [virtual]

Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually! Prototype:.

 BM* _copy() const {return new BM(*this);}

Reimplemented from bdm::root.

Reimplemented in bdm::KalmanCh, bdm::EKFCh, and bdm::EKF_UD.

virtual void bdm::BM::bayes ( const vec &  yt,
const vec &  cond = empty_vec 
) [pure virtual]

Incremental Bayes rule.

Parameters:
yt vector of input data

Implemented in bdm::EKFCh_dQ, bdm::KalmanFull, bdm::KalmanCh, bdm::EKFfull, bdm::EKFCh, bdm::EKF_UD, and bdm::MixEF.

void bdm::BM::from_setting ( const Setting &  set  )  [inline, virtual]

Create object from the following structure check if not remove... rv...

    class = 'BM';
    --- optional fields ---
    log_level = "...";                                 % identifiers of levels of detail to store to loggers
    yrv = RV({'names',...},[sizes,...],[times,...]);   % names of modelled data
    rvc = RV({'names',...},[sizes,...],[times,...]);   % names of data in condition
    rv = RV({'names',...},[sizes,...],[times,...]);    % names of parameters
    --- inherited fields ---
    bdm::root::from_setting

Reimplemented from bdm::root.

Reimplemented in bdm::ARX, bdm::ARXg, bdm::Kalman< sq_T >, bdm::KalmanCh, bdm::EKFfull, bdm::EKFCh, bdm::EKF_UD, bdm::MixEF, bdm::MarginalizedParticleBase, bdm::MarginalizedParticle, bdm::BootstrapParticle, bdm::PF, bdm::BMEF, and bdm::multiBM.

void bdm::BM::log_register ( logger L,
const string &  prefix = "" 
) [virtual]

Add all logged variables to a logger Log levels two digits: xy where y = 0/1 log-likelihood is to be logged x = level of the posterior (typically 0/1/2 for nothing/mean/bounds)

Reimplemented from bdm::root.

virtual double bdm::BM::logpred ( const vec &  yt,
const vec &  cond 
) const [virtual]

Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out. Shortcut for bdm::BM::predictor().evallog(yt,cond) - sometimes easier to implement.


The documentation for this class was generated from the following files:
Generated on 2 Dec 2013 for mixpp by  doxygen 1.4.7