[mlpack-git] mlpack-2.0.x: Update to --output_predictions_file, but keep old version for reverse compatibility. (65f5496)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 20 15:32:41 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : mlpack-2.0.x
Link       : https://github.com/mlpack/mlpack/compare/e434bc4ac042534529a2a440a44d86935b4d7164...fc4195d27bb9e642356a384d1fa6fe10cbdf89a6

>---------------------------------------------------------------

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.


>---------------------------------------------------------------

65f5496e7eb4715142f60f8384490e806201605d
 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"




More information about the mlpack-git mailing list