From 7558d383f7e5bb40a84c42f026bed40397aab633 Mon Sep 17 00:00:00 2001 From: Omar Shrit Date: Sat, 13 Nov 2021 19:23:57 +0000 Subject: [PATCH] remove epanechnikov_kernel Signed-off-by: Omar Shrit --- .../core/kernels/epanechnikov_kernel.cpp | 63 ------------------- 1 file changed, 63 deletions(-) diff --git a/src/mlpack/core/kernels/epanechnikov_kernel.cpp b/src/mlpack/core/kernels/epanechnikov_kernel.cpp index c245200a76..193ad622c4 100644 --- a/src/mlpack/core/kernels/epanechnikov_kernel.cpp +++ b/src/mlpack/core/kernels/epanechnikov_kernel.cpp @@ -14,67 +14,4 @@ using namespace mlpack; using namespace mlpack::kernel; -/** - * Compute the normalizer of this Epanechnikov kernel for the given dimension. - * - * @param dimension Dimension to calculate the normalizer for. - */ -double EpanechnikovKernel::Normalizer(const size_t dimension) -{ - return 2.0 * pow(bandwidth, (double) dimension) * - std::pow(M_PI, dimension / 2.0) / - (std::tgamma(dimension / 2.0 + 1.0) * (dimension + 2.0)); -} -/** - * Evaluate the kernel not for two points but for a numerical value. - */ -double EpanechnikovKernel::Evaluate(const double distance) const -{ - return std::max(0.0, 1 - std::pow(distance, 2.0) * inverseBandwidthSquared); -} - -/** - * Evaluate gradient of the kernel not for two points - * but for a numerical value. - */ -double EpanechnikovKernel::Gradient(const double distance) const -{ - if (std::abs(bandwidth) < std::abs(distance)) - { - return 0; - } - else if (std::abs(bandwidth) > std::abs(distance)) - { - return -2 * inverseBandwidthSquared * distance; - } - else - { - // The gradient doesn't exist. - return arma::datum::nan; - } -} - -/** - * Evaluate gradient of the kernel not for two points - * but for a numerical value. - */ -double EpanechnikovKernel::GradientForSquaredDistance(const double - distanceSquared) const -{ - double bandwidthSquared = bandwidth * bandwidth; - if (distanceSquared < bandwidthSquared) - { - return -1 * inverseBandwidthSquared; - } - else if (distanceSquared > bandwidthSquared && - distanceSquared >= 0) - { - return 0; - } - else - { - // The gradient doesn't exist. - return arma::datum::nan; - } -}