00001 00022 #ifndef __MLPACK_CORE_KERNELS_EPANECHNIKOV_KERNEL_HPP 00023 #define __MLPACK_CORE_KERNELS_EPANECHNIKOV_KERNEL_HPP 00024 00025 #include <mlpack/core.hpp> 00026 00027 namespace mlpack { 00028 namespace kernel { 00029 00039 class EpanechnikovKernel 00040 { 00041 public: 00047 EpanechnikovKernel(const double bandwidth = 1.0) : 00048 bandwidth(bandwidth), 00049 inverseBandwidthSquared(1.0 / (bandwidth * bandwidth)) 00050 { } 00051 00058 template<typename Vec1Type, typename Vec2Type> 00059 double Evaluate(const Vec1Type& a, const Vec2Type& b) const; 00060 00065 double Evaluate(const double distance) const; 00066 00076 template<typename VecType> 00077 double ConvolutionIntegral(const VecType& a, const VecType& b); 00078 00084 double Normalizer(const size_t dimension); 00085 00086 private: 00088 double bandwidth; 00090 double inverseBandwidthSquared; 00091 }; 00092 00094 template<> 00095 class KernelTraits<EpanechnikovKernel> 00096 { 00097 public: 00099 static const bool IsNormalized = true; 00100 }; 00101 00102 }; // namespace kernel 00103 }; // namespace mlpack 00104 00105 // Include implementation. 00106 #include "epanechnikov_kernel_impl.hpp" 00107 00108 #endif