[mlpack-git] master: Update to --output_predictions_file, but keep old version for reverse compatibility. (156c92e)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 13 16:14:10 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/59bc0b32630a3ad786706993f4d5e8b087f1c702...0d9a0e263a32b99d8dcf5d2723b3b92c67e669fc

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

commit 156c92e82d3c6beba1d9e8a9795a0b849b15fca9
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.


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

156c92e82d3c6beba1d9e8a9795a0b849b15fca9
 src/mlpack/methods/lars/lars_main.cpp | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/lars/lars_main.cpp b/src/mlpack/methods/lars/lars_main.cpp
index d4eb701..5bae11f 100644
--- a/src/mlpack/methods/lars/lars_main.cpp
+++ b/src/mlpack/methods/lars/lars_main.cpp
@@ -51,8 +51,13 @@ PARAM_STRING_OUT("output_model_file", "File to save model to.", "M");
 
 PARAM_STRING_IN("test_file", "File containing points to regress on (test "
     "points).", "t", "");
+
+// Kept for reverse compatibility until mlpack 3.0.0.
 PARAM_STRING_OUT("output_predictions", "If --test_file is specified, this file "
-    "is where the predicted responses will be saved.", "o");
+    "is where the predicted responses will be saved.", "");
+// This is the future name of the parameter.
+PARAM_STRING_OUT("output_predictions_file", "If --test_file is specified, this "
+    "file is where the predicted responses will be saved.", "o");
 
 PARAM_DOUBLE_IN("lambda1", "Regularization parameter for l1-norm penalty.", "l",
     0);
@@ -75,6 +80,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