[mlpack-git] master: Add implementation of the mean squared error performance function. (eb9ff1b)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:10:09 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit eb9ff1b62d6523fd9f8024901f6bc4864f74906a
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date:   Sat Jan 3 14:13:23 2015 +0100

    Add implementation of the mean squared error performance function.


>---------------------------------------------------------------

eb9ff1b62d6523fd9f8024901f6bc4864f74906a
 .../ann/performance_functions/mse_function.hpp     | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/src/mlpack/methods/ann/performance_functions/mse_function.hpp b/src/mlpack/methods/ann/performance_functions/mse_function.hpp
new file mode 100644
index 0000000..cd59c3d
--- /dev/null
+++ b/src/mlpack/methods/ann/performance_functions/mse_function.hpp
@@ -0,0 +1,42 @@
+/**
+ * @file mse_function.hpp
+ * @author Marcus Edel
+ *
+ * Definition and implementation of the mean squared error performance function.
+ */
+#ifndef __MLPACK_METHODS_ANN_PERFORMANCE_FUNCTIONS_MSE_FUNCTION_HPP
+#define __MLPACK_METHODS_ANN_PERFORMANCE_FUNCTIONS_MSE_FUNCTION_HPP
+
+#include <mlpack/core.hpp>
+
+namespace mlpack {
+namespace ann /** Artificial Neural Network. */ {
+
+/**
+ * The mean squared error performance function measures the network's
+ * performance according to the mean of squared errors.
+ *
+ * @tparam VecType Type of data (arma::colvec, arma::mat or arma::sp_mat).
+ */
+template<typename VecType = arma::colvec>
+class MeanSquaredErrorFunction
+{
+  public:
+  /**
+   * Computes the mean squared error function.
+   *
+   * @param input Input data.
+   * @param target Target data.
+   * @return mean of squared errors.
+   */
+  static double error(const VecType& input, const VecType& target)
+  {
+    return arma::mean(arma::square(target - input));
+  }
+
+}; // class MeanSquaredErrorFunction
+
+}; // namespace ann
+}; // namespace mlpack
+
+#endif



More information about the mlpack-git mailing list