A base class for the Sequential Important Sampling with Resampling (SISR). Uses normal common random numbers.
More...
|
| | SISRFilterCRN (const unsigned int &rs=1) |
| | The (one and only) constructor. More...
|
| |
|
virtual | ~SISRFilterCRN () |
| | The (virtual) destructor.
|
| |
| float_t | getLogCondLike () const |
| | Returns the most recent (log-) conditional likelihood. More...
|
| |
| std::vector< Mat > | getExpectations () const |
| | return all stored expectations (taken with respect to $p(x_t|y_{1:t})$ More...
|
| |
| void | filter (const osv &data, const arrayUs &Uarr, const usvr &Uresamp, 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...
|
| |
| virtual float_t | logMuEv (const ssv &x1)=0 |
| | Calculate muEv or logmuEv. More...
|
| |
| virtual ssv | Xi1 (const usv &U, const osv &y1)=0 |
| | "Samples" from time 1 proposal. Really, it maps the normal random vector into the sample. More...
|
| |
| virtual float_t | logQ1Ev (const ssv &x1, const osv &y1)=0 |
| | Calculate q1Ev or log q1Ev. More...
|
| |
| virtual float_t | logGEv (const osv &yt, const ssv &xt)=0 |
| | Calculate gEv or logGEv. More...
|
| |
| virtual float_t | logFEv (const ssv &xt, const ssv &xtm1)=0 |
| | Evaluates the state transition density. More...
|
| |
| virtual ssv | Xit (const ssv &xtm1, const usv &U, const osv &yt)=0 |
| | "Samples" from the proposal/instrumental/importance density at time t. Really, it maps the normal random vector into the sample. More...
|
| |
| virtual float_t | logQEv (const ssv &xt, const ssv &xtm1, const osv &yt)=0 |
| | Evaluates the proposal/instrumental/importance density/pmf. More...
|
| |
| virtual void | filter (const obs_sized_vec &data, const std::array< usv, numparts > &Us, const usvr &Uresamp, const func_vec &fs=func_vec())=0 |
| | the filtering function that must be defined More...
|
| |
| virtual float_t | getLogCondLike () const=0 |
| | the getter method that must be defined (for conditional log-likelihood) More...
|
| |
|
virtual | ~pf_base_crn () |
| | virtual destructor
|
| |
|
| using | ssv = Eigen::Matrix< float_t, dimx, 1 > |
| |
| using | osv = Eigen::Matrix< float_t, dimy, 1 > |
| |
| using | usv = Eigen::Matrix< float_t, dimu, 1 > |
| |
| using | usvr = Eigen::Matrix< float_t, dimur, 1 > |
| |
| using | Mat = Eigen::Matrix< float_t, Eigen::Dynamic, Eigen::Dynamic > |
| |
| using | arrayStates = std::array< ssv, nparts > |
| |
| using | arrayUs = std::array< usv, nparts > |
| |
| using | arrayfloat_t = std::array< float_t, nparts > |
| |
|
|
using | float_type = float_t |
| |
|
using | obs_sized_vec = Eigen::Matrix< float_t, dimobs, 1 > |
| |
|
using | state_sized_vec = Eigen::Matrix< float_t, dimstate, 1 > |
| |
|
using | dynamic_matrix = Eigen::Matrix< float_t, Eigen::Dynamic, Eigen::Dynamic > |
| |
|
using | func = std::function< const dynamic_matrix(const state_sized_vec &)> |
| |
|
using | func_vec = std::vector< func > |
| |
|
using | usv = Eigen::Matrix< float_t, dimu, 1 > |
| |
|
using | usvr = Eigen::Matrix< float_t, dimur, 1 > |
| |
|
static constexpr unsigned int | dim_obs |
| |
|
static constexpr unsigned int | dim_state |
| |
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t, typename float_t, bool debug = false>
class pf::filters::SISRFilterCRN< nparts, dimx, dimy, dimu, dimur, resamp_t, float_t, debug >
A base class for the Sequential Important Sampling with Resampling (SISR). Uses normal common random numbers.
- Author
- taylor
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
type alias for array of common random numbers
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
| using pf::filters::SISRFilterCRN< nparts, dimx, dimy, dimu, dimur, resamp_t, float_t, debug >::Mat = Eigen::Matrix<float_t,Eigen::Dynamic,Eigen::Dynamic> |
|
private |
type alias for linear algebra stuff
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"obs size vector" type alias for linear algebra stuff
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"state size vector" type alias for linear algebra stuff
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"u sized vector" type alias for common random normal vector
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"u sized vector for resampling" type alias for common random normal vector that's used in systematic resampling
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug>
The (one and only) constructor.
- Parameters
-
| rs | the resampling schedule (resample every rs time points). |
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug>
| void pf::filters::SISRFilterCRN< nparts, dimx, dimy, dimu, dimur, resamp_t, float_t, debug >::filter |
( |
const osv & |
data, |
|
|
const arrayUs & |
Uarr, |
|
|
const usvr & |
Uresamp, |
|
|
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
-
| data | the most recent data point |
| Uarr | the U samples that get used to sample from the state proposal |
| Uresamp | the U sample that is used to resample |
| fs | a vector of functions if you want to calculate expectations. |
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug>
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, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug>
Returns the most recent (log-) conditional likelihood.
- Returns
- log p(y_t | y_{1:t-1}) or log p(y_1)
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
Evaluates the state transition density.
- Parameters
-
| xt | the current state |
| xtm1 | the previous state |
- Returns
- a float_t evaluaton of the log density/pmf
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
Calculate muEv or logmuEv.
- Parameters
-
| x1 | is a const Vec& describing the state sample |
- Returns
- the density or log-density evaluation as a float_t
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
Calculate q1Ev or log q1Ev.
- Parameters
-
| x1 | is a const Vec& describing the time 1 state sample |
| y1 | is a const Vec& describing the time 1 datum |
- Returns
- the density or log-density evaluation as a float_t
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
Evaluates the proposal/instrumental/importance density/pmf.
- Parameters
-
| xt | current state |
| xtm1 | previous state |
| yt | current observation |
- Returns
- a float_t evaluation of the log density/pmf
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"Samples" from time 1 proposal. Really, it maps the normal random vector into the sample.
- Parameters
-
| U | the normal random vector transformed into X1i |
| y1 | is a const Vec& representing the first observed datum |
- Returns
- the sample as a Vec
template<size_t nparts, size_t dimx, size_t dimy, size_t dimu, size_t dimur, typename resamp_t , typename float_t , bool debug = false>
"Samples" from the proposal/instrumental/importance density at time t. Really, it maps the normal random vector into the sample.
- Parameters
-
| xtm1 | the previous state sample |
| U | the normal random vector transformed |
| yt | the current observation |
- Returns
- a state sample for the current time xt