[mlpack-git] mlpack-2.0.x: Better warnings when --output_file is not specified. (357a169)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 20 15:31:42 EDT 2016


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

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

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

    Better warnings when --output_file is not specified.


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

357a169b03b139d55b3676d9657c2d8671310797
 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 5724fdf..fefefb6 100644
--- a/src/mlpack/methods/cf/cf_main.cpp
+++ b/src/mlpack/methods/cf/cf_main.cpp
@@ -163,7 +163,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"))
@@ -269,6 +270,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