Public Member Functions | Protected Member Functions | Private Attributes
vpdfl_pdf_base Class Reference

Base class for Multi-Variate Probability Density Function classes. More...

#include <vpdfl_pdf_base.h>

Inheritance diagram for vpdfl_pdf_base:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vpdfl_pdf_base ()
 Dflt ctor.
virtual ~vpdfl_pdf_base ()
 Destructor.
const vnl_vector< double > & mean () const
 Mean of distribution.
const vnl_vector< double > & variance () const
 Variance of each dimension.
int n_dims () const
 Number of dimensions.
virtual int n_peaks () const
 Number of peaks of distribution.
virtual const vnl_vector
< double > & 
peak (int) const
 Position of the i'th peak.
virtual double log_p (const vnl_vector< double > &x) const =0
 Log of probability density at x.
virtual double operator() (const vnl_vector< double > &x) const
 Probability density at x.
virtual void gradient (vnl_vector< double > &g, const vnl_vector< double > &x, double &p) const =0
 Gradient and value of PDF at x.
virtual void gradient_logp (vnl_vector< double > &g, const vnl_vector< double > &x) const
 Gradient and value of log(p(x)) at x.
virtual vpdfl_sampler_basenew_sampler () const =0
 Create a sampler object on the heap.
virtual double log_prob_thresh (double pass_proportion) const
 Compute threshold for PDF to pass a given proportion.
virtual void nearest_plausible (vnl_vector< double > &x, double log_p_min) const =0
 Compute nearest point to x which has a density above a threshold.
virtual bool is_valid_pdf () const
 Return true if the object represents a valid PDF.
short version_no () const
 Version number for I/O.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Does the name of the class match the argument?.
virtual vpdfl_pdf_baseclone () const =0
 Create a copy on the heap and return base class pointer.
virtual void print_summary (vcl_ostream &os) const =0
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const =0
 Save class to binary file stream.
virtual void b_read (vsl_b_istream &bfs)=0
 Load class from binary file stream.

Protected Member Functions

void set_mean (const vnl_vector< double > &m)
void set_variance (const vnl_vector< double > &v)

Private Attributes

vnl_vector< double > mean_
vnl_vector< double > var_

Detailed Description

Base class for Multi-Variate Probability Density Function classes.

Functions are available to test the plausibility of a vector or set of parameters, to modify a set of parameters so it is plausible and to choose a threshold of plausibility. Also, for cases where the distributions of parameters are multi-modal, the number and centres of each peak can be recorded. This is particularly useful for non-linear and mixture model representations of the parameter distributions.

Definition at line 30 of file vpdfl_pdf_base.h.


Constructor & Destructor Documentation

vpdfl_pdf_base::vpdfl_pdf_base ( )

Dflt ctor.

Definition at line 22 of file vpdfl_pdf_base.cxx.

vpdfl_pdf_base::~vpdfl_pdf_base ( ) [virtual]

Destructor.

Definition at line 28 of file vpdfl_pdf_base.cxx.


Member Function Documentation

void vpdfl_pdf_base::b_read ( vsl_b_istream bfs) [pure virtual]

Load class from binary file stream.

Implemented in vpdfl_mixture, vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_axis_gaussian, vpdfl_kernel_pdf, and vpdfl_gaussian_kernel_pdf.

Definition at line 210 of file vpdfl_pdf_base.cxx.

void vpdfl_pdf_base::b_write ( vsl_b_ostream bfs) const [pure virtual]

Save class to binary file stream.

Implemented in vpdfl_mixture, vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_axis_gaussian, vpdfl_kernel_pdf, and vpdfl_gaussian_kernel_pdf.

Definition at line 200 of file vpdfl_pdf_base.cxx.

virtual vpdfl_pdf_base* vpdfl_pdf_base::clone ( ) const [pure virtual]

Create a copy on the heap and return base class pointer.

Implemented in vpdfl_mixture, vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_axis_gaussian, and vpdfl_gaussian_kernel_pdf.

virtual void vpdfl_pdf_base::gradient ( vnl_vector< double > &  g,
const vnl_vector< double > &  x,
double &  p 
) const [pure virtual]

Gradient and value of PDF at x.

Computes gradient of PDF at x, and returns the prob at x in p

Implemented in vpdfl_gaussian, vpdfl_axis_gaussian, vpdfl_mixture, and vpdfl_gaussian_kernel_pdf.

void vpdfl_pdf_base::gradient_logp ( vnl_vector< double > &  g,
const vnl_vector< double > &  x 
) const [virtual]

Gradient and value of log(p(x)) at x.

Gradient of log(p(x)) at x.

Computes gradient df/dx of f(x)=log(p(x)) at x. Result is vector of same dimensionality as x. Default baseclass implementation uses gradient() to compute grad/p

Computes gradient df/dx of f(x)=log(p(x)) at x. Default baseclass implementation uses gradient() to compute grad/p

Reimplemented in vpdfl_axis_gaussian.

Definition at line 127 of file vpdfl_pdf_base.cxx.

vcl_string vpdfl_pdf_base::is_a ( ) const [virtual]
bool vpdfl_pdf_base::is_class ( vcl_string const &  s) const [virtual]

Does the name of the class match the argument?.

Reimplemented in vpdfl_mixture, vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_axis_gaussian, vpdfl_kernel_pdf, and vpdfl_gaussian_kernel_pdf.

Definition at line 171 of file vpdfl_pdf_base.cxx.

bool vpdfl_pdf_base::is_valid_pdf ( ) const [virtual]

Return true if the object represents a valid PDF.

This will return false, if n_dims() is 0, for example just ofter default construction.

Reimplemented in vpdfl_mixture.

Definition at line 141 of file vpdfl_pdf_base.cxx.

virtual double vpdfl_pdf_base::log_p ( const vnl_vector< double > &  x) const [pure virtual]

Log of probability density at x.

Implemented in vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_mixture, vpdfl_axis_gaussian, and vpdfl_gaussian_kernel_pdf.

double vpdfl_pdf_base::log_prob_thresh ( double  pass_proportion) const [virtual]

Compute threshold for PDF to pass a given proportion.

Reimplemented in vpdfl_gaussian, and vpdfl_axis_gaussian.

Definition at line 40 of file vpdfl_pdf_base.cxx.

const vnl_vector<double>& vpdfl_pdf_base::mean ( ) const [inline]

Mean of distribution.

Definition at line 46 of file vpdfl_pdf_base.h.

int vpdfl_pdf_base::n_dims ( ) const [inline]

Number of dimensions.

Definition at line 52 of file vpdfl_pdf_base.h.

virtual int vpdfl_pdf_base::n_peaks ( ) const [inline, virtual]

Number of peaks of distribution.

Definition at line 55 of file vpdfl_pdf_base.h.

virtual void vpdfl_pdf_base::nearest_plausible ( vnl_vector< double > &  x,
double  log_p_min 
) const [pure virtual]

Compute nearest point to x which has a density above a threshold.

If log_p(x)>log_p_min then x unchanged. Otherwise x is moved (typically up the gradient) until log_p(x)>=log_p_min.

Parameters:
xThis may be modified to the nearest plausible position.
log_p_minlower threshold for log_p(x)

Implemented in vpdfl_gaussian, vpdfl_axis_gaussian, vpdfl_mixture, and vpdfl_gaussian_kernel_pdf.

virtual vpdfl_sampler_base* vpdfl_pdf_base::new_sampler ( ) const [pure virtual]

Create a sampler object on the heap.

Caller is responsible for deletion.

Implemented in vpdfl_gaussian, vpdfl_mixture, vpdfl_axis_gaussian, and vpdfl_gaussian_kernel_pdf.

double vpdfl_pdf_base::operator() ( const vnl_vector< double > &  x) const [virtual]

Probability density at x.

Reimplemented in vpdfl_mixture, and vpdfl_gaussian_kernel_pdf.

Definition at line 34 of file vpdfl_pdf_base.cxx.

virtual const vnl_vector<double>& vpdfl_pdf_base::peak ( int  ) const [inline, virtual]

Position of the i'th peak.

Definition at line 58 of file vpdfl_pdf_base.h.

void vpdfl_pdf_base::print_summary ( vcl_ostream &  os) const [pure virtual]
void vpdfl_pdf_base::set_mean ( const vnl_vector< double > &  m) [inline, protected]

Reimplemented in vpdfl_gaussian.

Definition at line 35 of file vpdfl_pdf_base.h.

void vpdfl_pdf_base::set_variance ( const vnl_vector< double > &  v) [inline, protected]

Definition at line 36 of file vpdfl_pdf_base.h.

const vnl_vector<double>& vpdfl_pdf_base::variance ( ) const [inline]

Variance of each dimension.

Definition at line 49 of file vpdfl_pdf_base.h.

short vpdfl_pdf_base::version_no ( ) const

Version number for I/O.

Reimplemented in vpdfl_mixture, vpdfl_gaussian, vpdfl_pc_gaussian, vpdfl_axis_gaussian, vpdfl_kernel_pdf, and vpdfl_gaussian_kernel_pdf.

Definition at line 149 of file vpdfl_pdf_base.cxx.


Member Data Documentation

vnl_vector<double> vpdfl_pdf_base::mean_ [private]

Definition at line 32 of file vpdfl_pdf_base.h.

vnl_vector<double> vpdfl_pdf_base::var_ [private]

Definition at line 33 of file vpdfl_pdf_base.h.


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