[mlpack-svn] r11517 - mlpack/trunk/src/mlpack/methods/linear_regression

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Feb 14 14:35:12 EST 2012


Author: jcline3
Date: 2012-02-14 14:35:11 -0500 (Tue, 14 Feb 2012)
New Revision: 11517

Modified:
   mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp
Log:
more comments for the comment god

Modified: mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp	2012-02-14 19:24:31 UTC (rev 11516)
+++ mlpack/trunk/src/mlpack/methods/linear_regression/linear_regression_main.cpp	2012-02-14 19:35:11 UTC (rev 11517)
@@ -60,34 +60,42 @@
 
   bool computeModel;
 
-  if (trainName.empty())
+  // We want to determine if an input file XOR model file were given
+  if (trainName.empty()) // The user specified no input file
   {
-    if (modelName.empty())
+    if (modelName.empty()) // The user specified no model file, error and exit
     {
       Log::Fatal << "You must specify either --input_file or --model_file." << std::endl;
       exit(1);
     }
-    else
+    else // The model file was specified, no problems
     {
       computeModel = false;
     }
   }
+  // The user specified an input file but no model file, no problems
   else if (modelName.empty())
   {
     computeModel = true;
   }
+  // The user specified both an input file and model file.
+  // This is ambiguous -- which model should we use? A generated one or given one?
+  // Report error and exit.
   else
   {
       Log::Fatal << "You must specify either --input_file or --model_file, not both." << std::endl;
       exit(1);
   }
 
+  // If they specified a model file, we also need a test file or we
+  // have nothing to do.
   if(!computeModel && testName.empty())
   {
     Log::Fatal << "When specifying --model_file, you must also specify --test_file." << std::endl;
     exit(1);
   }
 
+  // An input file was given and we need to generate the model.
   if (computeModel)
   {
     Timer::Start("load_regressors");
@@ -131,6 +139,7 @@
   if (!testName.empty() )
   {
 
+    // A model file was passed in, so load it
     if (!computeModel)
     {
       Timer::Start("load_model");
@@ -138,11 +147,13 @@
       Timer::Stop("load_model");
     }
 
+    // Load the test file data
     arma::mat points;
     Timer::Stop("load_test_points");
     data::Load(testName.c_str(), points, true);
     Timer::Stop("load_test_points");
 
+    // Perform the predictions using our model
     arma::vec predictions;
     Timer::Start("prediction");
     lr.Predict(points, predictions);




More information about the mlpack-svn mailing list