[mlpack] 28/37: Backport fixes for NeighborSearch from trunk.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Mon Feb 15 19:35:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to tag mlpack-1.0.10
in repository mlpack.
commit f608325a369314b33b35fb050be26af41e166e18
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Aug 26 16:21:20 2014 +0000
Backport fixes for NeighborSearch from trunk.
---
.../methods/neighbor_search/neighbor_search_rules_impl.hpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 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..20172d3 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,20 @@ 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() +
- 2 * (queryNode.FurthestDescendantDistance() -
- queryNode.Child(i).FurthestDescendantDistance());
+ const double adjustment = std::max(0.0,
+ queryNode.FurthestDescendantDistance() -
+ queryNode.Child(i).FurthestDescendantDistance());
+ const double adjustedSecondBound = SortPolicy::CombineWorst(
+ queryNode.Child(i).Stat().SecondBound(), 2 * adjustment);
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