[mlpack-svn] r10142 - mlpack/trunk/src/contrib/march/n_point

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Nov 4 15:15:45 EDT 2011


Author: march
Date: 2011-11-04 15:15:45 -0400 (Fri, 04 Nov 2011)
New Revision: 10142

Modified:
   mlpack/trunk/src/contrib/march/n_point/generate_random_problem.h
   mlpack/trunk/src/contrib/march/n_point/n_point_single_main.cc
   mlpack/trunk/src/contrib/march/n_point/node_tuple.cc
   mlpack/trunk/src/contrib/march/n_point/two_point_timing.cc
Log:
cleaned up a bit

Modified: mlpack/trunk/src/contrib/march/n_point/generate_random_problem.h
===================================================================
--- mlpack/trunk/src/contrib/march/n_point/generate_random_problem.h	2011-11-04 18:59:43 UTC (rev 10141)
+++ mlpack/trunk/src/contrib/march/n_point/generate_random_problem.h	2011-11-04 19:15:45 UTC (rev 10142)
@@ -15,6 +15,7 @@
 //#include <boost/random/uniform_real_distribution.hpp>
 //#include <boost/random/uniform_01.hpp>
 //#include <boost/random/variate_generator.hpp>
+
 #include <boost/random.hpp>
 
 #include <mlpack/core.h>

Modified: mlpack/trunk/src/contrib/march/n_point/n_point_single_main.cc
===================================================================
--- mlpack/trunk/src/contrib/march/n_point/n_point_single_main.cc	2011-11-04 18:59:43 UTC (rev 10141)
+++ mlpack/trunk/src/contrib/march/n_point/n_point_single_main.cc	2011-11-04 19:15:45 UTC (rev 10142)
@@ -160,8 +160,7 @@
     //std::cout << "Doing single bandwidth.\n";
     Log::Info << "Doing single bandwidth.\n";
 
-    //fx_timer_start(NULL, "single_bandwidth_time");
-    CLI::StartTimer("single_bandwidth_time");
+    Timers::StartTimer("single_bandwidth_time");
     
     // Build the trees
     
@@ -196,8 +195,7 @@
     
     alg.Compute();
     
-    //fx_timer_stop(NULL, "single_bandwidth_time");
-    CLI::StopTimer("single_bandwidth_time");
+    Timers::StopTimer("single_bandwidth_time");
     
     //std::cout << "\nSingle Bandwidth num tuples: " << single_alg.num_tuples() << "\n\n";
     Log::Info << std::endl << "Single bandwidth num tuples: " <<  matcher.results();
@@ -214,7 +212,7 @@
     Log::Info << "Doing naive." << std::endl;
     
     //fx_timer_start(NULL, "naive_time");
-    CLI::StartTimer("naive_time");
+    Timers::StartTimer("naive_time");
     
     CLI::GetParam<int>("tree/leaf_size") = std::max(data_mat.n_cols, 
                                                    random_mat.n_cols);
@@ -253,8 +251,7 @@
     alg.Compute();
     
     
-    //fx_timer_stop(NULL, "naive_time");
-    CLI::StopTimer("naive_time");
+    Timers::StopTimer("naive_time");
     
     //std::cout << "\nNaive num tuples: " << naive_alg.num_tuples() << "\n\n";
     Log::Info << std::endl << "Naive num tuples: " << matcher.results();

Modified: mlpack/trunk/src/contrib/march/n_point/node_tuple.cc
===================================================================
--- mlpack/trunk/src/contrib/march/n_point/node_tuple.cc	2011-11-04 18:59:43 UTC (rev 10141)
+++ mlpack/trunk/src/contrib/march/n_point/node_tuple.cc	2011-11-04 19:15:45 UTC (rev 10142)
@@ -23,7 +23,7 @@
 bool npt::NodeTuple::CheckSymmetry(size_t split_ind, bool is_left) {
   
   
-  int start_point;
+  int start_point = -1;
   int end_point = tuple_size_;
   
   // This uses the assumption that the symmetry was correct before
@@ -48,6 +48,8 @@
     }
   }
   
+  assert(start_point >= 0);
+  
   // only check the new node for symmetry with respect to the others
   if (is_left) {
     for (unsigned int i = start_point; i < split_ind; i++) {

Modified: mlpack/trunk/src/contrib/march/n_point/two_point_timing.cc
===================================================================
--- mlpack/trunk/src/contrib/march/n_point/two_point_timing.cc	2011-11-04 18:59:43 UTC (rev 10141)
+++ mlpack/trunk/src/contrib/march/n_point/two_point_timing.cc	2011-11-04 19:15:45 UTC (rev 10142)
@@ -17,6 +17,7 @@
 
 PARAM_INT_REQ("num_points", "The size of the computation to run", NULL);
 PARAM_INT("tuple_size", "The order of the correlation to time", NULL, 2);
+PARAM_FLAG("save_data", "If specified, the data are written to a file", NULL);
 
 using namespace mlpack;
 using namespace npt;
@@ -35,6 +36,15 @@
   arma::mat data_mat(3, num_points);
   problem_gen.GenerateRandomSet(data_mat);
   
+  if (CLI::HasParam("save_data")) {
+    std::string data_name("timing_data.csv");
+    arma::mat data_trans = trans(data_mat);
+    data_trans.save(data_name, arma::raw_ascii);
+    
+    return 0;
+    
+  }
+  
   arma::colvec weights(num_points);
 
   arma::mat matcher_lower_bounds(tuple_size, tuple_size);
@@ -42,8 +52,10 @@
   
   problem_gen.GenerateRandomMatcher(matcher_lower_bounds, matcher_upper_bounds);
   
-  CLI::StartTimer("single_bandwidth_time");
   
+  
+  Timers::StartTimer("single_bandwidth_time");
+  
   std::vector<size_t> old_from_new_data;
   
   NptNode* data_tree = new NptNode(data_mat, old_from_new_data);
@@ -76,8 +88,13 @@
   alg.Compute();
   
   
-  CLI::StopTimer("single_bandwidth_time");
+  Timers::StopTimer("single_bandwidth_time");
   
+  Log::Info << std::endl << "lower bounds: ";
+  Log::Info << std::endl << matcher_lower_bounds << std::endl;
+  Log::Info << "upper bounds: ";
+  Log::Info << std::endl << matcher_upper_bounds << std::endl;
+  
   Log::Info << std::endl << "Single bandwidth num tuples: " <<  matcher.results();
   
   Log::Info << std::endl << std::endl;




More information about the mlpack-svn mailing list