[mlpack] 225/324: Patch from Sumedh: more tests for SVD

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit a06e3f6161d0027b8d564ae9dddfad1358b03a77
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Fri Jul 25 21:24:22 2014 +0000

    Patch from Sumedh: more tests for SVD
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16867 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/tests/svd_incremental_test.cpp | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/tests/svd_incremental_test.cpp b/src/mlpack/tests/svd_incremental_test.cpp
index ca92e05..ba2ba82 100644
--- a/src/mlpack/tests/svd_incremental_test.cpp
+++ b/src/mlpack/tests/svd_incremental_test.cpp
@@ -1,8 +1,10 @@
 #include <mlpack/core.hpp>
 #include <mlpack/methods/amf/amf.hpp>
 #include <mlpack/methods/amf/update_rules/svd_incomplete_incremental_learning.hpp>
+#include <mlpack/methods/amf/update_rules/svd_complete_incremental_learning.hpp>
 #include <mlpack/methods/amf/init_rules/random_init.hpp>
 #include <mlpack/methods/amf/termination_policies/incomplete_incremental_termination.hpp>
+#include <mlpack/methods/amf/termination_policies/complete_incremental_termination.hpp>
 #include <mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp>
 #include <mlpack/methods/amf/termination_policies/validation_RMSE_termination.hpp>
 
@@ -17,18 +19,45 @@ using namespace mlpack::amf;
 using namespace arma;
 
 /**
- * Test for convergence
+ * Test for convergence of incomplete incremenal learning
  */
 BOOST_AUTO_TEST_CASE(SVDIncompleteIncrementalConvergenceTest)
 {
   mlpack::math::RandomSeed(10);
   sp_mat data;
   data.sprandn(1000, 1000, 0.2);
+  
   SVDIncompleteIncrementalLearning svd(0.01);
   IncompleteIncrementalTermination<SimpleToleranceTermination<sp_mat> > iit;
+  
   AMF<IncompleteIncrementalTermination<SimpleToleranceTermination<sp_mat> >, 
       RandomInitialization, 
       SVDIncompleteIncrementalLearning> amf(iit, RandomInitialization(), svd);
+  
+  mat m1,m2;
+  amf.Apply(data, 2, m1, m2);
+  
+  BOOST_REQUIRE_NE(amf.TerminationPolicy().Iteration(), 
+                    amf.TerminationPolicy().MaxIterations());
+}
+
+/**
+ * Test for convergence of complete incremenal learning
+ */
+BOOST_AUTO_TEST_CASE(SVDCompleteIncrementalConvergenceTest)
+{
+  mlpack::math::RandomSeed(10);
+  sp_mat data;
+  data.sprandn(1000, 1000, 0.2);
+  
+  SVDCompleteIncrementalLearning<sp_mat> svd(0.01);
+  CompleteIncrementalTermination<SimpleToleranceTermination<sp_mat> > iit;
+  
+  AMF<CompleteIncrementalTermination<SimpleToleranceTermination<sp_mat> >, 
+      RandomInitialization, 
+      SVDCompleteIncrementalLearning<sp_mat> > amf(iit, 
+                                                   RandomInitialization(), 
+                                                   svd);
   mat m1,m2;
   amf.Apply(data, 2, m1, m2);
   

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list