A base class for variable bandwidth kernel distributions. More...
#include <vpdl_kernel_base.h>
Public Types | |
typedef vpdt_field_default< T, n >::type | vector |
the data type used for vectors. | |
typedef vpdt_field_traits < vector >::matrix | matrix |
the data type used for matrices. | |
typedef vpdt_field_default< T, n >::type | field_type |
the data type used for vectors. | |
Public Member Functions | |
vpdl_kernel_vbw_base (unsigned int var_dim=n) | |
vpdl_kernel_vbw_base (const vcl_vector< vector > &samplez, const vcl_vector< T > &bandwidthz) | |
virtual void | add_sample (const vector &s) |
Add a new sample point. | |
virtual void | add_sample (const vector &s, T bw) |
Add a new sample point with bandwidth. | |
virtual void | clear_samples () |
Remove all sample points. | |
virtual void | set_samples (const vcl_vector< vector > &samplez) |
Set the collection of sample points. | |
virtual void | set_samples (const vcl_vector< vector > &samplez, const vcl_vector< T > &bandwidthz) |
Set the collection of sample points and bandwidths. | |
const vcl_vector< T > & | bandwidths () const |
Access the bandwidths. | |
unsigned int | num_components () const |
Return the number of components in the mixture. | |
virtual unsigned int | dimension () const |
Return the run time dimension, which does not equal n when n==0 . | |
const vcl_vector< vector > & | samples () const |
Access the sample points. | |
virtual void | compute_mean (vector &mean) const |
Compute the mean of the distribution. | |
virtual vpdl_distribution< T, n > * | clone () const =0 |
Create a copy on the heap and return base class pointer. | |
virtual T | density (const vector &pt) const =0 |
Evaluate the unnormalized density at a point. | |
virtual T | prob_density (const vector &pt) const |
Evaluate the probability density at a point. | |
virtual T | log_prob_density (const vector &pt) const |
Evaluate the log probability density at a point. | |
virtual T | gradient_density (const vector &pt, vector &g) const =0 |
Compute the gradient of the unnormalized density at a point. | |
virtual T | norm_const () const =0 |
The normalization constant for the density. | |
virtual T | cumulative_prob (const vector &pt) const =0 |
Evaluate the cumulative distribution function at a point. | |
virtual vector | inverse_cdf (const T &p) const |
Compute the inverse of the cumulative_prob() function. | |
virtual T | box_prob (const vector &min_pt, const vector &max_pt) const |
The probability of being in an axis-aligned box. | |
virtual void | compute_covar (matrix &covar) const =0 |
Compute the covariance of the distribution. | |
Private Attributes | |
vcl_vector< T > | bandwidths_ |
the bandwidths for each kernel. |
A base class for variable bandwidth kernel distributions.
This class assumes that each sample has its own bandwidth
Definition at line 145 of file vpdl_kernel_base.h.
typedef vpdt_field_default<T,n>::type vpdl_distribution< T, n >::field_type [inherited] |
the data type used for vectors.
Reimplemented in vpdl_mixture_of< dist_t >.
Definition at line 36 of file vpdl_distribution.h.
typedef vpdt_field_traits<vector>::matrix vpdl_kernel_vbw_base< T, n >::matrix |
the data type used for matrices.
Reimplemented from vpdl_kernel_base< T, n >.
Definition at line 151 of file vpdl_kernel_base.h.
typedef vpdt_field_default<T,n>::type vpdl_kernel_vbw_base< T, n >::vector |
the data type used for vectors.
Reimplemented from vpdl_kernel_base< T, n >.
Definition at line 149 of file vpdl_kernel_base.h.
vpdl_kernel_vbw_base< T, n >::vpdl_kernel_vbw_base | ( | unsigned int | var_dim = n | ) | [inline] |
Definition at line 154 of file vpdl_kernel_base.h.
vpdl_kernel_vbw_base< T, n >::vpdl_kernel_vbw_base | ( | const vcl_vector< vector > & | samplez, |
const vcl_vector< T > & | bandwidthz | ||
) | [inline] |
Definition at line 158 of file vpdl_kernel_base.h.
virtual void vpdl_kernel_vbw_base< T, n >::add_sample | ( | const vector & | s | ) | [inline, virtual] |
Add a new sample point.
Reimplemented from vpdl_kernel_base< T, n >.
Definition at line 163 of file vpdl_kernel_base.h.
virtual void vpdl_kernel_vbw_base< T, n >::add_sample | ( | const vector & | s, |
T | bw | ||
) | [inline, virtual] |
Add a new sample point with bandwidth.
Definition at line 170 of file vpdl_kernel_base.h.
const vcl_vector<T>& vpdl_kernel_vbw_base< T, n >::bandwidths | ( | ) | const [inline] |
Access the bandwidths.
Definition at line 201 of file vpdl_kernel_base.h.
T vpdl_distribution< T, n >::box_prob | ( | const vector & | min_pt, |
const vector & | max_pt | ||
) | const [virtual, inherited] |
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 >, vpdl_gaussian_sphere< T, n >, and vpdl_mixture_of< dist_t >.
Definition at line 86 of file vpdl_distribution.txx.
virtual void vpdl_kernel_vbw_base< T, n >::clear_samples | ( | ) | [inline, virtual] |
Remove all sample points.
Reimplemented from vpdl_kernel_base< T, n >.
Definition at line 177 of file vpdl_kernel_base.h.
virtual vpdl_distribution<T,n>* vpdl_distribution< T, n >::clone | ( | ) | const [pure virtual, inherited] |
Create a copy on the heap and return base class pointer.
Implemented in vpdl_mixture< T, n >, vpdl_mixture_of< dist_t >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, vpdl_gaussian< T, n >, and vpdl_kernel_gaussian_sfbw< T, n >.
virtual void vpdl_distribution< T, n >::compute_covar | ( | matrix & | covar | ) | const [pure virtual, inherited] |
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 >.
virtual void vpdl_kernel_base< T, n >::compute_mean | ( | vector & | mean | ) | const [inline, virtual, inherited] |
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 80 of file vpdl_kernel_base.h.
virtual T vpdl_distribution< T, n >::cumulative_prob | ( | const vector & | pt | ) | const [pure virtual, inherited] |
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
Implemented in vpdl_mixture< T, n >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_mixture_of< dist_t >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.
virtual T vpdl_distribution< T, n >::density | ( | const vector & | pt | ) | const [pure virtual, inherited] |
Evaluate the unnormalized density at a point.
Implemented in vpdl_mixture< T, n >, vpdl_mixture_of< dist_t >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, vpdl_gaussian< T, n >, and vpdl_kernel_gaussian_sfbw< T, n >.
virtual unsigned int vpdl_kernel_base< T, n >::dimension | ( | ) | const [inline, virtual, inherited] |
Return the run time dimension, which does not equal n
when n==0
.
Implements vpdl_distribution< T, n >.
Definition at line 45 of file vpdl_kernel_base.h.
virtual T vpdl_distribution< T, n >::gradient_density | ( | const vector & | pt, |
vector & | g | ||
) | const [pure virtual, inherited] |
Compute the gradient of the unnormalized density at a point.
g | the gradient vector |
Implemented in vpdl_mixture< T, n >, vpdl_mixture_of< dist_t >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.
vpdl_distribution< T, n >::vector vpdl_distribution< T, n >::inverse_cdf | ( | const T & | p | ) | const [virtual, inherited] |
Compute the inverse of the cumulative_prob() function.
The value of x: P(x'<x) = P for x' drawn from the distribution.
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 75 of file vpdl_distribution.txx.
virtual T vpdl_distribution< T, n >::log_prob_density | ( | const vector & | pt | ) | const [inline, virtual, inherited] |
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 62 of file vpdl_distribution.h.
virtual T vpdl_distribution< T, n >::norm_const | ( | ) | const [pure virtual, inherited] |
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 >.
unsigned int vpdl_kernel_base< T, n >::num_components | ( | ) | const [inline, virtual, inherited] |
Return the number of components in the mixture.
Implements vpdl_multi_cmp_dist< T, n >.
Definition at line 42 of file vpdl_kernel_base.h.
virtual T vpdl_distribution< T, n >::prob_density | ( | const vector & | pt | ) | const [inline, virtual, inherited] |
Evaluate the probability density at a point.
Reimplemented in vpdl_mixture< T, n >, vpdl_mixture_of< dist_t >, vpdl_kernel_gaussian_sfbw< T, n >, vpdl_gaussian_sphere< T, n >, vpdl_gaussian_indep< T, n >, and vpdl_gaussian< T, n >.
Definition at line 56 of file vpdl_distribution.h.
const vcl_vector<vector>& vpdl_kernel_base< T, n >::samples | ( | ) | const [inline, inherited] |
Access the sample points.
Definition at line 73 of file vpdl_kernel_base.h.
virtual void vpdl_kernel_vbw_base< T, n >::set_samples | ( | const vcl_vector< vector > & | samplez | ) | [inline, virtual] |
Set the collection of sample points.
Reimplemented from vpdl_kernel_base< T, n >.
Definition at line 184 of file vpdl_kernel_base.h.
virtual void vpdl_kernel_vbw_base< T, n >::set_samples | ( | const vcl_vector< vector > & | samplez, |
const vcl_vector< T > & | bandwidthz | ||
) | [inline, virtual] |
Set the collection of sample points and bandwidths.
Definition at line 192 of file vpdl_kernel_base.h.
vcl_vector<T> vpdl_kernel_vbw_base< T, n >::bandwidths_ [private] |
the bandwidths for each kernel.
Definition at line 205 of file vpdl_kernel_base.h.