[mlpack-git] master: Clarify error messages for -T/-D. (5310731)

gitdub at mlpack.org gitdub at mlpack.org
Thu Aug 18 17:16:42 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/0a19d07bd39e6223991976474bc79671ba8aa0f0...531073162b69d331d807d1de152641237496a2d4

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

commit 531073162b69d331d807d1de152641237496a2d4
Author: Ryan Curtin <ryan at ratml.org>
Date:   Thu Aug 18 17:16:42 2016 -0400

    Clarify error messages for -T/-D.


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

531073162b69d331d807d1de152641237496a2d4
 src/mlpack/methods/neighbor_search/kfn_main.cpp | 16 ++++++++++++----
 src/mlpack/methods/neighbor_search/knn_main.cpp | 16 ++++++++++++----
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/kfn_main.cpp b/src/mlpack/methods/neighbor_search/kfn_main.cpp
index 64790da..58d68cc 100644
--- a/src/mlpack/methods/neighbor_search/kfn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/kfn_main.cpp
@@ -145,6 +145,14 @@ int main(int argc, char *argv[])
         << " is not being performed because k (--k) is not specified!  No "
         << "results will be saved." << endl;
 
+  if (!CLI::HasParam("k") && CLI::HasParam("true_neighbors_file"))
+    Log::Warn << "--true_neighbors_file (-T) ignored because no search is being"
+        << " performed (--k is not specified)." << endl;
+
+  if (!CLI::HasParam("k") && CLI::HasParam("true_distances_file"))
+    Log::Warn << "--true_distances_file (-D) ignored because no search is being"
+        << " performed (--k is not specified)." << endl;
+
   // Sanity check on leaf size.
   const int lsInt = CLI::GetParam<int>("leaf_size");
   if (lsInt < 1)
@@ -291,8 +299,8 @@ int main(int argc, char *argv[])
     if (CLI::HasParam("true_distances_file"))
     {
       if (kfn.Epsilon() == 0)
-        Log::Warn << "--true_distances_file (-D) specified on exact neighbor "
-            << "search." << endl;
+        Log::Warn << "--true_distances_file (-D) specified, but the search is "
+            << "exact, so there is no need to calculate the error!" << endl;
 
       const string trueDistancesFile = CLI::GetParam<string>(
           "true_distances_file");
@@ -312,8 +320,8 @@ int main(int argc, char *argv[])
     if (CLI::HasParam("true_neighbors_file"))
     {
       if (kfn.Epsilon() == 0)
-        Log::Warn << "--true_neighbors_file (-T) specified on exact neighbor "
-            << "search." << endl;
+        Log::Warn << "--true_neighbors_file (-T) specified, but the search is "
+            << "exact, so there is no need to calculate the recall!" << endl;
 
       const string trueNeighborsFile = CLI::GetParam<string>(
           "true_neighbors_file");
diff --git a/src/mlpack/methods/neighbor_search/knn_main.cpp b/src/mlpack/methods/neighbor_search/knn_main.cpp
index 9b2921f..f0456f2 100644
--- a/src/mlpack/methods/neighbor_search/knn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/knn_main.cpp
@@ -154,6 +154,14 @@ int main(int argc, char *argv[])
         << "is not being performed because k (--k) is not specified!  No "
         << "results will be saved." << endl;
 
+  if (!CLI::HasParam("k") && CLI::HasParam("true_neighbors_file"))
+    Log::Warn << "--true_neighbors_file (-T) ignored because no search is being"
+        << " performed (--k is not specified)." << endl;
+
+  if (!CLI::HasParam("k") && CLI::HasParam("true_distances_file"))
+    Log::Warn << "--true_distances_file (-D) ignored because no search is being"
+        << " performed (--k is not specified)." << endl;
+
   // Sanity check on leaf size.
   const int lsInt = CLI::GetParam<int>("leaf_size");
   if (lsInt < 1)
@@ -311,8 +319,8 @@ int main(int argc, char *argv[])
     if (CLI::HasParam("true_distances_file"))
     {
       if (knn.TreeType() != KNNModel::SPILL_TREE && knn.Epsilon() == 0)
-        Log::Warn << "--true_distances_file (-D) specified on exact neighbor "
-            << "search." << endl;
+        Log::Warn << "--true_distances_file (-D) specified, but the search is "
+            << "exact, so there is no need to calculate the error!" << endl;
 
       const string trueDistancesFile = CLI::GetParam<string>(
           "true_distances_file");
@@ -332,8 +340,8 @@ int main(int argc, char *argv[])
     if (CLI::HasParam("true_neighbors_file"))
     {
       if (knn.TreeType() != KNNModel::SPILL_TREE && knn.Epsilon() == 0)
-        Log::Warn << "--true_neighbors_file (-T) specified on exact neighbor "
-            << "search." << endl;
+        Log::Warn << "--true_neighbors_file (-T) specified, but the search is "
+            << "exact, so there is no need to calculate the recall!" << endl;
 
       const string trueNeighborsFile = CLI::GetParam<string>(
           "true_neighbors_file");




More information about the mlpack-git mailing list