[mlpack-git] master: Add a test for ADAM. (a8215ba)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Tue Oct 20 05:41:41 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/fecf1194c123ced12d56e7daad761c7b9aaac262...67e0a132c7f62820c734eb508fe1bc83128a3e13

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

commit a8215ba4799c74d196578ae702a0e18f7e485cce
Author: marcus <marcus.edel at fu-berlin.de>
Date:   Mon Oct 19 11:48:46 2015 +0200

    Add a test for ADAM.


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

a8215ba4799c74d196578ae702a0e18f7e485cce
 src/mlpack/tests/CMakeLists.txt                       |  1 +
 .../tests/{ada_delta_test.cpp => adam_test.cpp}       | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mlpack/tests/CMakeLists.txt b/src/mlpack/tests/CMakeLists.txt
index 25bb8e2..bf52fe9 100644
--- a/src/mlpack/tests/CMakeLists.txt
+++ b/src/mlpack/tests/CMakeLists.txt
@@ -4,6 +4,7 @@ add_executable(mlpack_test
   activation_functions_test.cpp
   adaboost_test.cpp
   ada_delta_test.cpp
+  adam_test.cpp
   allkfn_test.cpp
   allknn_test.cpp
   allkrann_search_test.cpp
diff --git a/src/mlpack/tests/ada_delta_test.cpp b/src/mlpack/tests/adam_test.cpp
similarity index 83%
copy from src/mlpack/tests/ada_delta_test.cpp
copy to src/mlpack/tests/adam_test.cpp
index aa78119..423268c 100644
--- a/src/mlpack/tests/ada_delta_test.cpp
+++ b/src/mlpack/tests/adam_test.cpp
@@ -1,8 +1,8 @@
 /**
- * @file ada_delta_test.cpp
+ * @file adam_test.cpp
  * @author Marcus Edel
  *
- * Tests the AdaDelta optimizer on a couple test models.
+ * Tests the Adam optimizer on a couple test models.
  */
 #include <mlpack/core.hpp>
 
@@ -18,7 +18,7 @@
 #include <mlpack/methods/ann/trainer/trainer.hpp>
 #include <mlpack/methods/ann/ffn.hpp>
 #include <mlpack/methods/ann/performance_functions/mse_function.hpp>
-#include <mlpack/methods/ann/optimizer/ada_delta.hpp>
+#include <mlpack/methods/ann/optimizer/adam.hpp>
 
 #include <boost/test/unit_test.hpp>
 #include "old_boost_test_definitions.hpp"
@@ -26,14 +26,14 @@
 using namespace mlpack;
 using namespace mlpack::ann;
 
-BOOST_AUTO_TEST_SUITE(AdaDeltaTest);
+BOOST_AUTO_TEST_SUITE(AdamTest);
 
 /**
  * Train and evaluate a vanilla network with the specified structure. Using the
  * iris data, the data set contains 3 classes. One class is linearly separable
  * from the other 2. The other two aren't linearly separable from each other.
  */
-BOOST_AUTO_TEST_CASE(SimpleAdaDeltaTestFunction)
+BOOST_AUTO_TEST_CASE(SimpleAdamTestFunction)
 {
   const size_t hiddenLayerSize = 10;
   const size_t maxEpochs = 100;
@@ -51,15 +51,15 @@ BOOST_AUTO_TEST_CASE(SimpleAdaDeltaTestFunction)
   // Construct a feed forward network using the specified parameters.
   RandomInitialization randInit(0.5, 0.5);
 
-  LinearLayer<AdaDelta, RandomInitialization> inputLayer(dataset.n_rows,
+  LinearLayer<Adam, RandomInitialization> inputLayer(dataset.n_rows,
       hiddenLayerSize, randInit);
-  BiasLayer<AdaDelta, RandomInitialization> inputBiasLayer(hiddenLayerSize,
+  BiasLayer<Adam, RandomInitialization> inputBiasLayer(hiddenLayerSize,
       1, randInit);
   BaseLayer<LogisticFunction> inputBaseLayer;
 
-  LinearLayer<AdaDelta, RandomInitialization> hiddenLayer1(hiddenLayerSize,
+  LinearLayer<Adam, RandomInitialization> hiddenLayer1(hiddenLayerSize,
       labels.n_rows, randInit);
-  BiasLayer<AdaDelta, RandomInitialization> hiddenBiasLayer1(labels.n_rows,
+  BiasLayer<Adam, RandomInitialization> hiddenBiasLayer1(labels.n_rows,
       1, randInit);
   BaseLayer<LogisticFunction> outputLayer;
 
@@ -87,6 +87,7 @@ BOOST_AUTO_TEST_CASE(SimpleAdaDeltaTestFunction)
 
   // Check if the selected model isn't already optimized.
   double classificationError = 1 - double(error) / dataset.n_cols;
+
   BOOST_REQUIRE_GE(classificationError, 0.09);
 
   // Train the feed forward network.



More information about the mlpack-git mailing list