[mlpack-git] mlpack-2.0.x: Add warning for kernel_pca when --output_file is not specified. (46a7ffd)

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


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

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

commit 46a7ffd26400022816a194bef0f09d3a511b9912
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Jul 13 17:03:40 2016 -0400

    Add warning for kernel_pca when --output_file is not specified.
    
    Also allow the user to not specify that option.


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

46a7ffd26400022816a194bef0f09d3a511b9912
 src/mlpack/methods/kernel_pca/kernel_pca_main.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp b/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp
index bac03e5..ae1df30 100644
--- a/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp
+++ b/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp
@@ -153,6 +153,10 @@ int main(int argc, char** argv)
   // Parse command line options.
   CLI::ParseCommandLine(argc, argv);
 
+  if (!CLI::HasParam("output_file"))
+    Log::Warn << "--output_file is not specified; no output will be saved!"
+        << endl;
+
   // Load input dataset.
   mat dataset;
   const string inputFile = CLI::GetParam<string>("input_file");
@@ -243,5 +247,6 @@ int main(int argc, char** argv)
 
   // Save the output dataset.
   const string outputFile = CLI::GetParam<string>("output_file");
-  data::Save(outputFile, dataset, true); // Fatal on failure.
+  if (outputFile != "")
+    data::Save(outputFile, dataset, true); // Fatal on failure.
 }




More information about the mlpack-git mailing list