Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vpdfl_kernel_pdf Class Reference

#include <vpdfl_kernel_pdf.h>

Inheritance diagram for vpdfl_kernel_pdf:

Inheritance graph
[legend]
List of all members.

Detailed Description

Multi-variate kernel PDF.

Distribution is the sum of a set of kernel functions placed on the training samples.

Essentially a special case of a mixture model. It differs from the former in that a) every component has the same shape, though possibly a different width b) every component has the same weight c) Usually one uses different training algorithms.

Definition at line 24 of file vpdfl_kernel_pdf.h.

Public Member Functions

 vpdfl_kernel_pdf ()
 Dflt ctor.
virtual ~vpdfl_kernel_pdf ()
 Destructor.
void set_centres (const vnl_vector< double > *x, int n, double width)
 Initialise so all kernels have the same width.
void set_centres (const vnl_vector< double > *x, int n, const vnl_vector< double > &width)
 Initialise so all kernels have given width.
const vcl_vector< vnl_vector<
double > > & 
centre () const
 Position of kernel centres.
const vnl_vector< double > & width () const
 Width of each kernel.
bool all_same_width () const
 True if all kernels have the same width.
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 void print_summary (vcl_ostream &os) const
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const
 Save class to binary file stream.
virtual void b_read (vsl_b_istream &bfs)
 Load class from binary file stream.
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.
virtual vpdfl_pdf_baseclone () const =0
 Create a copy on the heap and return base class pointer.

Protected Member Functions

void calc_mean_var ()
 Compute mean/variance given current centres and widths.
void set_mean (const vnl_vector< double > &m)
void set_variance (const vnl_vector< double > &v)

Protected Attributes

vcl_vector< vnl_vector< double > > x_
 Position of kernel centres.
vnl_vector< double > width_
 Width of each kernel.
bool all_same_width_
 True if all kernels have the same width.


Constructor & Destructor Documentation

vpdfl_kernel_pdf::vpdfl_kernel_pdf  ) 
 

Dflt ctor.

Definition at line 20 of file vpdfl_kernel_pdf.cxx.

vpdfl_kernel_pdf::~vpdfl_kernel_pdf  )  [virtual]
 

Destructor.

Definition at line 28 of file vpdfl_kernel_pdf.cxx.


Member Function Documentation

bool vpdfl_kernel_pdf::all_same_width  )  const [inline]
 

True if all kernels have the same width.

Definition at line 63 of file vpdfl_kernel_pdf.h.

void vpdfl_kernel_pdf::b_read vsl_b_istream bfs  )  [virtual]
 

Load class from binary file stream.

Implements vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 144 of file vpdfl_kernel_pdf.cxx.

void vpdfl_kernel_pdf::b_write vsl_b_ostream bfs  )  const [virtual]
 

Save class to binary file stream.

Implements vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 132 of file vpdfl_kernel_pdf.cxx.

void vpdfl_kernel_pdf::calc_mean_var  )  [protected]
 

Compute mean/variance given current centres and widths.

Definition at line 33 of file vpdfl_kernel_pdf.cxx.

const vcl_vector<vnl_vector<double> >& vpdfl_kernel_pdf::centre  )  const [inline]
 

Position of kernel centres.

Definition at line 57 of file vpdfl_kernel_pdf.h.

virtual vpdfl_pdf_base* vpdfl_pdf_base::clone  )  const [pure virtual, inherited]
 

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

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

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

Gradient and value of PDF at x.

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

Implemented in vpdfl_axis_gaussian, vpdfl_gaussian, vpdfl_gaussian_kernel_pdf, and vpdfl_mixture.

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

Gradient and value 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

Reimplemented in vpdfl_axis_gaussian.

Definition at line 127 of file vpdfl_pdf_base.cxx.

vcl_string vpdfl_kernel_pdf::is_a  )  const [virtual]
 

Name of the class.

Reimplemented from vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 94 of file vpdfl_kernel_pdf.cxx.

bool vpdfl_kernel_pdf::is_class vcl_string const &  s  )  const [virtual]
 

Does the name of the class match the argument?.

Reimplemented from vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 104 of file vpdfl_kernel_pdf.cxx.

bool vpdfl_pdf_base::is_valid_pdf  )  const [virtual, inherited]
 

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, inherited]
 

Log of probability density at x.

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

double vpdfl_pdf_base::log_prob_thresh double  pass_proportion  )  const [virtual, inherited]
 

Compute threshold for PDF to pass a given proportion.

Reimplemented in vpdfl_axis_gaussian, and vpdfl_gaussian.

Definition at line 40 of file vpdfl_pdf_base.cxx.

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

Mean of distribution.

Definition at line 45 of file vpdfl_pdf_base.h.

int vpdfl_pdf_base::n_dims  )  const [inline, inherited]
 

Number of dimensions.

Definition at line 51 of file vpdfl_pdf_base.h.

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

Number of peaks of distribution.

Definition at line 54 of file vpdfl_pdf_base.h.

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

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:
x This may be modified to the nearest plausible position.
log_p_min lower threshold for log_p(x)

Implemented in vpdfl_axis_gaussian, vpdfl_gaussian, vpdfl_gaussian_kernel_pdf, and vpdfl_mixture.

virtual vpdfl_sampler_base* vpdfl_pdf_base::new_sampler  )  const [pure virtual, inherited]
 

Create a sampler object on the heap.

Caller is responsible for deletion.

Implemented in vpdfl_axis_gaussian, vpdfl_gaussian, vpdfl_gaussian_kernel_pdf, and vpdfl_mixture.

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

Probability density at x.

Reimplemented in vpdfl_gaussian_kernel_pdf, and vpdfl_mixture.

Definition at line 34 of file vpdfl_pdf_base.cxx.

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

Position of the i'th peak.

Definition at line 57 of file vpdfl_pdf_base.h.

void vpdfl_kernel_pdf::print_summary vcl_ostream &  os  )  const [virtual]
 

Print class to os.

Implements vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 122 of file vpdfl_kernel_pdf.cxx.

void vpdfl_kernel_pdf::set_centres const vnl_vector< double > *  x,
int  n,
const vnl_vector< double > &  width
 

Initialise so all kernels have given width.

width[i] is essentially the sd on kernel i

Definition at line 78 of file vpdfl_kernel_pdf.cxx.

void vpdfl_kernel_pdf::set_centres const vnl_vector< double > *  x,
int  n,
double  width
 

Initialise so all kernels have the same width.

width is essentially the sd on the kernels

Definition at line 65 of file vpdfl_kernel_pdf.cxx.

void vpdfl_pdf_base::set_mean const vnl_vector< double > &  m  )  [inline, protected, inherited]
 

Reimplemented in vpdfl_gaussian.

Definition at line 34 of file vpdfl_pdf_base.h.

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

Definition at line 35 of file vpdfl_pdf_base.h.

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

Variance of each dimension.

Definition at line 48 of file vpdfl_pdf_base.h.

short vpdfl_kernel_pdf::version_no  )  const
 

Version number for I/O.

Reimplemented from vpdfl_pdf_base.

Reimplemented in vpdfl_gaussian_kernel_pdf.

Definition at line 113 of file vpdfl_kernel_pdf.cxx.

const vnl_vector<double>& vpdfl_kernel_pdf::width  )  const [inline]
 

Width of each kernel.

Definition at line 60 of file vpdfl_kernel_pdf.h.


Member Data Documentation

bool vpdfl_kernel_pdf::all_same_width_ [protected]
 

True if all kernels have the same width.

Definition at line 34 of file vpdfl_kernel_pdf.h.

vnl_vector<double> vpdfl_kernel_pdf::width_ [protected]
 

Width of each kernel.

Definition at line 31 of file vpdfl_kernel_pdf.h.

vcl_vector<vnl_vector<double> > vpdfl_kernel_pdf::x_ [protected]
 

Position of kernel centres.

Definition at line 28 of file vpdfl_kernel_pdf.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:43:34 2008 for contrib/mul/vpdfl by  doxygen 1.4.4