[mlpack-svn] r16308 - mlpack/trunk/src/mlpack/methods/neighbor_search

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Feb 19 09:57:23 EST 2014


Author: rcurtin
Date: Wed Feb 19 09:57:22 2014
New Revision: 16308

Log:
When the parent-child rule can't be applied, the correct bound wasn't being used
before.  This fixes that.


Modified:
   mlpack/trunk/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp	Wed Feb 19 09:57:22 2014
@@ -183,7 +183,11 @@
   }
   else
   {
-    adjustedScore = SortPolicy::CombineBest(adjustedScore, queryDescDist);
+    // If the parent node is NULL, force adjustedScore to be such that it can't
+    // be pruned.  Otherwise use the parent descendant distance.
+    const double queryParentDescDist = (queryNode.Parent() == NULL) ?
+        bestDistance : queryNode.Parent()->FurthestDescendantDistance();
+    adjustedScore = SortPolicy::CombineBest(adjustedScore, queryParentDescDist);
   }
 
   if (traversalInfo.LastReferenceNode() == referenceNode.Parent())
@@ -193,7 +197,11 @@
   }
   else
   {
-    adjustedScore = SortPolicy::CombineBest(adjustedScore, refDescDist);
+    // If the parent node is NULL, force adjustedScore to be such that it can't
+    // be pruned.  Otherwise use the parent descendant distance.
+    const double refParentDescDist = (referenceNode.Parent() == NULL) ?
+        bestDistance : referenceNode.Parent()->FurthestDescendantDistance();
+    adjustedScore = SortPolicy::CombineBest(adjustedScore, refParentDescDist);
   }
 
   // Can we prune?



More information about the mlpack-svn mailing list