[mlpack] 18/35: Update to --output_predictions_file, but keep old version for reverse compatibility.

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Sep 15 23:29:41 UTC 2016


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

bap pushed a commit to branch master
in repository mlpack.

commit 65f5496e7eb4715142f60f8384490e806201605d
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Jul 13 16:14:10 2016 -0400

    Update to --output_predictions_file, but keep old version for reverse compatibility.
---
 src/mlpack/methods/lars/lars_main.cpp | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/methods/lars/lars_main.cpp b/src/mlpack/methods/lars/lars_main.cpp
index 429fed3..5c5632c 100644
--- a/src/mlpack/methods/lars/lars_main.cpp
+++ b/src/mlpack/methods/lars/lars_main.cpp
@@ -56,10 +56,15 @@ PARAM_STRING("responses_file", "File containing y (responses/observations).",
 PARAM_STRING("input_model_file", "File to load model from.", "m", "");
 PARAM_STRING("output_model_file", "File to save model to.", "M", "");
 
-PARAM_STRING("test_file", "File containing points to regress on (test points).",
-    "t", "");
-PARAM_STRING("output_predictions", "If --test_file is specified, this "
-    "file is where the predicted responses will be saved.", "o", "");
+PARAM_STRING("test_file", "File containing points to regress on (test "
+    "points).", "t", "");
+
+// Kept for reverse compatibility until mlpack 3.0.0.
+PARAM_STRING("output_predictions", "If --test_file is specified, this file "
+    "is where the predicted responses will be saved.", "");
+// This is the future name of the parameter.
+PARAM_STRING("output_predictions_file", "If --test_file is specified, this "
+    "file is where the predicted responses will be saved.", "o");
 
 PARAM_DOUBLE("lambda1", "Regularization parameter for l1-norm penalty.", "l",
     0);
@@ -82,6 +87,20 @@ int main(int argc, char* argv[])
   double lambda2 = CLI::GetParam<double>("lambda2");
   bool useCholesky = CLI::HasParam("use_cholesky");
 
+  // Reverse compatibility.  We can remove these for mlpack 3.0.0.
+  if (CLI::HasParam("output_predictions") &&
+      CLI::HasParam("output_predictions_file"))
+    Log::Fatal << "Cannot specify both --output_predictions and "
+        << "--output_predictions_file!" << endl;
+
+  if (CLI::HasParam("output_predictions"))
+  {
+    Log::Warn << "--output_predictions is deprecated and will be removed in "
+        << "mlpack 3.0.0; use --output_predictions_file instead." << endl;
+    CLI::GetParam<string>("output_predictions_file") =
+        CLI::GetParam<string>("output_predictions");
+  }
+
   // Check parameters -- make sure everything given makes sense.
   if (CLI::HasParam("input_file") && !CLI::HasParam("responses_file"))
     Log::Fatal << "--input_file (-i) is specified, but --responses_file (-r) is"

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