[mlpack-git] master: Remove unnecessary check for parent's SCB. There actually isn't a need to take the parent's second closest bound preferentially, and it was preventing some valid prunes. This gives a little more (but not enough) Hamerly pruning, and provides (as usual) trivial speedup---but more than none! (994b485)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:02:34 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44
>---------------------------------------------------------------
commit 994b4858baeb3b11e55cfe08920cde824b69081f
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Jan 26 15:51:25 2015 -0500
Remove unnecessary check for parent's SCB. There actually isn't a need to take the parent's second closest bound preferentially, and it was preventing some valid prunes. This gives a little more (but not enough) Hamerly pruning, and provides (as usual) trivial speedup---but more than none!
>---------------------------------------------------------------
994b4858baeb3b11e55cfe08920cde824b69081f
src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
index 938fc52..633151c 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
@@ -218,14 +218,13 @@ void DualTreeKMeans<MetricType, MatType, TreeType>::TreeUpdate(
// already been adjusted for cluster movement.
// Re-set second closest bound if necessary.
- if (node->Stat().SecondClosestBound() == DBL_MAX)
- {
- if (node->Begin() == 34654)
- Log::Warn << "r34654c" << node->Begin() << " scb is DBL_MAX!\n";
+ if (node->Stat().SecondClosestBound() == DBL_MAX && node->Parent() == NULL)
+ node->Stat().SecondClosestBound() = 0.0; // Don't prune the root.
- if (node->Parent() == NULL)
- node->Stat().SecondClosestBound() = 0.0; // Don't prune the root.
- }
+ if (node->Begin() == 34654)
+ Log::Warn << "r34654c" << node->Count() << " scb " <<
+node->Stat().SecondClosestBound() << " and lscb " <<
+node->Stat().LastSecondClosestBound() << ".\n";
if (node->Parent()->Stat().SecondClosestBound() != DBL_MAX &&
node->Stat().LastSecondClosestBound() != DBL_MAX)
@@ -252,7 +251,7 @@ node->Stat().LastSecondClosestBound());
// << ((TreeType*)
//node->Parent()->Stat().SecondClosestQueryNode())->Begin() << "c" << ((TreeType*)
//node->Parent()->Stat().SecondClosestQueryNode())->Count() << ").\n";
-
+/*
if (node->Parent() != NULL &&
node->Parent()->Stat().SecondClosestQueryNode() != NULL &&
node->Stat().SecondClosestQueryNode() != NULL && !IsDescendantOf(*((TreeType*)
@@ -266,7 +265,7 @@ node->Parent()->Stat().SecondClosestBound() < node->Stat().SecondClosestBound())
//<< " (was " << node->Stat().SecondClosestBound() << ").\n";
node->Stat().SecondClosestBound() =
node->Parent()->Stat().SecondClosestBound();
- }
+ }*/
if (node->Begin() == 34654)
{
More information about the mlpack-git
mailing list