KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
Mv_gaussian_proposer< VectorModel > Class Template Reference

#include <sample_vector.h>

Public Member Functions

 Mv_gaussian_proposer (const kjb::Matrix &covariance)
 Construct a Mv_gaussian_proposer. More...
 
void set_temperature (double t)
 
Mh_proposal_result operator() (const VectorModel &m, VectorModel &mp) const
 Propose a new value. More...
 
const kjb::Matrixget_unscaled_cholesky_covariance () const
 
kjb::Matrix get_covariance () const
 
double get_global_scale () const
 
template<class VectorType >
void adapt_covariance (const VectorType &delta, double gamma)
 
void adapt_global_scale (double x)
 
void rank_1_update (kjb::Matrix &C, const VectorModel &delta, double gamma)
 
void rank_1_update_2 (kjb::Matrix &C, const VectorModel &delta, double gamma)
 
void rank_1_update_ref (kjb::Matrix &C, const VectorModel &delta, double gamma)
 

Detailed Description

template<typename VectorModel>
class Mv_gaussian_proposer< VectorModel >

Simple multi-variate Gaussian random-walk proposer. Given a vector x, this object will propose x' ~ N(x, s), where s is provided at construction.

Constructor & Destructor Documentation

template<typename VectorModel >
Mv_gaussian_proposer< VectorModel >::Mv_gaussian_proposer ( const kjb::Matrix covariance)
inline

Construct a Mv_gaussian_proposer.

Member Function Documentation

template<typename VectorModel >
template<class VectorType >
void Mv_gaussian_proposer< VectorModel >::adapt_covariance ( const VectorType &  delta,
double  gamma 
)
inline

Update the empirical estimate of the covariance matrix C given a new observation. The update uses the following recurrence relation: C_i+1 = C_i + gamma * (delta * delta' - C_i) Here, gamma is the learning rate, and should be << 1.0. delta is the difference between the observed point and the empirical mean (which should also be maintained and updated, but this is the responsibility of the caller).

In practice, the cholesky decomposition of the covariance matrix is updated, and is done efficiently in O(n^2) by performing a rank-1 update.

template<typename VectorModel >
void Mv_gaussian_proposer< VectorModel >::adapt_global_scale ( double  x)
inline

update global scaling factor, lambda by a factor x using: log(lambda) += x

In general x will be: x = gamma * (alpha - alpha_goal) where alpha is the accept-probability of the current MH step, alpha_star is the desired acceptance rate, and gamma is the learning rate (<< 1.0)

template<typename VectorModel >
kjb::Matrix Mv_gaussian_proposer< VectorModel >::get_covariance ( ) const
inline
template<typename VectorModel >
double Mv_gaussian_proposer< VectorModel >::get_global_scale ( ) const
inline

get global scaling constant

template<typename VectorModel >
const kjb::Matrix& Mv_gaussian_proposer< VectorModel >::get_unscaled_cholesky_covariance ( ) const
inline

get cholesky decomposition of covariance matrix before incorporating global scale. This should be multiplied by the global scale to get the actual covariance

template<typename VectorModel >
Mh_proposal_result Mv_gaussian_proposer< VectorModel >::operator() ( const VectorModel m,
VectorModel mp 
) const
inline

Propose a new value.

template<typename VectorModel >
void Mv_gaussian_proposer< VectorModel >::rank_1_update ( kjb::Matrix C,
const VectorModel delta,
double  gamma 
)
inline

reference: A tutorial on adaptive MCMC, Andrieu, Thoms 2008.

template<typename VectorModel >
void Mv_gaussian_proposer< VectorModel >::rank_1_update_2 ( kjb::Matrix C,
const VectorModel delta,
double  gamma 
)
inline

From wikipedia's Cholesky decomposition page, section "Rank-1 update"

template<typename VectorModel >
void Mv_gaussian_proposer< VectorModel >::rank_1_update_ref ( kjb::Matrix C,
const VectorModel delta,
double  gamma 
)
inline

long-form solution; slow–for reference only

template<typename VectorModel >
void Mv_gaussian_proposer< VectorModel >::set_temperature ( double  t)
inline

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