[mlpack-git] master: Better warnings when --output_file is not specified. (d665abe)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 13 16:04:39 EDT 2016


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

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

commit d665abeb62ee6813b5934603e254b328ecc99f75
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Jul 13 16:04:39 2016 -0400

    Better warnings when --output_file is not specified.


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

d665abeb62ee6813b5934603e254b328ecc99f75
 src/mlpack/methods/cf/cf_main.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/cf/cf_main.cpp b/src/mlpack/methods/cf/cf_main.cpp
index 599b86a..2574e91 100644
--- a/src/mlpack/methods/cf/cf_main.cpp
+++ b/src/mlpack/methods/cf/cf_main.cpp
@@ -156,7 +156,8 @@ void PerformAction(CF& c)
 
     // Save the output.
     const string outputFile = CLI::GetParam<string>("output_file");
-    data::Save(outputFile, recommendations);
+    if (outputFile != "")
+      data::Save(outputFile, recommendations);
   }
 
   if (CLI::HasParam("test_file"))
@@ -262,6 +263,15 @@ int main(int argc, char** argv)
     Log::Fatal << "Both --query_file and --all_user_recommendations are given, "
         << "but only one is allowed!" << endl;
 
+  if (!CLI::HasParam("output_file") && !CLI::HasParam("output_model_file"))
+    Log::Warn << "Neither --output_file nor --output_model_file are specified; "
+        << "no output will be saved." << endl;
+
+  if (CLI::HasParam("output_file") && (!CLI::HasParam("query_file") ||
+      CLI::HasParam("all_user_recommendations")))
+    Log::Warn << "--output_file is ignored because neither --query_file nor "
+        << "--all_user_recommendations are specified." << endl;
+
   // Either load from a model, or train a model.
   if (CLI::HasParam("training_file"))
   {




More information about the mlpack-git mailing list