mlpack::kernel::GaussianKernel Class Reference

The standard Gaussian kernel. More...

List of all members.

Public Member Functions

 GaussianKernel (double bandwidth)
 Construct the Gaussian kernel with a custom bandwidth.
 GaussianKernel ()
 Default constructor; sets bandwidth to 1.0.
void Bandwidth (const double bandwidth)
 Modify the bandwidth.
double Bandwidth () const
 Get the bandwidth.
template<typename VecType >
double ConvolutionIntegral (const VecType &a, const VecType &b)
 Obtain a convolution integral of the Gaussian kernel.
double Evaluate (double t) const
 Evaluation of the Gaussian kernel given the distance between two points.
template<typename VecType >
double Evaluate (const VecType &a, const VecType &b) const
 Evaluation of the Gaussian kernel.
double Gamma () const
 Get the precalculated constant.
double Normalizer (size_t dimension)
 Obtain the normalization constant of the Gaussian kernel.

Private Attributes

double bandwidth
 Kernel bandwidth.
double gamma
 Precalculated constant depending on the bandwidth; $ \gamma = -\frac{1}{2 \mu^2} $.

Detailed Description

The standard Gaussian kernel.

Given two vectors $ x $, $ y $, and a bandwidth $ \mu $ (set in the constructor),

\[ K(x, y) = \exp(-\frac{|| x - y ||^2}{2 \mu^2}). \]

The implementation is all in the header file because it is so simple.

Definition at line 43 of file gaussian_kernel.hpp.


Constructor & Destructor Documentation

mlpack::kernel::GaussianKernel::GaussianKernel (  )  [inline]

Default constructor; sets bandwidth to 1.0.

Definition at line 49 of file gaussian_kernel.hpp.

mlpack::kernel::GaussianKernel::GaussianKernel ( double  bandwidth  )  [inline]

Construct the Gaussian kernel with a custom bandwidth.

Parameters:
bandwidth The bandwidth of the kernel ($\mu$).

Definition at line 57 of file gaussian_kernel.hpp.


Member Function Documentation

void mlpack::kernel::GaussianKernel::Bandwidth ( const double  bandwidth  )  [inline]

Modify the bandwidth.

This takes an argument because we must update the precalculated constant (gamma).

Definition at line 124 of file gaussian_kernel.hpp.

References gamma.

double mlpack::kernel::GaussianKernel::Bandwidth (  )  const [inline]

Get the bandwidth.

Definition at line 120 of file gaussian_kernel.hpp.

References bandwidth.

template<typename VecType >
double mlpack::kernel::GaussianKernel::ConvolutionIntegral ( const VecType &  a,
const VecType &  b 
) [inline]

Obtain a convolution integral of the Gaussian kernel.

Parameters:
a,first vector
b,second vector
Returns:
the convolution integral

Definition at line 112 of file gaussian_kernel.hpp.

References mlpack::metric::LMetric< Power, TakeRoot >::Evaluate(), Evaluate(), and Normalizer().

double mlpack::kernel::GaussianKernel::Evaluate ( double  t  )  const [inline]

Evaluation of the Gaussian kernel given the distance between two points.

Parameters:
t The distance between the two points the kernel is evaluated on.
Returns:
K(t) using the bandwidth ($\mu$) specified in the constructor.

Definition at line 87 of file gaussian_kernel.hpp.

References gamma.

template<typename VecType >
double mlpack::kernel::GaussianKernel::Evaluate ( const VecType &  a,
const VecType &  b 
) const [inline]

Evaluation of the Gaussian kernel.

This could be generalized to use any distance metric, not the Euclidean distance, but for now, the Euclidean distance is used.

Template Parameters:
VecType Type of vector (likely arma::vec or arma::spvec).
Parameters:
a First vector.
b Second vector.
Returns:
K(a, b) using the bandwidth ($\mu$) specified in the constructor.

Definition at line 74 of file gaussian_kernel.hpp.

References mlpack::metric::LMetric< Power, TakeRoot >::Evaluate(), and gamma.

Referenced by ConvolutionIntegral().

double mlpack::kernel::GaussianKernel::Gamma (  )  const [inline]

Get the precalculated constant.

Definition at line 131 of file gaussian_kernel.hpp.

References gamma.

double mlpack::kernel::GaussianKernel::Normalizer ( size_t  dimension  )  [inline]

Obtain the normalization constant of the Gaussian kernel.

Parameters:
dimension 
Returns:
the normalization constant

Definition at line 99 of file gaussian_kernel.hpp.

References bandwidth, and M_PI.

Referenced by ConvolutionIntegral().


Member Data Documentation

Kernel bandwidth.

Definition at line 135 of file gaussian_kernel.hpp.

Referenced by Bandwidth(), and Normalizer().

Precalculated constant depending on the bandwidth; $ \gamma = -\frac{1}{2 \mu^2} $.

Definition at line 139 of file gaussian_kernel.hpp.

Referenced by Bandwidth(), Evaluate(), and Gamma().


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

Generated on 13 Aug 2014 for MLPACK by  doxygen 1.6.1