mlpack
master
|
The standard Gaussian kernel. More...
Public Member Functions | |
GaussianKernel () | |
Default constructor; sets bandwidth to 1.0. More... | |
GaussianKernel (const double bandwidth) | |
Construct the Gaussian kernel with a custom bandwidth. More... | |
double | Bandwidth () const |
Get the bandwidth. More... | |
void | Bandwidth (const double bandwidth) |
Modify the bandwidth. More... | |
template<typename VecTypeA , typename VecTypeB > | |
double | ConvolutionIntegral (const VecTypeA &a, const VecTypeB &b) |
Obtain a convolution integral of the Gaussian kernel. More... | |
template<typename VecTypeA , typename VecTypeB > | |
double | Evaluate (const VecTypeA &a, const VecTypeB &b) const |
Evaluation of the Gaussian kernel. More... | |
double | Evaluate (const double t) const |
Evaluation of the Gaussian kernel given the distance between two points. More... | |
double | Gamma () const |
Get the precalculated constant. More... | |
double | Gradient (const double t) const |
Evaluation of the gradient of Gaussian kernel given the distance between two points. More... | |
double | GradientForSquaredDistance (const double t) const |
Evaluation of the gradient of Gaussian kernel given the squared distance between two points. More... | |
double | Normalizer (const size_t dimension) |
Obtain the normalization constant of the Gaussian kernel. More... | |
template<typename Archive > | |
void | Serialize (Archive &ar, const unsigned int) |
Serialize the kernel. More... | |
Private Attributes | |
double | bandwidth |
Kernel bandwidth. More... | |
double | gamma |
Precalculated constant depending on the bandwidth; ![]() | |
The standard Gaussian kernel.
Given two vectors ,
, and a bandwidth
(set in the constructor),
The implementation is all in the header file because it is so simple.
Definition at line 34 of file gaussian_kernel.hpp.
|
inline |
Default constructor; sets bandwidth to 1.0.
Definition at line 40 of file gaussian_kernel.hpp.
|
inline |
Construct the Gaussian kernel with a custom bandwidth.
bandwidth | The bandwidth of the kernel ( ![]() |
Definition at line 48 of file gaussian_kernel.hpp.
|
inline |
|
inline |
Modify the bandwidth.
This takes an argument because we must update the precalculated constant (gamma).
Definition at line 139 of file gaussian_kernel.hpp.
|
inline |
Obtain a convolution integral of the Gaussian kernel.
a | First vector. |
b | Second vector. |
Definition at line 127 of file gaussian_kernel.hpp.
References Evaluate(), mlpack::metric::LMetric< TPower, TTakeRoot >::Evaluate(), and Normalizer().
|
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.
VecType | Type of vector (likely arma::vec or arma::spvec). |
a | First vector. |
b | Second vector. |
Definition at line 65 of file gaussian_kernel.hpp.
References mlpack::metric::LMetric< TPower, TTakeRoot >::Evaluate(), and gamma.
Referenced by ConvolutionIntegral().
|
inline |
Evaluation of the Gaussian kernel given the distance between two points.
t | The distance between the two points the kernel is evaluated on. |
Definition at line 78 of file gaussian_kernel.hpp.
References gamma.
|
inline |
Get the precalculated constant.
Definition at line 146 of file gaussian_kernel.hpp.
References gamma.
|
inline |
Evaluation of the gradient of Gaussian kernel given the distance between two points.
t | The distance between the two points the kernel is evaluated on. |
Definition at line 92 of file gaussian_kernel.hpp.
References gamma.
|
inline |
Evaluation of the gradient of Gaussian kernel given the squared distance between two points.
t | The squared distance between the two points |
Definition at line 104 of file gaussian_kernel.hpp.
References gamma.
|
inline |
Obtain the normalization constant of the Gaussian kernel.
dimension |
Definition at line 114 of file gaussian_kernel.hpp.
References bandwidth, and M_PI.
Referenced by ConvolutionIntegral().
|
inline |
Serialize the kernel.
Definition at line 150 of file gaussian_kernel.hpp.
References bandwidth, mlpack::data::CreateNVP(), and gamma.
|
private |
Kernel bandwidth.
Definition at line 158 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), Normalizer(), and Serialize().
|
private |
Precalculated constant depending on the bandwidth; .
Definition at line 162 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), Evaluate(), Gamma(), Gradient(), GradientForSquaredDistance(), and Serialize().