[mlpack-git] master: Add warning for kernel_pca when --output_file is not specified. (bbc0efc)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 13 17:03:40 EDT 2016


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

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

commit bbc0efc964b43adc6190800f03a77130af917068
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.


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

bbc0efc964b43adc6190800f03a77130af917068
 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 a861051..83686f1 100644
--- a/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp
+++ b/src/mlpack/methods/kernel_pca/kernel_pca_main.cpp
@@ -144,6 +144,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");
@@ -234,5 +238,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