[mlpack-git] master: Update lower bounds when possible. Surprisingly, no speedup anywhere? (078eef0)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:05:08 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44
>---------------------------------------------------------------
commit 078eef08d5e9391e1bc19aa103dc45c525fd4116
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu Feb 19 10:43:19 2015 -0500
Update lower bounds when possible. Surprisingly, no speedup anywhere?
>---------------------------------------------------------------
078eef08d5e9391e1bc19aa103dc45c525fd4116
src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp b/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp
index a04a930..9b70887 100644
--- a/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/dtnn_kmeans_impl.hpp
@@ -216,9 +216,11 @@ void DTNNKMeans<MetricType, MatType, TreeType>::UpdateTree(
// Adjust bounds.
node.Stat().UpperBound() += clusterDistances[node.Stat().Owner()];
node.Stat().LowerBound() -= clusterDistances[centroids.n_cols];
- const double lowerBound = std::max(node.Stat().LowerBound(),
- interclusterDistances[node.Stat().Owner()] / 2.0);
- if (node.Stat().UpperBound() < lowerBound)
+ const double interclusterBound = interclusterDistances[node.Stat().Owner()]
+ / 2.0;
+ if (interclusterBound > node.Stat().LowerBound())
+ node.Stat().LowerBound() = interclusterBound;
+ if (node.Stat().UpperBound() < node.Stat().LowerBound())
{
node.Stat().StaticPruned() = true;
}
@@ -228,7 +230,7 @@ void DTNNKMeans<MetricType, MatType, TreeType>::UpdateTree(
node.Stat().UpperBound() =
node.MaxDistance(centroids.col(node.Stat().Owner()));
++distanceCalculations;
- if (node.Stat().UpperBound() < lowerBound)
+ if (node.Stat().UpperBound() < node.Stat().LowerBound())
{
node.Stat().StaticPruned() = true;
}
@@ -267,7 +269,7 @@ void DTNNKMeans<MetricType, MatType, TreeType>::UpdateTree(
{
prunedPoints[index] = true;
upperBounds[index] += clusterDistances[owner];
- lowerBounds[index] = lowerBound;
+ lowerBounds[index] = pruningLowerBound;
}
else
{
@@ -278,7 +280,7 @@ void DTNNKMeans<MetricType, MatType, TreeType>::UpdateTree(
if (upperBounds[index] < pruningLowerBound)
{
prunedPoints[index] = true;
- lowerBounds[index] = lowerBound;
+ lowerBounds[index] = pruningLowerBound;
}
else
{
More information about the mlpack-git
mailing list