[mlpack-svn] r13017 - mlpack/trunk/src/mlpack/methods/lars

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Jun 11 14:36:50 EDT 2012


Author: rcurtin
Date: 2012-06-11 14:36:49 -0400 (Mon, 11 Jun 2012)
New Revision: 13017

Modified:
   mlpack/trunk/src/mlpack/methods/lars/lars_main.cpp
Log:
Clean up LARS executable.


Modified: mlpack/trunk/src/mlpack/methods/lars/lars_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/lars/lars_main.cpp	2012-06-11 17:36:04 UTC (rev 13016)
+++ mlpack/trunk/src/mlpack/methods/lars/lars_main.cpp	2012-06-11 18:36:49 UTC (rev 13017)
@@ -55,15 +55,18 @@
   double lambda2 = CLI::GetParam<double>("lambda2");
   bool useCholesky = CLI::GetParam<bool>("use_cholesky");
 
-  // Load covariates.
+  // Load covariates.  We can avoid LARS transposing our data by choosing to not
+  // transpose this data.
   const string matXFilename = CLI::GetParam<string>("input_file");
   mat matX;
-  data::Load(matXFilename.c_str(), matX, true);
+  data::Load(matXFilename.c_str(), matX, true, false);
 
-  // Load targets.
+  // Load responses.  The responses should be a one-dimensional vector, and it
+  // seems more likely that these will be stored with one response per line (one
+  // per row).  So we should not transpose upon loading.
   const string yFilename = CLI::GetParam<string>("responses_file");
   mat matY; // Will be a vector.
-  data::Load(yFilename.c_str(), matY, true);
+  data::Load(yFilename.c_str(), matY, true, false);
 
   // Make sure y is oriented the right way.
   if (matY.n_rows == 1)
@@ -78,7 +81,7 @@
   // Do LARS.
   LARS lars(useCholesky, lambda1, lambda2);
   vec beta;
-  lars.Regress(matX, matY.unsafe_col(0), beta);
+  lars.Regress(matX, matY.unsafe_col(0), beta, false /* do not transpose */);
 
   const string betaFilename = CLI::GetParam<string>("output_file");
   beta.save(betaFilename, raw_ascii);




More information about the mlpack-svn mailing list