The standard gaussian kernel.
GaussianKernel ()
Default constructor; sets bandwidth to 1.0. GaussianKernel (const double bandwidth)
Construct the Gaussian kernel with a custom bandwidth. double Bandwidth () const
Get the bandwidth. void Bandwidth (const double bandwidth)
Modify the bandwidth. template<typename VecType > double ConvolutionIntegral (const VecType &a, const VecType &b)
Obtain a convolution integral of the Gaussian kernel. template<typename VecType > double Evaluate (const VecType &a, const VecType &b) const
Evaluation of the Gaussian kernel. double Evaluate (const double t) const
Evaluation of the Gaussian kernel given the distance between two points. double Gamma () const
Get the precalculated constant. double Normalizer (const size_t dimension)
Obtain the normalization constant of the Gaussian kernel. std::string ToString () const
Convert object to string.
double bandwidth
Kernel bandwidth. double gamma
Precalculated constant depending on the bandwidth; $ \gamma = -ac{1}{2 \mu^2} $.
The standard Gaussian kernel.
Given two vectors $ x $, $ y $, and a bandwidth $ \mu $ (set in the constructor),
\[ K(x, y) = \xp(-ac{|| x - y ||^2}{2 \mu^2}). \].PP The implementation is all in the header file because it is so simple.
Definition at line 43 of file gaussian_kernel.hpp.
Default constructor; sets bandwidth to 1.0.
Definition at line 49 of file gaussian_kernel.hpp.
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.
Get the bandwidth.
Definition at line 120 of file gaussian_kernel.hpp.
References bandwidth.
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 bandwidth, and gamma.
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 Evaluate(), mlpack::metric::LMetric< Power, TakeRoot >::Evaluate(), and Normalizer().
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().
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.
Get the precalculated constant.
Definition at line 131 of file gaussian_kernel.hpp.
References gamma.
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().
Convert object to string.
Definition at line 134 of file gaussian_kernel.hpp.
References bandwidth.
Kernel bandwidth.
Definition at line 144 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), Normalizer(), and ToString().
Precalculated constant depending on the bandwidth; $ \gamma = -ac{1}{2 \mu^2} $.
Definition at line 148 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), Evaluate(), and Gamma().
Generated automatically by Doxygen for MLPACK from the source code.