Public Types | Public Member Functions | Private Attributes | List of all members
vpdl_kernel_vbw_base< T, n > Class Template Referenceabstract

A base class for variable bandwidth kernel distributions. More...

#include <vpdl_kernel_base.h>

Inheritance diagram for vpdl_kernel_vbw_base< T, n >:
Inheritance graph
[legend]

Public Types

typedef vpdt_field_default< T, n >::type vector
 the data type used for vectors. More...
 
typedef vpdt_field_traits< vector >::matrix matrix
 the data type used for matrices. More...
 
typedef vpdt_field_default< T, n >::type field_type
 the data type used for vectors. More...
 

Public Member Functions

 vpdl_kernel_vbw_base (unsigned int var_dim=n)
 
 vpdl_kernel_vbw_base (const std::vector< vector > &samplez, const std::vector< T > &bandwidthz)
 
virtual void add_sample (const vector &s)
 Add a new sample point. More...
 
virtual void add_sample (const vector &s, T bw)
 Add a new sample point with bandwidth. More...
 
virtual void clear_samples ()
 Remove all sample points. More...
 
virtual void set_samples (const std::vector< vector > &samplez)
 Set the collection of sample points. More...
 
virtual void set_samples (const std::vector< vector > &samplez, const std::vector< T > &bandwidthz)
 Set the collection of sample points and bandwidths. More...
 
const std::vector< T > & bandwidths () const
 Access the bandwidths. More...
 
unsigned int num_components () const
 Return the number of components in the mixture. More...
 
virtual unsigned int dimension () const
 Return the run time dimension, which does not equal n when n==0. More...
 
const std::vector< vector > & samples () const
 Access the sample points. More...
 
virtual void compute_mean (vector &mean) const
 Compute the mean of the distribution. More...
 
virtual vpdl_distribution< T, n > * clone () const =0
 Create a copy on the heap and return base class pointer. More...
 
virtual T density (const vector &pt) const =0
 Evaluate the unnormalized density at a point. More...
 
virtual T prob_density (const vector &pt) const
 Evaluate the probability density at a point. More...
 
virtual T log_prob_density (const vector &pt) const
 Evaluate the log probability density at a point. More...
 
virtual T gradient_density (const vector &pt, vector &g) const =0
 Compute the gradient of the unnormalized density at a point. More...
 
virtual T norm_const () const =0
 The normalization constant for the density. More...
 
virtual T cumulative_prob (const vector &pt) const =0
 Evaluate the cumulative distribution function at a point. More...
 
virtual vector inverse_cdf (const T &p) const
 Compute the inverse of the cumulative_prob() function. More...
 
virtual T box_prob (const vector &min_pt, const vector &max_pt) const
 The probability of being in an axis-aligned box. More...
 
virtual void compute_covar (matrix &covar) const =0
 Compute the covariance of the distribution. More...
 

Private Attributes

std::vector< T > bandwidths_
 the bandwidths for each kernel. More...
 

Detailed Description

template<class T, unsigned int n = 0>
class vpdl_kernel_vbw_base< T, n >

A base class for variable bandwidth kernel distributions.

This class assumes that each sample has its own bandwidth

Definition at line 148 of file vpdl_kernel_base.h.

Member Typedef Documentation

◆ field_type

template<class T, unsigned int n = 0>
typedef vpdt_field_default<T,n>::type vpdl_distribution< T, n >::field_type
inherited

the data type used for vectors.

Definition at line 39 of file vpdl_distribution.h.

◆ matrix

template<class T , unsigned int n = 0>
typedef vpdt_field_traits<vector>::matrix vpdl_kernel_vbw_base< T, n >::matrix

the data type used for matrices.

Definition at line 154 of file vpdl_kernel_base.h.

◆ vector

template<class T , unsigned int n = 0>
typedef vpdt_field_default<T,n>::type vpdl_kernel_vbw_base< T, n >::vector

the data type used for vectors.

Definition at line 152 of file vpdl_kernel_base.h.

Constructor & Destructor Documentation

◆ vpdl_kernel_vbw_base() [1/2]

template<class T , unsigned int n = 0>
vpdl_kernel_vbw_base< T, n >::vpdl_kernel_vbw_base ( unsigned int  var_dim = n)
inline

Definition at line 157 of file vpdl_kernel_base.h.

◆ vpdl_kernel_vbw_base() [2/2]

template<class T , unsigned int n = 0>
vpdl_kernel_vbw_base< T, n >::vpdl_kernel_vbw_base ( const std::vector< vector > &  samplez,
const std::vector< T > &  bandwidthz 
)
inline

Definition at line 161 of file vpdl_kernel_base.h.

Member Function Documentation

◆ add_sample() [1/2]

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_vbw_base< T, n >::add_sample ( const vector s)
inlinevirtual

Add a new sample point.

Reimplemented from vpdl_kernel_base< T, n >.

Definition at line 166 of file vpdl_kernel_base.h.

◆ add_sample() [2/2]

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_vbw_base< T, n >::add_sample ( const vector s,
bw 
)
inlinevirtual

Add a new sample point with bandwidth.

Definition at line 173 of file vpdl_kernel_base.h.

◆ bandwidths()

template<class T , unsigned int n = 0>
const std::vector<T>& vpdl_kernel_vbw_base< T, n >::bandwidths ( ) const
inline

Access the bandwidths.

Definition at line 204 of file vpdl_kernel_base.h.

◆ box_prob()

template<class T , unsigned int n>
T vpdl_distribution< T, n >::box_prob ( const vector min_pt,
const vector max_pt 
) const
virtualinherited

The probability of being in an axis-aligned box.

The box is defined by two points, the minimum and maximum. Implemented in terms of cumulative_prob() by default.

Reimplemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, and vpdl_gaussian_sphere< T, n >.

Definition at line 89 of file vpdl_distribution.hxx.

◆ clear_samples()

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_vbw_base< T, n >::clear_samples ( )
inlinevirtual

Remove all sample points.

Reimplemented from vpdl_kernel_base< T, n >.

Definition at line 180 of file vpdl_kernel_base.h.

◆ clone()

template<class T, unsigned int n = 0>
virtual vpdl_distribution<T,n>* vpdl_distribution< T, n >::clone ( ) const
pure virtualinherited

◆ compute_covar()

template<class T, unsigned int n = 0>
virtual void vpdl_distribution< T, n >::compute_covar ( matrix covar) const
pure virtualinherited

Compute the covariance of the distribution.

This may be trivial for distributions like Gaussians, but actually involves computation for others.

Implemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_mixture_of< dist_t >.

◆ compute_mean()

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_base< T, n >::compute_mean ( vector mean) const
inlinevirtualinherited

Compute the mean of the distribution.

Assume that each kernel has its mean at the sample point

Implements vpdl_distribution< T, n >.

Definition at line 83 of file vpdl_kernel_base.h.

◆ cumulative_prob()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::cumulative_prob ( const vector pt) const
pure virtualinherited

Evaluate the cumulative distribution function at a point.

This is the integral of the density function from negative infinity (in all dimensions) to the point in question

Note
It is not possible to compute this value for all functions in closed form. In some cases, numerical integration may be used. If no good solutions exists the function should return a quiet NaN.

Implemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

◆ density()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::density ( const vector pt) const
pure virtualinherited

Evaluate the unnormalized density at a point.

Note
This is not a probability density. To make this a probability multiply by norm_const()
See also
prob_density

Implemented in vpdl_mixture< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, vpdl_gaussian< T, n >, and vpdl_kernel_gaussian_sfbw< T, n >.

◆ dimension()

template<class T , unsigned int n = 0>
virtual unsigned int vpdl_kernel_base< T, n >::dimension ( ) const
inlinevirtualinherited

Return the run time dimension, which does not equal n when n==0.

Implements vpdl_distribution< T, n >.

Definition at line 48 of file vpdl_kernel_base.h.

◆ gradient_density()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::gradient_density ( const vector pt,
vector g 
) const
pure virtualinherited

Compute the gradient of the unnormalized density at a point.

Returns
the density at pt since it is usually needed as well, and is often trivial to compute while computing gradient
Return values
gthe gradient vector

Implemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

◆ inverse_cdf()

template<class T, unsigned int n>
vpdl_distribution< T, n >::vector vpdl_distribution< T, n >::inverse_cdf ( const T &  p) const
virtualinherited

Compute the inverse of the cumulative_prob() function.

The value of x: P(x'<x) = P for x' drawn from the distribution.

Note
This is only valid for univariate distributions multivariate distributions will return a quiet NaN

The value of x: P(x'<x) = P for x' drawn from the distribution. This is only valid for univariate distributions multivariate distributions will return -infinity

Definition at line 78 of file vpdl_distribution.hxx.

◆ log_prob_density()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::log_prob_density ( const vector pt) const
inlinevirtualinherited

Evaluate the log probability density at a point.

Reimplemented in vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

Definition at line 65 of file vpdl_distribution.h.

◆ norm_const()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::norm_const ( ) const
pure virtualinherited

The normalization constant for the density.

When density() is multiplied by this value it becomes prob_density norm_const() is reciprocal of the integral of density over the entire field

Implemented in vpdl_mixture< T, n >, vpdl_kernel_fbw_base< T, n >, vpdl_mixture_of< dist_t >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

◆ num_components()

template<class T , unsigned int n = 0>
unsigned int vpdl_kernel_base< T, n >::num_components ( ) const
inlinevirtualinherited

Return the number of components in the mixture.

Implements vpdl_multi_cmp_dist< T, n >.

Definition at line 45 of file vpdl_kernel_base.h.

◆ prob_density()

template<class T, unsigned int n = 0>
virtual T vpdl_distribution< T, n >::prob_density ( const vector pt) const
inlinevirtualinherited

Evaluate the probability density at a point.

Reimplemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.

Definition at line 59 of file vpdl_distribution.h.

◆ samples()

template<class T , unsigned int n = 0>
const std::vector<vector>& vpdl_kernel_base< T, n >::samples ( ) const
inlineinherited

Access the sample points.

Definition at line 76 of file vpdl_kernel_base.h.

◆ set_samples() [1/2]

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_vbw_base< T, n >::set_samples ( const std::vector< vector > &  samplez)
inlinevirtual

Set the collection of sample points.

Reimplemented from vpdl_kernel_base< T, n >.

Definition at line 187 of file vpdl_kernel_base.h.

◆ set_samples() [2/2]

template<class T , unsigned int n = 0>
virtual void vpdl_kernel_vbw_base< T, n >::set_samples ( const std::vector< vector > &  samplez,
const std::vector< T > &  bandwidthz 
)
inlinevirtual

Set the collection of sample points and bandwidths.

Definition at line 195 of file vpdl_kernel_base.h.

Member Data Documentation

◆ bandwidths_

template<class T , unsigned int n = 0>
std::vector<T> vpdl_kernel_vbw_base< T, n >::bandwidths_
private

the bandwidths for each kernel.

Definition at line 208 of file vpdl_kernel_base.h.


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