[mlpack-svn] r12935 - mlpack/trunk/src/mlpack/core/kernels

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Jun 2 01:09:31 EDT 2012


Author: rcurtin
Date: 2012-06-02 01:09:30 -0400 (Sat, 02 Jun 2012)
New Revision: 12935

Added:
   mlpack/trunk/src/mlpack/core/kernels/inverse_multi_quadric_kernel.hpp
   mlpack/trunk/src/mlpack/core/kernels/triangular_kernel.hpp
Log:
Add two more kernels.  They need to be parameterized.


Added: mlpack/trunk/src/mlpack/core/kernels/inverse_multi_quadric_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/inverse_multi_quadric_kernel.hpp	                        (rev 0)
+++ mlpack/trunk/src/mlpack/core/kernels/inverse_multi_quadric_kernel.hpp	2012-06-02 05:09:30 UTC (rev 12935)
@@ -0,0 +1,29 @@
+/**
+ * @file inverse_multi_quadric_kernel.hpp
+ * @author Ryan Curtin
+ *
+ * The deadline is coming!
+ */
+#ifndef __MLPACK_CORE_KERNELS_INVERSE_MULTI_QUADRIC_KERNEL_HPP
+#define __MLPACK_CORE_KERNELS_INVERSE_MULTI_QUADRIC_KERNEL_HPP
+
+#include <mlpack/core.hpp>
+#include <mlpack/core/metrics/lmetric.hpp>
+
+namespace mlpack {
+namespace kernel {
+
+class InverseMultiQuadricKernel
+{
+ public:
+  template<typename VecType>
+  static double Evaluate(const VecType& a, const VecType& b)
+  {
+    return 1.0 / (metric::EuclideanDistance::Evaluate(a, b));
+  }
+};
+
+}; // namespace kernel
+}; // namespace mlpack
+
+#endif

Added: mlpack/trunk/src/mlpack/core/kernels/triangular_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/triangular_kernel.hpp	                        (rev 0)
+++ mlpack/trunk/src/mlpack/core/kernels/triangular_kernel.hpp	2012-06-02 05:09:30 UTC (rev 12935)
@@ -0,0 +1,29 @@
+/**
+ * @file triangular_kernel.hpp
+ * @author Ryan Curtin
+ *
+ * Triangular kernel.  Is it a Mercer kernel?  Who knows!?
+ */
+#ifndef __MLPACK_CORE_KERNELS_TRIANGULAR_KERNEL_HPP
+#define __MLPACK_CORE_KERNELS_TRIANGULAR_KERNEL_HPP
+
+#include <mlpack/core.hpp>
+#include <mlpack/core/metrics/lmetric.hpp>
+
+namespace mlpack {
+namespace kernel {
+
+class TriangularKernel
+{
+ public:
+  template<typename VecType>
+  static double Evaluate(const VecType& a, const VecType& b)
+  {
+    return std::max(0.0, (1 - metric::LMetric<2>::Evaluate(a, b)));
+  }
+};
+
+}; // namespace kernel
+}; // namespace mlpack
+
+#endif




More information about the mlpack-svn mailing list