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

Approximates the gradient and/or curvature of a target distribution, evaluated at a certain location. The user must provide the mechanisms to change the model (see constructor). More...

#include <sample_default.h>

Inheritance diagram for Numerical_gradient< Model >:
Real_numerical_gradient< Model > Vector_numerical_gradient< Model >

Public Types

typedef Model_evaluator< Model >
::Type 
Target_distribution
 
typedef Move_model_parameter
< Model >::Type 
Move_parameter
 
typedef
Model_parameter_evaluator
< Model >::Type 
Get_neighborhood
 
typedef Model_dimension< Model >
::Type 
Get_dimension
 

Public Member Functions

 Numerical_gradient (const Target_distribution &log_target, const Move_parameter &move_param, const Get_neighborhood &get_neighbors, const Get_dimension &get_dim)
 Construct a gradient approximation functor. More...
 
kjb::Vector operator() (const Model &q) const
 Evaluates gradient at q. More...
 
kjb::Vector curvature (const Model &q) const
 
kjb::Vector gradient (const Model &q) const
 
void gradient_and_curvature (const Model &q, kjb::Vector &gradient, kjb::Vector &curvature) const
 

Detailed Description

template<typename Model>
class Numerical_gradient< Model >

Approximates the gradient and/or curvature of a target distribution, evaluated at a certain location. The user must provide the mechanisms to change the model (see constructor).

Note
curvature is only computed in the direction of the axes.

Member Typedef Documentation

template<typename Model >
typedef Model_dimension<Model>::Type Numerical_gradient< Model >::Get_dimension
template<typename Model >
typedef Model_parameter_evaluator<Model>::Type Numerical_gradient< Model >::Get_neighborhood
template<typename Model >
typedef Move_model_parameter<Model>::Type Numerical_gradient< Model >::Move_parameter
template<typename Model >
typedef Model_evaluator<Model>::Type Numerical_gradient< Model >::Target_distribution

Constructor & Destructor Documentation

template<typename Model >
Numerical_gradient< Model >::Numerical_gradient ( const Target_distribution log_target,
const Move_parameter move_param,
const Get_neighborhood get_neighbors,
const Get_dimension get_dim 
)
inline

Construct a gradient approximation functor.

Parameters
log_targetThe log of the target distribution.
move_paramMechanism to 'move' a parameter of the model by a delta.
get_neighborsMechamisn to get the neighborhood of the current model location. We allow this to be a function of the current model.
get_dimMechanism to obtain the dimension of the model.

Member Function Documentation

template<typename Model >
kjb::Vector Numerical_gradient< Model >::curvature ( const Model &  q) const
inline
template<typename Model >
kjb::Vector Numerical_gradient< Model >::gradient ( const Model &  q) const
inline
template<typename Model >
void Numerical_gradient< Model >::gradient_and_curvature ( const Model &  q,
kjb::Vector gradient,
kjb::Vector curvature 
) const
inline
template<typename Model >
kjb::Vector Numerical_gradient< Model >::operator() ( const Model &  q) const
inline

Evaluates gradient at q.


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