[mlpack-git] master: Add Warning when true_neighbors_file and true_distances_file are provided in exact neighbor search. (c5fe485)

gitdub at mlpack.org gitdub at mlpack.org
Wed Aug 17 16:43:56 EDT 2016


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

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

commit c5fe485b25e93f35b14f2c9fbc6b69ddbe59a837
Author: MarcosPividori <marcos.pividori at gmail.com>
Date:   Wed Aug 17 17:41:57 2016 -0300

    Add Warning when true_neighbors_file and true_distances_file are provided in exact neighbor search.


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

c5fe485b25e93f35b14f2c9fbc6b69ddbe59a837
 src/mlpack/methods/neighbor_search/kfn_main.cpp | 12 ++++++++++--
 src/mlpack/methods/neighbor_search/knn_main.cpp | 12 ++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/kfn_main.cpp b/src/mlpack/methods/neighbor_search/kfn_main.cpp
index 09e81df..c2f1ea6 100644
--- a/src/mlpack/methods/neighbor_search/kfn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/kfn_main.cpp
@@ -121,8 +121,8 @@ int main(int argc, char *argv[])
     // Notify the user of parameters that will be only be considered for query
     // tree.
     if (CLI::HasParam("leaf_size"))
-      Log::Warn << "--leaf_size (-l) will only be considered for the query tree,
-          "because --input_model_file is specified." << endl;
+      Log::Warn << "--leaf_size (-l) will only be considered for the query "
+          "tree, because --input_model_file is specified." << endl;
   }
 
   // The user should give something to do...
@@ -285,6 +285,10 @@ int main(int argc, char *argv[])
     // Calculate the effective error, if desired.
     if (CLI::HasParam("true_distances_file"))
     {
+      if (knn.Epsilon() == 0)
+        Log::Warn << "--true_distances_file (-D) specified on exact neighbor "
+            << "search." << endl;
+
       const string trueDistancesFile = CLI::GetParam<string>(
           "true_distances_file");
       arma::mat trueDistances;
@@ -302,6 +306,10 @@ int main(int argc, char *argv[])
     // Calculate the recall, if desired.
     if (CLI::HasParam("true_neighbors_file"))
     {
+      if (knn.Epsilon() == 0)
+        Log::Warn << "--true_neighbors_file (-T) specified on exact neighbor "
+            << "search." << endl;
+
       const string trueNeighborsFile = CLI::GetParam<string>(
           "true_neighbors_file");
       arma::Mat<size_t> trueNeighbors;
diff --git a/src/mlpack/methods/neighbor_search/knn_main.cpp b/src/mlpack/methods/neighbor_search/knn_main.cpp
index a7e6b2a..9ff6bd7 100644
--- a/src/mlpack/methods/neighbor_search/knn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/knn_main.cpp
@@ -131,8 +131,8 @@ int main(int argc, char *argv[])
     // Notify the user of parameters that will be only be considered for query
     // tree.
     if (CLI::HasParam("leaf_size"))
-      Log::Warn << "--leaf_size (-l) will only be considered for the query tree,
-          "because --input_model_file is specified." << endl;
+      Log::Warn << "--leaf_size (-l) will only be considered for the query "
+          "tree, because --input_model_file is specified." << endl;
   }
 
   // The user should give something to do...
@@ -306,6 +306,10 @@ int main(int argc, char *argv[])
     // Calculate the effective error, if desired.
     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;
+
       const string trueDistancesFile = CLI::GetParam<string>(
           "true_distances_file");
       arma::mat trueDistances;
@@ -323,6 +327,10 @@ int main(int argc, char *argv[])
     // Calculate the recall, if desired.
     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;
+
       const string trueNeighborsFile = CLI::GetParam<string>(
           "true_neighbors_file");
       arma::Mat<size_t> trueNeighbors;




More information about the mlpack-git mailing list