[mlpack] 52/58: Correctly handle SortPolicy abstraction.
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Tue Sep 9 13:19:43 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit 82166a7ec52d17d2312c6c5a50bce8adb6525f40
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Tue Aug 26 03:40:02 2014 +0000
Correctly handle SortPolicy abstraction.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17118 9d5b8971-822b-0410-80eb-d18c1038ef23
---
.../methods/neighbor_search/neighbor_search_rules_impl.hpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
index bdafbb1..9a009d9 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
@@ -355,17 +355,19 @@ inline double NeighborSearchRules<SortPolicy, MetricType, TreeType>::
// Add triangle inequality adjustment to best distance. It is possible this
// could be tighter for some certain types of trees.
- bestDistance += queryNode.FurthestPointDistance() +
- queryNode.FurthestDescendantDistance();
+ bestDistance = SortPolicy::CombineWorst(bestDistance,
+ queryNode.FurthestPointDistance() +
+ queryNode.FurthestDescendantDistance());
// Loop over children of the node, and use their cached information to
// assemble bounds.
for (size_t i = 0; i < queryNode.NumChildren(); ++i)
{
const double firstBound = queryNode.Child(i).Stat().FirstBound();
- const double adjustedSecondBound = queryNode.Child(i).Stat().SecondBound() +
+ const double adjustedSecondBound = SortPolicy::CombineWorst(
+ queryNode.Child(i).Stat().SecondBound(),
2 * (queryNode.FurthestDescendantDistance() -
- queryNode.Child(i).FurthestDescendantDistance());
+ queryNode.Child(i).FurthestDescendantDistance()));
if (SortPolicy::IsBetter(worstDistance, firstBound))
worstDistance = firstBound;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list