[mlpack-git] master: Try to do an Elkan prune not at a query leaf. It doesn't seem to work right now, though. (8a76218)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:02:45 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44
>---------------------------------------------------------------
commit 8a762187890f4a1761aa44583330ac49298d3623
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Jan 13 17:17:43 2015 -0500
Try to do an Elkan prune not at a query leaf. It doesn't seem to work right now, though.
>---------------------------------------------------------------
8a762187890f4a1761aa44583330ac49298d3623
.../methods/kmeans/dual_tree_kmeans_rules_impl.hpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
index f3e006c..2aa8f58 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
@@ -212,15 +212,23 @@ double DualTreeKMeansRules<MetricType, TreeType>::ElkanTypeScore(
{
// We have to calculate the minimum distance between the query node and the
// reference node's best query node. First, try to use the cached distance.
-// const double minQueryDistance = queryNode.Stat().FirstBound();
- if (queryNode.NumDescendants() == 1)
+ if (queryNode.NumDescendants() > 1)
{
+ const double minQueryDistance = queryNode.Stat().FirstBound();
+ if (minQueryDistance == DBL_MAX)
+ return 0.0;
+ else
+ Log::Warn << "Not DBL_MAX!\n";
const double score = ElkanTypeScore(queryNode, referenceNode,
- interclusterDistances[queryNode.Descendant(0)]);
+ minQueryDistance);
return score;
}
else
- return 0.0;
+ {
+ const double score = ElkanTypeScore(queryNode, referenceNode,
+ interclusterDistances[queryNode.Descendant(0)]);
+ return score;
+ }
}
template<typename MetricType, typename TreeType>
More information about the mlpack-git
mailing list