[mlpack] 82/324: Assume the response to be the last column of the input file, as pointed out in the description.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:21:58 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 b2cdb6513c3b9cc6de875524c65f882e6df66609
Author: marcus <marcus at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Thu Jun 26 14:25:46 2014 +0000

    Assume the response to be the last column of the input file, as pointed out in the description.
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16720 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 .../logistic_regression/logistic_regression_main.cpp       | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mlpack/methods/logistic_regression/logistic_regression_main.cpp b/src/mlpack/methods/logistic_regression/logistic_regression_main.cpp
index 6e204e1..6a053ac 100644
--- a/src/mlpack/methods/logistic_regression/logistic_regression_main.cpp
+++ b/src/mlpack/methods/logistic_regression/logistic_regression_main.cpp
@@ -104,11 +104,6 @@ int main(int argc, char** argv)
     Log::Fatal << "One of --model_file or --input_file must be specified."
         << endl;
 
-  // If inputFile is specified, it must also have some responses with it.
-  if (!inputFile.empty() && inputResponsesFile.empty())
-    Log::Fatal << "If --input_file is specified, then --input_responses must "
-        << "also be specified." << endl;
-
   // If they want predictions, they should supply a file to save them to.  This
   // is only a warning because the program can still work.
   if (!testFile.empty() && outputPredictionsFile.empty())
@@ -154,6 +149,8 @@ int main(int argc, char** argv)
   // Load matrices.
   if (!inputFile.empty())
     data::Load(inputFile, regressors, true);
+
+  // Check if the responses are in a separate file.
   if (!inputResponsesFile.empty())
   {
     data::Load(inputResponsesFile, responses, true);
@@ -163,6 +160,13 @@ int main(int argc, char** argv)
       Log::Fatal << "The responses (--input_responses) must have the same "
           << "number of points as the input dataset (--input_file)." << endl;
   }
+  else
+  {
+    // The initial predictors for y, Nx1.
+    responses = trans(regressors.row(regressors.n_rows - 1));
+    regressors.shed_row(regressors.n_rows - 1);
+  }
+
   if (!testFile.empty())
     data::Load(testFile, testSet, true);
   if (!modelFile.empty())

-- 
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