MLPACK
1.0.4
|
The standard Gaussian kernel. More...
Public Member Functions | |
GaussianKernel () | |
Default constructor; sets bandwidth to 1.0. | |
GaussianKernel (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 (double t) const |
Evaluation of the Gaussian kernel using a double precision argument. | |
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; ![]() |
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 43 of file gaussian_kernel.hpp.
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.
bandwidth | The bandwidth of the kernel ( ![]() |
Definition at line 57 of file gaussian_kernel.hpp.
double mlpack::kernel::GaussianKernel::Bandwidth | ( | ) | const [inline] |
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 122 of file gaussian_kernel.hpp.
double mlpack::kernel::GaussianKernel::ConvolutionIntegral | ( | const VecType & | a, |
const VecType & | b | ||
) | [inline] |
Obtain a convolution integral of the Gaussian kernel.
a,first | vector |
b,second | vector |
Definition at line 110 of file gaussian_kernel.hpp.
References Evaluate(), mlpack::metric::LMetric< Power, TakeRoot >::Evaluate(), and Normalizer().
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.
VecType | Type of vector (likely arma::vec or arma::spvec). |
a | First vector. |
b | Second vector. |
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::Evaluate | ( | double | t | ) | const [inline] |
Evaluation of the Gaussian kernel using a double precision argument.
t | double value. |
Definition at line 87 of file gaussian_kernel.hpp.
References gamma.
double mlpack::kernel::GaussianKernel::Gamma | ( | ) | const [inline] |
Get the precalculated constant.
Definition at line 129 of file gaussian_kernel.hpp.
References gamma.
double mlpack::kernel::GaussianKernel::Normalizer | ( | size_t | dimension | ) | [inline] |
Obtain the normalization constant of the Gaussian kernel.
dimension |
Definition at line 98 of file gaussian_kernel.hpp.
References bandwidth, and M_PI.
Referenced by ConvolutionIntegral().
double mlpack::kernel::GaussianKernel::bandwidth [private] |
Kernel bandwidth.
Definition at line 133 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), and Normalizer().
double mlpack::kernel::GaussianKernel::gamma [private] |
Precalculated constant depending on the bandwidth; .
Definition at line 137 of file gaussian_kernel.hpp.
Referenced by Bandwidth(), Evaluate(), and Gamma().