[mlpack-git] master: Avoid calculating the bounds when oldScore is the best possible. (e4cf1fd)

gitdub at mlpack.org gitdub at mlpack.org
Wed Aug 17 15:06:48 EDT 2016


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

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

commit e4cf1fd252b710809654515dccc30a299d0380e2
Author: MarcosPividori <marcos.pividori at gmail.com>
Date:   Wed Aug 17 16:06:39 2016 -0300

    Avoid calculating the bounds when oldScore is the best possible.


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

e4cf1fd252b710809654515dccc30a299d0380e2
 src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
index df4913e..70f0bc0 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
@@ -331,10 +331,7 @@ inline double NeighborSearchRules<SortPolicy, MetricType, TreeType>::Rescore(
     TreeType& /* referenceNode */,
     const double oldScore) const
 {
-  if (oldScore == DBL_MAX)
-    return oldScore;
-
-  if (oldScore == SortPolicy::BestDistance())
+  if (oldScore == DBL_MAX || oldScore == 0.0)
     return oldScore;
 
   const double distance = SortPolicy::ConvertToDistance(oldScore);




More information about the mlpack-git mailing list