[mlpack-git] master: Fix second bound to not be the first bound. In some situations, MinQueryNodeDistance() was equal to SecondClosestBound(). This fixes that. This also resolves an issue where SecondClosestBound() wasn't properly updated after an Elkan prune. (a06391e)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:02:26 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44

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

commit a06391e861d41597ba15b16e632ecf0861f23751
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Jan 27 22:03:20 2015 -0500

    Fix second bound to not be the first bound. In some situations, MinQueryNodeDistance() was equal to SecondClosestBound(). This fixes that. This also resolves an issue where SecondClosestBound() wasn't properly updated after an Elkan prune.


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

a06391e861d41597ba15b16e632ecf0861f23751
 .../methods/kmeans/dual_tree_kmeans_impl.hpp       | 109 +++++++++--------
 .../methods/kmeans/dual_tree_kmeans_rules_impl.hpp | 135 ++++++++++++---------
 2 files changed, 132 insertions(+), 112 deletions(-)

diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
index a9193e8..6e61d73 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
@@ -189,15 +189,9 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
     node->Stat().Owner() = node->Parent()->Stat().Owner();
 
   const size_t cluster = assignments[node->Descendant(0)];
-//  if (node->Begin() == 16954)
-//    Log::Info << "r16954c" << node->Count() << ", descendant 0 has cluster "
-//        << cluster << ".\n";
   bool allSame = true;
   for (size_t i = 1; i < node->NumDescendants(); ++i)
   {
-//    if (node->Begin() == 16954)
-//      Log::Info << "Descendant " << i << " has cluster " <<
-//          assignments[node->Descendant(i)] << ".\n";
     if (assignments[node->Descendant(i)] != cluster)
     {
       allSame = false;
@@ -211,6 +205,10 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
   const bool prunedLastIteration = node->Stat().HamerlyPruned();
   node->Stat().HamerlyPruned() = false;
 
+  if (node->Begin() == 37408)
+    Log::Warn << "r37408c" << node->Count() << " has owner " <<
+node->Stat().Owner() << ".\n";
+
   // The easy case: this node had an owner.
   if (node->Stat().Owner() < clusters)
   {
@@ -231,10 +229,10 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
     if (node->Stat().SecondClosestBound() == DBL_MAX && node->Parent() == NULL)
       node->Stat().SecondClosestBound() = 0.0; // Don't prune the root.
 
-//    if (node->Begin() == 16954)
-//      Log::Warn << "r16954c" << node->Count() << " scb " <<
-//node->Stat().SecondClosestBound() << " and lscb " <<
-//node->Stat().LastSecondClosestBound() << ".\n";
+    if (node->Begin() == 37408)
+      Log::Warn << "r37408c" << node->Count() << " scb " <<
+node->Stat().SecondClosestBound() << " and lscb " <<
+node->Stat().LastSecondClosestBound() << ".\n";
 
     // If both the second closest bound and last second closest bound are valid,
     // we have the option of taking the better of the two bounds.  But if only
@@ -266,26 +264,26 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
       // pruned by the parent, and was thus never visited with this node.  This
       // situation occurs if the second closest query node is not a descendant
       // of the second closest query node of the parent.
-//      if (node->Stat().SecondClosestQueryNode() != NULL)
-//      {
-//        if (node->Begin() == 16954)
-//        {
-//          Log::Warn << "Second closest query node is q" << ((TreeType*)
-//node->Stat().SecondClosestQueryNode())->Begin() << "c" << ((TreeType*)
-//node->Stat().SecondClosestQueryNode())->Count() << ", with scb " <<
-//node->Stat().SecondClosestBound() << ".\n";
-//          Log::Warn << "True SCB to this node should be " <<
-//node->MinDistance((TreeType*) node->Stat().SecondClosestQueryNode()) << ".\n";
-//        }
-//      }
-
-//      if (node->Stat().ClosestQueryNode() != NULL)
-//        if (node->Begin() == 16954)
-//          Log::Warn << "Closest query node: q" << ((TreeType*)
-//node->Stat().ClosestQueryNode())->Begin() << "c" << ((TreeType*)
-//node->Stat().ClosestQueryNode())->Count() << ", with MQND " <<
-//node->Stat().MaxQueryNodeDistance() << " and mQND " <<
-//node->Stat().MinQueryNodeDistance() << ".\n";
+      if (node->Stat().SecondClosestQueryNode() != NULL)
+      {
+        if (node->Begin() == 37408)
+        {
+          Log::Warn << "Second closest query node is q" << ((TreeType*)
+node->Stat().SecondClosestQueryNode())->Begin() << "c" << ((TreeType*)
+node->Stat().SecondClosestQueryNode())->Count() << ", with scb " <<
+node->Stat().SecondClosestBound() << ".\n";
+          Log::Warn << "True SCB to this node should be " <<
+node->MinDistance((TreeType*) node->Stat().SecondClosestQueryNode()) << ".\n";
+        }
+      }
+
+      if (node->Stat().ClosestQueryNode() != NULL)
+        if (node->Begin() == 37408)
+          Log::Warn << "Closest query node: q" << ((TreeType*)
+node->Stat().ClosestQueryNode())->Begin() << "c" << ((TreeType*)
+node->Stat().ClosestQueryNode())->Count() << ", with MQND " <<
+node->Stat().MaxQueryNodeDistance() << " and mQND " <<
+node->Stat().MinQueryNodeDistance() << ".\n";
 
       // If the closest query node contains more than one descendant, we have to
       // find the closest...
@@ -294,7 +292,7 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
       {
         size_t closest = centroids.n_cols;
         double closestDistance = DBL_MAX;
-//        size_t secondClosest = centroids.n_cols;
+        size_t secondClosest = centroids.n_cols;
         double secondClosestDistance = DBL_MAX;
         for (size_t i = 0; i < cqn->NumDescendants(); ++i)
         {
@@ -306,14 +304,14 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
           ++distanceCalculations;
           if (distance < closestDistance)
           {
-//            secondClosest = closest;
+            secondClosest = closest;
             secondClosestDistance = closestDistance;
             closest = index;
             closestDistance = distance;
           }
           else if (distance < secondClosestDistance)
           {
-//            secondClosest = index;
+            secondClosest = index;
             secondClosestDistance = distance;
           }
         }
@@ -327,16 +325,16 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
         if (secondClosestDistance < node->Stat().SecondClosestBound())
           node->Stat().SecondClosestBound() = secondClosestDistance;
 
-//      if (node->Begin() == 16954)
-//        Log::Warn << "After recalculation, closest for r" << node->Begin() << "c" << node->Count()
-//<< " is " << closest << ", with mQND " << node->Stat().MinQueryNodeDistance() <<
-//", MQND" << node->Stat().MaxQueryNodeDistance() << ", and scb " <<
-//node->Stat().SecondClosestBound() << ", " << secondClosest << ".\n";
+      if (node->Begin() == 37408)
+        Log::Warn << "After recalculation, closest for r" << node->Begin() << "c" << node->Count()
+<< " is " << closest << ", with mQND " << node->Stat().MinQueryNodeDistance() <<
+", MQND" << node->Stat().MaxQueryNodeDistance() << ", and scb " <<
+node->Stat().SecondClosestBound() << ", " << secondClosest << ".\n";
       }
 
 //      if (node->Parent() != NULL &&
 //node->Parent()->Stat().SecondClosestQueryNode() != NULL)
-//        if (node->Begin() == 16954)
+//        if (node->Begin() == 37408)
 //          Log::Warn << "Parent's (r" << node->Parent()->Begin() << "c"
 //<< node->Parent()->Count() << ") second closest query node is q" << ((TreeType*)
 //node->Parent()->Stat().SecondClosestQueryNode())->Begin() << "c" << ((TreeType*)
@@ -366,22 +364,26 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
       }
     }
 
-//    if (node->Begin() == 16954)
-//    {
-//      Log::Warn << "Attempt Hamerly prune on r16954c" << node->Count() <<
-//          " with MQND " << node->Stat().MaxQueryNodeDistance() << ", scb "
-//          << node->Stat().SecondClosestBound() << ", owner " <<
-//node->Stat().Owner() << ", and clusterDistances " << clusterDistances[clusters]
-//<< ".\n";
-//    }
+    if (node->Begin() == 37408)
+    {
+      Log::Warn << "Attempt Hamerly prune on r37408c" << node->Count() <<
+          " with MQND " << node->Stat().MaxQueryNodeDistance() << ", scb "
+          << node->Stat().SecondClosestBound() << ", owner " <<
+node->Stat().Owner() << ", and clusterDistances " << clusterDistances[clusters]
+<< ".\n";
+    }
 
     // Check the second bound.  (This is time-consuming...)
+/*    arma::vec minDistances(centroids.n_cols);
     for (size_t j = 0; j < node->NumDescendants(); ++j)
     {
       arma::vec distances(centroids.n_cols);
       double secondClosestDist = DBL_MAX;
       for (size_t i = 0; i < centroids.n_cols; ++i)
       {
+        if (j == 0)
+          minDistances[i] = node->MinDistance(centroids.col(i));
+
         const double distance = MetricType::Evaluate(centroids.col(i),
             dataset.col(node->Descendant(j)));
         if (distance < secondClosestDist && i != node->Stat().Owner())
@@ -390,8 +392,9 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
         distances(i) = distance;
       }
 
-//        if (node->Begin() == 16954)
-//          Log::Warn << "r16954c" << node->Count() << ": " << distances.t();
+      if (j == 0)
+        if (node->Begin() == 37408)
+          Log::Warn << "r37408c" << node->Count() << ": " << minDistances.t();
       if (secondClosestDist < node->Stat().SecondClosestBound() - 1e-15)
       {
         Log::Warn << "r" << node->Begin() << "c" << node->Count() << ":\n";
@@ -404,18 +407,18 @@ node->Stat().SecondClosestBound() << " is too loose! -- " << secondClosestDist
             << "! (" << node->Stat().SecondClosestBound() - secondClosestDist
 << ")\n";
       }
-    }
+    }*/
 
 
     if (node->Stat().MaxQueryNodeDistance() < node->Stat().SecondClosestBound()
         - clusterDistances[clusters])
     {
       node->Stat().HamerlyPruned() = true;
-//      if (node->Begin() == 16954)
       if (!node->Parent()->Stat().HamerlyPruned())
       {
-//        Log::Warn << "Mark r" << node->Begin() << "c" << node->Count() << " as "
-//            << "Hamerly pruned.\n";
+        if (node->Begin() == 37408)
+          Log::Warn << "Mark r" << node->Begin() << "c" << node->Count() << " as "
+            << "Hamerly pruned.\n";
         hamerlyPruned += node->NumDescendants();
       }
     }
diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
index f1f2c53..7e1b09a 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
@@ -113,9 +113,9 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
 
   traversalInfo.LastReferenceNode() = &referenceNode;
 
-//  if (referenceNode.Begin() == 16954)
-//    Log::Warn << "Visit r16954c" << referenceNode.Count() << ", q" <<
-//queryNode.Begin() << "c" << queryNode.Count() << ".\n";
+  if (referenceNode.Begin() == 37408)
+    Log::Warn << "Visit r37408c" << referenceNode.Count() << ", q" <<
+queryNode.Begin() << "c" << queryNode.Count() << ".\n";
 
   // If there's no closest query node assigned, but the parent has one, take
   // that one.
@@ -123,13 +123,13 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
       referenceNode.Parent() != NULL &&
       referenceNode.Parent()->Stat().ClosestQueryNode() != NULL)
   {
-//    if (referenceNode.Begin() == 16954)
-//      Log::Warn << "Update closest query node for r16954c" <<
-//referenceNode.Count() << " to parent's, which is "
-//          << ((TreeType*)
-//referenceNode.Parent()->Stat().ClosestQueryNode())->Begin() << "c" <<
-//((TreeType*) referenceNode.Parent()->Stat().ClosestQueryNode())->Count() <<
-//".\n";
+    if (referenceNode.Begin() == 37408)
+      Log::Warn << "Update closest query node for r37408c" <<
+referenceNode.Count() << " to parent's, which is "
+          << ((TreeType*)
+referenceNode.Parent()->Stat().ClosestQueryNode())->Begin() << "c" <<
+((TreeType*) referenceNode.Parent()->Stat().ClosestQueryNode())->Count() <<
+".\n";
 
     referenceNode.Stat().ClosestQueryNode() =
         referenceNode.Parent()->Stat().ClosestQueryNode();
@@ -139,8 +139,8 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
 //    referenceNode.Stat().SecondClosestBound() = std::min(
 //        referenceNode.Parent()->Stat().SecondClosestBound(),
 //        referenceNode.Stat().SecondClosestBound());
-//    if (referenceNode.Begin() == 16954)
-//      Log::Warn << "Update second closest bound for r16954c" <<
+//    if (referenceNode.Begin() == 37408)
+//      Log::Warn << "Update second closest bound for r37408c" <<
 //referenceNode.Count() << " to parent's, which "
 //          << "is " << referenceNode.Stat().SecondClosestBound() << ".\n";
   }
@@ -148,9 +148,9 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
   double score = HamerlyTypeScore(referenceNode);
   if (score == DBL_MAX)
   {
-//    if (referenceNode.Begin() == 16954)
-//      Log::Warn << "Hamerly prune for r16954c" << referenceNode.Count() << ", q" << queryNode.Begin() << "c" <<
-//queryNode.Count() << ".\n";
+    if (referenceNode.Begin() == 37408)
+      Log::Warn << "Hamerly prune for r37408c" << referenceNode.Count() << ", q" << queryNode.Begin() << "c" <<
+queryNode.Count() << ".\n";
     if (origPruned == size_t(-1))
     {
       const size_t cluster = referenceNode.Stat().Owner();
@@ -175,11 +175,11 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
       const double minDistance = referenceNode.MinDistance(&queryNode);
       ++distanceCalculations;
       score = PellegMooreScore(queryNode, referenceNode, minDistance);
-//      if (referenceNode.Begin() == 16954)
-//        Log::Warn << "mQND for r16954c" << referenceNode.Count() << " is "
-//            << referenceNode.Stat().MinQueryNodeDistance() << "; minDistance "
-//            << minDistance << ", scb " <<
-//referenceNode.Stat().SecondClosestBound() << ".\n";
+      if (referenceNode.Begin() == 37408)
+        Log::Warn << "mQND for r37408c" << referenceNode.Count() << " is "
+            << referenceNode.Stat().MinQueryNodeDistance() << "; minDistance "
+            << minDistance << ", scb " <<
+referenceNode.Stat().SecondClosestBound() << ".\n";
 
       if (minDistance < referenceNode.Stat().MinQueryNodeDistance())
       {
@@ -188,16 +188,17 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
             referenceNode.Stat().ClosestQueryNode()), queryNode) &&
             referenceNode.Stat().MinQueryNodeDistance() != DBL_MAX &&
             referenceNode.Stat().MinQueryNodeDistance() <
-            referenceNode.Stat().SecondClosestBound())
+            referenceNode.Stat().SecondClosestBound() &&
+            &queryNode != referenceNode.Stat().ClosestQueryNode())
         {
           referenceNode.Stat().SecondClosestBound() =
               referenceNode.Stat().MinQueryNodeDistance();
           referenceNode.Stat().SecondClosestQueryNode() =
               referenceNode.Stat().ClosestQueryNode();
-//          if (referenceNode.Begin() == 16954)
-//            Log::Warn << "scb for r16954c" << referenceNode.Count() << " taken "
-//                << "from minDistance, which is " <<
-//referenceNode.Stat().MinQueryNodeDistance() << ".\n";
+          if (referenceNode.Begin() == 37408)
+            Log::Warn << "scb for r37408c" << referenceNode.Count() << " taken "
+                << "from minDistance, which is " <<
+referenceNode.Stat().MinQueryNodeDistance() << ".\n";
         }
 
         if (referenceNode.Stat().MinQueryNodeDistance() == DBL_MAX &&
@@ -206,10 +207,10 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
         {
           referenceNode.Stat().SecondClosestBound() = minDistance;
           referenceNode.Stat().SecondClosestQueryNode() = &queryNode;
-//          if (referenceNode.Begin() == 16954)
-//            Log::Warn << "scb for r16954c" << referenceNode.Count() << " taken "
-//                << "from minDistance for pruned query node, which is " <<
-//minDistance << ".\n";
+          if (referenceNode.Begin() == 37408)
+            Log::Warn << "scb for r37408c" << referenceNode.Count() << " taken "
+                << "from minDistance for pruned query node, which is " <<
+minDistance << ".\n";
         }
 
         if (score != DBL_MAX)
@@ -219,40 +220,56 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
           referenceNode.Stat().MinQueryNodeDistance() = minDistance;
           referenceNode.Stat().MaxQueryNodeDistance() = maxDistance;
 
-//          if (referenceNode.Begin() == 16954)
-//            Log::Warn << "mQND for r16954c" << referenceNode.Count() << " updated to " << minDistance << " and "
-//              << "MQND to " << maxDistance << " with furthest query node " <<
-//              queryNode.Begin() << "c" << queryNode.Count() << ".\n";
+          if (referenceNode.Begin() == 37408)
+            Log::Warn << "mQND for r37408c" << referenceNode.Count() << " updated to " << minDistance << " and "
+              << "MQND to " << maxDistance << " with furthest query node " <<
+              queryNode.Begin() << "c" << queryNode.Count() << ".\n";
         }
       }
       else if (IsDescendantOf(*((TreeType*)
           referenceNode.Stat().ClosestQueryNode()), queryNode))
       {
-//        if (referenceNode.Begin() == 16954)
-//          Log::Warn << "Old closest for r16954c" << referenceNode.Count() <<
-//              " is q" << ((TreeType*)
-//referenceNode.Stat().ClosestQueryNode())->Begin() << "c" << ((TreeType*)
-//referenceNode.Stat().ClosestQueryNode())->Count() << " with mQND " <<
-//referenceNode.Stat().MinQueryNodeDistance() << " and MQND " <<
-//referenceNode.Stat().MaxQueryNodeDistance() << ".\n";
+        if (referenceNode.Begin() == 37408)
+          Log::Warn << "Old closest for r37408c" << referenceNode.Count() <<
+              " is q" << ((TreeType*)
+referenceNode.Stat().ClosestQueryNode())->Begin() << "c" << ((TreeType*)
+referenceNode.Stat().ClosestQueryNode())->Count() << " with mQND " <<
+referenceNode.Stat().MinQueryNodeDistance() << " and MQND " <<
+referenceNode.Stat().MaxQueryNodeDistance() << ".\n";
         const double maxDistance = referenceNode.MaxDistance(&queryNode);
         ++distanceCalculations;
         referenceNode.Stat().ClosestQueryNode() = (void*) &queryNode;
         referenceNode.Stat().MinQueryNodeDistance() = minDistance;
         referenceNode.Stat().MaxQueryNodeDistance() = maxDistance;
 
-//        if (referenceNode.Begin() == 16954)
-//          Log::Warn << "mQND for r16954c" << referenceNode.Count() << " updated to " << minDistance << " and "
-//              << "MQND to " << maxDistance << " via descendant with fqn " <<
-//              queryNode.Begin() << "c" << queryNode.Count() << ".\n";
+        if (referenceNode.Begin() == 37408)
+          Log::Warn << "mQND for r37408c" << referenceNode.Count() << " updated to " << minDistance << " and "
+              << "MQND to " << maxDistance << " via descendant with fqn " <<
+              queryNode.Begin() << "c" << queryNode.Count() << ".\n";
       }
       else if (minDistance < referenceNode.Stat().SecondClosestBound())
       {
         referenceNode.Stat().SecondClosestBound() = minDistance;
         referenceNode.Stat().SecondClosestQueryNode() = &queryNode;
-//        if (referenceNode.Begin() == 16954)
-//          Log::Warn << "scb for r16954c" << referenceNode.Count() << " updated to " << minDistance << " via "
-//              << queryNode.Begin() << "c" << queryNode.Count() << ".\n";
+        if (referenceNode.Begin() == 37408)
+          Log::Warn << "scb for r37408c" << referenceNode.Count() << " updated to " << minDistance << " via "
+              << queryNode.Begin() << "c" << queryNode.Count() << ".\n";
+      }
+    }
+    else
+    {
+      // There was an Elkan prune, but we still need to check the second closest
+      // bound.
+      const double minDistance = referenceNode.MinDistance(&queryNode);
+      ++distanceCalculations;
+      if (minDistance < referenceNode.Stat().SecondClosestBound())
+      {
+        if (referenceNode.Begin() == 37408)
+          Log::Warn << "After Elkan prune, update scb to " << minDistance <<
+".\n";
+
+        referenceNode.Stat().SecondClosestBound() = minDistance;
+        referenceNode.Stat().SecondClosestQueryNode() = (void*) &queryNode;
       }
     }
   }
@@ -268,11 +285,11 @@ double DualTreeKMeansRules<MetricType, TreeType>::Score(
   if (score == DBL_MAX)
   {
     referenceNode.Stat().ClustersPruned() += queryNode.NumDescendants();
-//    if (referenceNode.Begin() == 16954)
-//      Log::Warn << "For r16954c" << referenceNode.Count() << ", q" <<
-//queryNode.Begin() << "c" << queryNode.Count() << " is pruned.  Min distance is"
-//    << " " << queryNode.MinDistance(&referenceNode) << " and scb is " <<
-//referenceNode.Stat().SecondClosestBound() << ".\n";
+    if (referenceNode.Begin() == 37408)
+      Log::Warn << "For r37408c" << referenceNode.Count() << ", q" <<
+queryNode.Begin() << "c" << queryNode.Count() << " is pruned.  Min distance is"
+    << " " << queryNode.MinDistance(&referenceNode) << " and scb is " <<
+referenceNode.Stat().SecondClosestBound() << ".\n";
 
     // Have we pruned everything?
     if (referenceNode.Stat().ClustersPruned() +
@@ -327,7 +344,7 @@ double DualTreeKMeansRules<MetricType, TreeType>::HamerlyTypeScore(
 {
   if (referenceNode.Stat().HamerlyPruned())
   {
-//    if (referenceNode.Begin() == 16954)
+//    if (referenceNode.Begin() == 37408)
 //      Log::Warn << "Hamerly prune! r" << referenceNode.Begin() << "c" <<
 //referenceNode.Count() << ".\n";
     return DBL_MAX;
@@ -375,9 +392,9 @@ double DualTreeKMeansRules<MetricType, TreeType>::ElkanTypeScore(
           queryNode)) &&
       (&queryNode != (TreeType*) referenceNode.Stat().ClosestQueryNode()))
   {
-//    if (referenceNode.Begin() == 16954)
-//      Log::Warn << "Elkan prune r16954c" << referenceNode.Count() << ", q" <<
-//queryNode.Begin() << "c" << queryNode.Count() << "!\n";
+    if (referenceNode.Begin() == 37408)
+      Log::Warn << "Elkan prune r37408c" << referenceNode.Count() << ", q" <<
+queryNode.Begin() << "c" << queryNode.Count() << "!\n";
     // Then we can conclude d_max(best(N_r), N_r) <= d_min(N_q, N_r) which
     // means that N_q cannot possibly hold any clusters that own any points in
     // N_r.
@@ -396,14 +413,14 @@ double DualTreeKMeansRules<MetricType, TreeType>::PellegMooreScore(
   // If the minimum distance to the node is greater than the bound, then every
   // cluster in the query node cannot possibly be the nearest neighbor of any of
   // the points in the reference node.
-//  if (referenceNode.Begin() == 16954)
-//      Log::Warn << "Pelleg-Moore prune attempt r16954c" << referenceNode.Count() << ", "
+//  if (referenceNode.Begin() == 37408)
+//      Log::Warn << "Pelleg-Moore prune attempt r37408c" << referenceNode.Count() << ", "
 //          << "q" << queryNode.Begin() << "c" << queryNode.Count() << "; "
 //          << "minDistance " << minDistance << ", MQND " <<
 //referenceNode.Stat().MaxQueryNodeDistance() << ".\n";
   if (minDistance > referenceNode.Stat().MaxQueryNodeDistance())
   {
-//    if (referenceNode.Begin() == 16954)
+//    if (referenceNode.Begin() == 37408)
 //      Log::Warn << "Attempt successful!\n";
     return DBL_MAX;
   }



More information about the mlpack-git mailing list