16 #ifndef __MLPACK_CORE_KERNELS_GAUSSIAN_KERNEL_HPP
17 #define __MLPACK_CORE_KERNELS_GAUSSIAN_KERNEL_HPP
51 gamma(-0.5 * pow(bandwidth, -2.0))
65 template<
typename VecTypeA,
typename VecTypeB>
66 double Evaluate(
const VecTypeA& a,
const VecTypeB& b)
const
82 return exp(
gamma * std::pow(t, 2.0));
94 return 2 * t *
gamma * exp(
gamma * std::pow(t, 2.0));
117 return pow(sqrt(2.0 *
M_PI) *
bandwidth, (
double) dimension);
127 template<
typename VecTypeA,
typename VecTypeB>
131 (
Normalizer(a.n_rows) * pow(2.0, (
double) a.n_rows / 2.0));
143 this->
gamma = -0.5 * pow(bandwidth, -2.0);
150 template<
typename Archive>
GaussianKernel()
Default constructor; sets bandwidth to 1.0.
double ConvolutionIntegral(const VecTypeA &a, const VecTypeB &b)
Obtain a convolution integral of the Gaussian kernel.
This is a template class that can provide information about various kernels.
Linear algebra utility functions, generally performed on matrices or vectors.
FirstShim< T > CreateNVP(T &t, const std::string &name, typename boost::enable_if< HasSerialize< T >>::type *=0)
Call this function to produce a name-value pair; this is similar to BOOST_SERIALIZATION_NVP(), but should be used for types that have a Serialize() function (or contain a type that has a Serialize() function) instead of a serialize() function.
void Bandwidth(const double bandwidth)
Modify the bandwidth.
double Evaluate(const double t) const
Evaluation of the Gaussian kernel given the distance between two points.
double gamma
Precalculated constant depending on the bandwidth; .
double GradientForSquaredDistance(const double t) const
Evaluation of the gradient of Gaussian kernel given the squared distance between two points...
double Gradient(const double t) const
Evaluation of the gradient of Gaussian kernel given the distance between two points.
void Serialize(Archive &ar, const unsigned int)
Serialize the kernel.
GaussianKernel(const double bandwidth)
Construct the Gaussian kernel with a custom bandwidth.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
double Normalizer(const size_t dimension)
Obtain the normalization constant of the Gaussian kernel.
double Bandwidth() const
Get the bandwidth.
static const bool UsesSquaredDistance
If true, then the kernel include a squared distance, ||x - y||^2 .
The standard Gaussian kernel.
double Evaluate(const VecTypeA &a, const VecTypeB &b) const
Evaluation of the Gaussian kernel.
static const bool IsNormalized
If true, then the kernel is normalized: K(x, x) = K(y, y) = 1 for all x.
double Gamma() const
Get the precalculated constant.
static double Evaluate(const VecTypeA &a, const VecTypeB &b)
Computes the distance between two points.
double bandwidth
Kernel bandwidth.