[mlpack-git] master: Add network auxiliary functions test. (53637f2)

gitdub at mlpack.org gitdub at mlpack.org
Fri Feb 19 09:03:09 EST 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/f6dd2f7a9752a7db8ec284a938b3e84a13d0bfb2...6205f3e0b62b56452b2a4afc4da24fce5b21e72f

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

commit 53637f2853216a76083cae835f804180ecf1c2b2
Author: marcus <marcus.edel at fu-berlin.de>
Date:   Fri Feb 19 15:03:09 2016 +0100

    Add network auxiliary functions test.


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

53637f2853216a76083cae835f804180ecf1c2b2
 src/mlpack/tests/CMakeLists.txt        |  4 +--
 src/mlpack/tests/network_util_test.cpp | 59 ++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/tests/CMakeLists.txt b/src/mlpack/tests/CMakeLists.txt
index 9fca06a..fff69ea 100644
--- a/src/mlpack/tests/CMakeLists.txt
+++ b/src/mlpack/tests/CMakeLists.txt
@@ -3,8 +3,6 @@ add_executable(mlpack_test
   mlpack_test.cpp
   activation_functions_test.cpp
   adaboost_test.cpp
-  ada_delta_test.cpp
-  adam_test.cpp
   allkfn_test.cpp
   allknn_test.cpp
   allkrann_search_test.cpp
@@ -47,6 +45,7 @@ add_executable(mlpack_test
   minibatch_sgd_test.cpp
   nbc_test.cpp
   nca_test.cpp
+  network_util_test.cpp
   nmf_test.cpp
   pca_test.cpp
   perceptron_test.cpp
@@ -74,6 +73,7 @@ add_executable(mlpack_test
   svd_incremental_test.cpp
   nystroem_method_test.cpp
   armadillo_svd_test.cpp
+  recurrent_network_test.cpp
 )
 # Link dependencies of test executable.
 target_link_libraries(mlpack_test
diff --git a/src/mlpack/tests/network_util_test.cpp b/src/mlpack/tests/network_util_test.cpp
new file mode 100644
index 0000000..05be51f
--- /dev/null
+++ b/src/mlpack/tests/network_util_test.cpp
@@ -0,0 +1,59 @@
+/**
+ * @file network_util_test.cpp
+ * @author Marcus edel
+ *
+ * Simple tests for things in the network_util file.
+ */
+#include <mlpack/core.hpp>
+
+#include <mlpack/methods/ann/network_util.hpp>
+#include <mlpack/methods/ann/layer/linear_layer.hpp>
+#include <mlpack/methods/ann/layer/base_layer.hpp>
+
+#include <boost/test/unit_test.hpp>
+#include "old_boost_test_definitions.hpp"
+
+using namespace mlpack;
+using namespace mlpack::ann;
+
+BOOST_AUTO_TEST_SUITE(NetworkUtilTest);
+
+/**
+ * Test the network size auxiliary function.
+ */
+BOOST_AUTO_TEST_CASE(NetworkSizeTest)
+{
+  // // Create a two layer network without weights.
+  // BaseLayer<> baseLayer1;
+  // BaseLayer<> baseLayer2;
+  // auto noneWeightNetwork = std::tie(baseLayer1, baseLayer2);
+
+  // BOOST_REQUIRE_EQUAL(NetworkSize(noneWeightNetwork), 0);
+
+  // // Create a two layer network.
+  // LinearLayer<> linearLayer1(10, 10);
+  // LinearLayer<> linearLayer2(10, 100);
+
+  // // Reuse the layer form the first network.
+  // auto weightNetwork = std::tie(linearLayer1, baseLayer1, linearLayer2,
+  //     baseLayer2);
+
+  // BOOST_REQUIRE_EQUAL(NetworkSize(weightNetwork), 1100); 
+}
+
+/**
+ * Test the layer size auxiliary function.
+ */
+BOOST_AUTO_TEST_CASE(LayerSizeTest)
+{
+  // // Create layer without weights.
+  // BaseLayer<> baseLayer;
+  // BOOST_REQUIRE_EQUAL(LayerSize(baseLayer, baseLayer.OutputParameter()), 0);
+
+  // LinearLayer<> linearLayer(10, 10);
+  // BOOST_REQUIRE_EQUAL(LayerSize(linearLayer,
+  //     linearLayer.OutputParameter()), 100);
+
+}
+
+BOOST_AUTO_TEST_SUITE_END();




More information about the mlpack-git mailing list