[mlpack-git] master: Handle cover trees. They don't have two leaves. This still won't work *quite* right for coalescing/decoalescing though. (06b279c)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:04:41 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44
>---------------------------------------------------------------
commit 06b279cacec362d8295294dc7cb4846eab263ebc
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Feb 16 15:34:21 2015 -0500
Handle cover trees. They don't have two leaves. This still won't work *quite* right for coalescing/decoalescing though.
>---------------------------------------------------------------
06b279cacec362d8295294dc7cb4846eab263ebc
src/mlpack/methods/kmeans/dtnn_statistic.hpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/methods/kmeans/dtnn_statistic.hpp b/src/mlpack/methods/kmeans/dtnn_statistic.hpp
index b8c04e6..dfeedbb 100644
--- a/src/mlpack/methods/kmeans/dtnn_statistic.hpp
+++ b/src/mlpack/methods/kmeans/dtnn_statistic.hpp
@@ -37,8 +37,6 @@ class DTNNStatistic : public
lowerBound(DBL_MAX),
owner(size_t(-1)),
pruned(size_t(-1)),
- trueLeft((void*) &node.Child(0)),
- trueRight((void*) &node.Child(1)),
trueParent((void*) node.Parent())
{
// Empirically calculate the centroid.
@@ -51,6 +49,18 @@ class DTNNStatistic : public
node.Child(i).Stat().Centroid();
centroid /= node.NumDescendants();
+
+ // Do we have children?
+ if (node.NumChildren() >= 2)
+ {
+ trueLeft = &node.Child(0);
+ trueRight = &node.Child(1);
+ }
+ else
+ {
+ trueLeft = NULL;
+ trueRight = NULL;
+ }
}
double UpperBound() const { return upperBound; }
More information about the mlpack-git
mailing list