From 0968f5374f67bcf23dcf33bdd703504e0300a265 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Mon, 2 Feb 2015 21:43:28 -0500 Subject: [PATCH] Mark parent as pruned if its children are pruned. --- src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp b/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp index 9e26e40354..e6747e5f98 100644 --- a/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp +++ b/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp @@ -369,12 +369,13 @@ oldFromNewCentroids[assignments(0, node.Point(i - 1))] << ".\n"; { // The node isn't owned by a single cluster. But if it has no points and // its children are all pruned, we may prune it too. -// if (childrenPruned && node.NumChildren() > 0) -// { + if (childrenPruned && node.NumChildren() > 0) + { // Log::Warn << "Prune parent node " << node.Point(0) << "c" << //node.NumDescendants() << ".\n"; -// node.Stat().Pruned() = true; -// } + node.Stat().Pruned() = true; + node.Stat().Owner() = centroids.n_cols; + } // if (node.NumChildren() > 0) // if (node.Child(0).Stat().Pruned() && !node.Child(1).Stat().Pruned()) // Log::Warn << "Node left child pruned but right child not:\n" <<