[mlpack-git] master: Remove the input parameter since we can't provide an input for batch learning and it wasn't used anyway. (e71bd00)

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


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

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

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

commit e71bd00c449fc6f5f52b37ea50761e32bf67ede8
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date:   Fri Jan 9 14:20:20 2015 +0100

    Remove the input parameter since we can't provide an input for batch learning and it wasn't used anyway.


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

e71bd00c449fc6f5f52b37ea50761e32bf67ede8
 src/mlpack/methods/ann/ffnn.hpp |  7 ++-----
 src/mlpack/methods/ann/rnn.hpp  | 25 ++++++++++++-------------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/mlpack/methods/ann/ffnn.hpp b/src/mlpack/methods/ann/ffnn.hpp
index 907782e..9611c85 100644
--- a/src/mlpack/methods/ann/ffnn.hpp
+++ b/src/mlpack/methods/ann/ffnn.hpp
@@ -91,13 +91,10 @@ class FFNN
     }
 
     /**
-     * Updating the weights using the specified optimizer and the given input.
+     * Updating the weights using the specified optimizer.
      *
-     * @param input Input data used to evaluate the network.
-     * @tparam VecType Type of data (arma::colvec, arma::mat or arma::sp_mat).
      */
-    template <typename VecType>
-    void ApplyGradients(const VecType& /* unused */)
+    void ApplyGradients()
     {
       gradientNum = 0;
       ApplyGradients(network);
diff --git a/src/mlpack/methods/ann/rnn.hpp b/src/mlpack/methods/ann/rnn.hpp
index d5862ad..c616aeb 100644
--- a/src/mlpack/methods/ann/rnn.hpp
+++ b/src/mlpack/methods/ann/rnn.hpp
@@ -130,18 +130,18 @@ class RNN
     }
 
     /**
-     * Updating the weights using the specified optimizer and the given input.
+     * Updating the weights using the specified optimizer.
      *
-     * @param input Input data used for evaluating the network.
-     * @tparam VecType Type of data (arma::colvec, arma::mat or arma::sp_mat).
      */
-    template <typename VecType>
-    void ApplyGradients(const VecType& input)
+    void ApplyGradients()
     {
       gradientNum = 0;
-      ApplyGradients(network, input);
+      ApplyGradients(network);
     }
 
+    //! Get the error of the network.
+    double Error() const { return err; }
+
   private:
     /**
      * Helper function to reset the network by zeroing the layer activations.
@@ -335,7 +335,7 @@ class RNN
     }
 
     /**
-     * Sum up all gradients and store the  results in the gradients storage.
+     * Sum up all gradients and store the results in the gradients storage.
      *
      * enable_if (SFINAE) is used to iterate through the network connections.
      * The general case peels off the first type and recurses, as usual with
@@ -364,17 +364,16 @@ class RNN
      * connections, and one for the general case which peels off the first type
      * and recurses, as usual with variadic function templates.
      */
-    template<size_t I = 0, typename VecType, typename... Tp>
+    template<size_t I = 0, typename... Tp>
     typename std::enable_if<I == sizeof...(Tp) - 1, void>::type
-    ApplyGradients(std::tuple<Tp...>& /* unused */,
-                   const VecType& /* unused */) { }
+    ApplyGradients(std::tuple<Tp...>& /* unused */) { }
 
-    template<size_t I = 0, typename VecType, typename... Tp>
+    template<size_t I = 0, typename... Tp>
     typename std::enable_if<I < sizeof...(Tp) - 1, void>::type
-    ApplyGradients(std::tuple<Tp...>& t, const VecType& input)
+    ApplyGradients(std::tuple<Tp...>& t)
     {
       Gradients(std::get<I>(t));
-      ApplyGradients<I + 1, VecType, Tp...>(t, input);
+      ApplyGradients<I + 1, Tp...>(t);
     }
 
     /**



More information about the mlpack-git mailing list