mlpack  2.0.1
epanechnikov_kernel.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_CORE_KERNELS_EPANECHNIKOV_KERNEL_HPP
15 #define __MLPACK_CORE_KERNELS_EPANECHNIKOV_KERNEL_HPP
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace kernel {
21 
32 {
33  public:
39  EpanechnikovKernel(const double bandwidth = 1.0) :
42  { }
43 
52  template<typename VecTypeA, typename VecTypeB>
53  double Evaluate(const VecTypeA& a, const VecTypeB& b) const;
54 
59  double Evaluate(const double distance) const;
60 
66  double Gradient(const double distance) const;
67 
73  double GradientForSquaredDistance(const double distanceSquared) const;
83  template<typename VecTypeA, typename VecTypeB>
84  double ConvolutionIntegral(const VecTypeA& a, const VecTypeB& b);
85 
91  double Normalizer(const size_t dimension);
92 
96  template<typename Archive>
97  void Serialize(Archive& ar, const unsigned int version);
98 
99  private:
101  double bandwidth;
104 
105 };
106 
108 template<>
110 {
111  public:
113  static const bool IsNormalized = true;
115  static const bool UsesSquaredDistance = true;
116 };
117 
118 } // namespace kernel
119 } // namespace mlpack
120 
121 // Include implementation.
122 #include "epanechnikov_kernel_impl.hpp"
123 
124 #endif
This is a template class that can provide information about various kernels.
Linear algebra utility functions, generally performed on matrices or vectors.
EpanechnikovKernel(const double bandwidth=1.0)
Instantiate the Epanechnikov kernel with the given bandwidth (default 1.0).
double GradientForSquaredDistance(const double distanceSquared) const
Evaluate the Gradient of Epanechnikov kernel given that the squared distance between the two input po...
void Serialize(Archive &ar, const unsigned int version)
Serialize the kernel.
double Gradient(const double distance) const
Evaluate the Gradient of Epanechnikov kernel given that the distance between the two input points is ...
double ConvolutionIntegral(const VecTypeA &a, const VecTypeB &b)
Obtains the convolution integral [integral of K(||x-a||) K(||b-x||) dx] for the two vectors...
double inverseBandwidthSquared
Cached value of the inverse bandwidth squared (to speed up computation).
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
double bandwidth
Bandwidth of the kernel.
The Epanechnikov kernel, defined as.
double Normalizer(const size_t dimension)
Compute the normalizer of this Epanechnikov kernel for the given dimension.
double Evaluate(const VecTypeA &a, const VecTypeB &b) const
Evaluate the Epanechnikov kernel on the given two inputs.