[mlpack-svn] r10357 - mlpack/trunk/src/mlpack/core/kernels
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Nov 23 02:39:04 EST 2011
Author: rcurtin
Date: 2011-11-23 02:39:04 -0500 (Wed, 23 Nov 2011)
New Revision: 10357
Modified:
mlpack/trunk/src/mlpack/core/kernels/cosine_distance.cpp
mlpack/trunk/src/mlpack/core/kernels/cosine_distance.hpp
mlpack/trunk/src/mlpack/core/kernels/example_kernel.hpp
mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
mlpack/trunk/src/mlpack/core/kernels/linear_kernel.hpp
Log:
Adapt style per #153.
Modified: mlpack/trunk/src/mlpack/core/kernels/cosine_distance.cpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/cosine_distance.cpp 2011-11-23 07:37:39 UTC (rev 10356)
+++ mlpack/trunk/src/mlpack/core/kernels/cosine_distance.cpp 2011-11-23 07:39:04 UTC (rev 10357)
@@ -10,7 +10,8 @@
using namespace mlpack::kernel;
using namespace arma;
-double CosineDistance::Evaluate(const arma::vec& a, const arma::vec& b) {
+double CosineDistance::Evaluate(const arma::vec& a, const arma::vec& b)
+{
// Since we are using the L2 inner product, this is easy.
return 1 - dot(a, b) / (norm(a, 2) * norm(b, 2));
}
Modified: mlpack/trunk/src/mlpack/core/kernels/cosine_distance.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/cosine_distance.hpp 2011-11-23 07:37:39 UTC (rev 10356)
+++ mlpack/trunk/src/mlpack/core/kernels/cosine_distance.hpp 2011-11-23 07:39:04 UTC (rev 10357)
@@ -1,5 +1,5 @@
-/***
- * @file cosine_distance.h
+/**
+ * @file cosine_distance.hpp
* @author Ryan Curtin
*
* This implements the cosine distance (or cosine similarity) between two
@@ -23,7 +23,8 @@
* and this class assumes the standard L2 inner product. In the future it may
* support more.
*/
-class CosineDistance {
+class CosineDistance
+{
public:
/**
* Default constructor does nothing, but is required to satisfy the Kernel
Modified: mlpack/trunk/src/mlpack/core/kernels/example_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/example_kernel.hpp 2011-11-23 07:37:39 UTC (rev 10356)
+++ mlpack/trunk/src/mlpack/core/kernels/example_kernel.hpp 2011-11-23 07:39:04 UTC (rev 10357)
@@ -76,7 +76,8 @@
* is necessary.
* @endnote
*/
-class ExampleKernel {
+class ExampleKernel
+{
public:
/**
* The default constructor, which takes no parameters. Because our simple
Modified: mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp 2011-11-23 07:37:39 UTC (rev 10356)
+++ mlpack/trunk/src/mlpack/core/kernels/gaussian_kernel.hpp 2011-11-23 07:39:04 UTC (rev 10357)
@@ -49,7 +49,8 @@
* @return K(a, b) using the bandwidth (@f$\sigma at f$) specified in the
* constructor.
*/
- double Evaluate(const arma::vec& a, const arma::vec& b) const {
+ double Evaluate(const arma::vec& a, const arma::vec& b) const
+ {
// The precalculation of gamma saves us some little computation time.
arma::vec diff = b - a;
return exp(gamma * arma::dot(diff, diff));
Modified: mlpack/trunk/src/mlpack/core/kernels/linear_kernel.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/kernels/linear_kernel.hpp 2011-11-23 07:37:39 UTC (rev 10356)
+++ mlpack/trunk/src/mlpack/core/kernels/linear_kernel.hpp 2011-11-23 07:39:04 UTC (rev 10357)
@@ -24,7 +24,8 @@
*
* This kernel has no parameters and therefore the evaluation can be static.
*/
-class LinearKernel {
+class LinearKernel
+{
public:
/**
* This constructor does nothing; the linear kernel has no parameters to
@@ -40,7 +41,8 @@
* @param b Second vector.
* @return K(a, b).
*/
- static double Evaluate(const arma::vec& a, const arma::vec& b) {
+ static double Evaluate(const arma::vec& a, const arma::vec& b)
+ {
return arma::dot(a, b);
}
};
More information about the mlpack-svn
mailing list