pf
pf::BSFilter< nparts, dimx, dimy, resampT > Class Template Referenceabstract

A base class for the boostrap particle filter. More...

#include <bootstrap_filter.h>

Public Types

using ssv = Eigen::Matrix< double, dimx, 1 >
 
using osv = Eigen::Matrix< double, dimy, 1 >
 
using Mat = Eigen::Matrix< double, dimx, dimx >
 
using arrayStates = std::array< ssv, nparts >
 
using arrayDouble = std::array< double, nparts >
 

Public Member Functions

 BSFilter (const unsigned int &rs=1)
 The constructor. More...
 
double getLogCondLike () const
 Returns the most recent (log-) conditiona likelihood. More...
 
void filter (const osv &data, const std::vector< std::function< const Mat(const ssv &)> > &fs=std::vector< std::function< const Mat(const ssv &)> >())
 updates filtering distribution on a new datapoint. Optionally stores expectations of functionals. More...
 
auto getExpectations () const -> std::vector< Mat >
 return all stored expectations (taken with respect to $p(x_t|y_{1:t})$ More...
 
virtual double logMuEv (const ssv &x1)=0
 Calculate muEv or logmuEv. More...
 
virtual ssv q1Samp (const osv &y1)=0
 Samples from time 1 proposal. More...
 
virtual double logQ1Ev (const ssv &x1, const osv &y1)=0
 Calculate q1Ev or log q1Ev. More...
 
virtual double logGEv (const osv &yt, const ssv &xt)=0
 Calculate gEv or logGEv. More...
 
virtual ssv fSamp (const ssv &xtm1)=0
 Sample from the state transition distribution. More...
 

Protected Attributes

arrayStates m_particles
 particle samples
 
arrayDouble m_logUnNormWeights
 particle unnormalized weights
 
unsigned int m_now
 time point
 
double m_logLastCondLike
 log p(y_t|y_{1:t-1}) or log p(y1)
 
resampT m_resampler
 resampler object
 
std::vector< Matm_expectations
 expectations E[h(x_t) | y_{1:t}] for user defined "h"s
 
unsigned int m_resampSched
 resampling schedule (e.g. resample every __ time points)
 

Detailed Description

template<size_t nparts, size_t dimx, size_t dimy, typename resampT>
class pf::BSFilter< nparts, dimx, dimy, resampT >

A base class for the boostrap particle filter.

Author
taylor

Member Typedef Documentation

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
using pf::BSFilter< nparts, dimx, dimy, resampT >::arrayDouble = std::array<double, nparts>

type alias for array of doubles

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
using pf::BSFilter< nparts, dimx, dimy, resampT >::arrayStates = std::array<ssv, nparts>

type alias for linear algebra stuff

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
using pf::BSFilter< nparts, dimx, dimy, resampT >::Mat = Eigen::Matrix<double, dimx, dimx>

type alias for linear algebra stuff

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
using pf::BSFilter< nparts, dimx, dimy, resampT >::osv = Eigen::Matrix<double, dimy, 1>

"obs size vector" type alias for linear algebra stuff

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
using pf::BSFilter< nparts, dimx, dimy, resampT >::ssv = Eigen::Matrix<double, dimx, 1>

"state size vector" type alias for linear algebra stuff

Constructor & Destructor Documentation

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
pf::BSFilter< nparts, dimx, dimy, resampT >::BSFilter ( const unsigned int &  rs = 1)

The constructor.

Parameters
rsthe resampling schedule (e.g. every rs time point)

Member Function Documentation

template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
void pf::BSFilter< nparts, dimx, dimy, resampT >::filter ( const osv data,
const std::vector< std::function< const Mat(const ssv &)> > &  fs = std::vector<std::function<const Mat(const ssv&)> >() 
)

updates filtering distribution on a new datapoint. Optionally stores expectations of functionals.

Parameters
datathe most recent data point
fsa vector of functions if you want to calculate expectations.
Todo:
: work in support for effective sample size stuff.
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
virtual ssv pf::BSFilter< nparts, dimx, dimy, resampT >::fSamp ( const ssv xtm1)
pure virtual

Sample from the state transition distribution.

Parameters
xtm1is a const Vec& describing the time t-1 state
Returns
the sample as a Vec
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
auto pf::BSFilter< nparts, dimx, dimy, resampT >::getExpectations ( ) const -> std::vector<Mat>

return all stored expectations (taken with respect to $p(x_t|y_{1:t})$

Returns
return a std::vector<Mat> of expectations. How many depends on how many callbacks you gave to
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
double pf::BSFilter< nparts, dimx, dimy, resampT >::getLogCondLike ( ) const

Returns the most recent (log-) conditiona likelihood.

Returns
log p(y_t | y_{1:t-1})
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
virtual double pf::BSFilter< nparts, dimx, dimy, resampT >::logGEv ( const osv yt,
const ssv xt 
)
pure virtual

Calculate gEv or logGEv.

Parameters
ytis a const Vec& describing the time t datum
xtis a const Vec& describing the time t state
Returns
the density or log-density evaluation as a double
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
virtual double pf::BSFilter< nparts, dimx, dimy, resampT >::logMuEv ( const ssv x1)
pure virtual

Calculate muEv or logmuEv.

Parameters
x1is a const Vec& describing the state sample
Returns
the density or log-density evaluation as a double
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
virtual double pf::BSFilter< nparts, dimx, dimy, resampT >::logQ1Ev ( const ssv x1,
const osv y1 
)
pure virtual

Calculate q1Ev or log q1Ev.

Parameters
x1is a const Vec& describing the time 1 state sample
y1is a const Vec& describing the time 1 datum
Returns
the density or log-density evaluation as a double
template<size_t nparts, size_t dimx, size_t dimy, typename resampT >
virtual ssv pf::BSFilter< nparts, dimx, dimy, resampT >::q1Samp ( const osv y1)
pure virtual

Samples from time 1 proposal.

Parameters
y1is a const Vec& representing the first observed datum
Returns
the sample as a Vec

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