[mlpack-git] master: When coalescing implicit nodes, be sure to rebuild the statistic. This was causing a problem in k-means. (7872202)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu May 28 15:31:49 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/5249c0fc83ac3b0915bd22ae1f1823b742a82c33...803224f64f6b6490c3cb8aafd528b1db069ef2f1
>---------------------------------------------------------------
commit 787220215e1c6a1781973029e386728556c62f41
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu May 28 15:20:41 2015 -0400
When coalescing implicit nodes, be sure to rebuild the statistic.
This was causing a problem in k-means.
>---------------------------------------------------------------
787220215e1c6a1781973029e386728556c62f41
src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp b/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
index 792d98b..4d8247f 100644
--- a/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
+++ b/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
@@ -78,8 +78,9 @@ CoverTree<MetricType, RootPointPolicy, StatisticType, MatType>::CoverTree(
{
children.push_back(&(old->Child(i)));
- // Set its parent correctly.
+ // Set its parent correctly, and rebuild the statistic.
old->Child(i).Parent() = this;
+ old->Child(i).Stat() = StatisticType(old->Child(i));
}
// Remove all the children so they don't get erased.
@@ -162,6 +163,8 @@ CoverTree<MetricType, RootPointPolicy, StatisticType, MatType>::CoverTree(
// Set its parent correctly.
old->Child(i).Parent() = this;
+ // Rebuild the statistic.
+ old->Child(i).Stat() = StatisticType(old->Child(i));
}
// Remove all the children so they don't get erased.
@@ -1094,10 +1097,11 @@ inline void CoverTree<MetricType, RootPointPolicy, StatisticType, MatType>::
// Now take its child.
children.push_back(&(old->Child(0)));
- // Set its parent correctly.
+ // Set its parent and parameters correctly, and rebuild the statistic.
old->Child(0).Parent() = this;
old->Child(0).ParentDistance() = old->ParentDistance();
old->Child(0).DistanceComps() = old->DistanceComps();
+ old->Child(0).Stat() = StatisticType(old->Child(0));
// Remove its child (so it doesn't delete it).
old->Children().erase(old->Children().begin() + old->Children().size() - 1);
More information about the mlpack-git
mailing list