[mlpack-git] master: Optimization: don't needlessly tighten point bounds. (a5b9c34)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu May 28 15:31:51 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/5249c0fc83ac3b0915bd22ae1f1823b742a82c33...803224f64f6b6490c3cb8aafd528b1db069ef2f1
>---------------------------------------------------------------
commit a5b9c34ea77c788e1b313065f1ac1226cacbd4fb
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu May 28 15:21:29 2015 -0400
Optimization: don't needlessly tighten point bounds.
>---------------------------------------------------------------
a5b9c34ea77c788e1b313065f1ac1226cacbd4fb
src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
index c584843..135dece 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_impl.hpp
@@ -287,7 +287,6 @@ visited[node.Descendant(i)] << ".\n";
}
*/
-
if ((node.Stat().Pruned() == centroids.n_cols) &&
(node.Stat().Owner() < centroids.n_cols))
{
@@ -334,7 +333,17 @@ visited[node.Descendant(i)] << ".\n";
}
bool allPointsPruned = true;
- if (!node.Stat().StaticPruned())
+ if (tree::TreeTraits<TreeType>::HasSelfChildren && node.NumChildren() > 0)
+ {
+ // If this tree type has self-children, then we have already adjusted the
+ // point bounds at a lower level, and we can determine if all of our points
+ // are pruned simply by seeing if all of the children's points are pruned.
+ // This particular line below additionally assumes that each node's points
+ // are all contained in its first child. This is valid for the cover tree,
+ // but maybe not others.
+ allPointsPruned = node.Child(0).Stat().StaticPruned();
+ }
+ else if (!node.Stat().StaticPruned())
{
// Try to prune individual points.
for (size_t i = 0; i < node.NumPoints(); ++i)
More information about the mlpack-git
mailing list