[mlpack-git] master: Always consider the splitting hyperplane to estimate the nearest/furthest child. (4c68f27)
gitdub at mlpack.org
gitdub at mlpack.org
Sat Aug 20 14:56:08 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/3274b05fcc545c3b36f783316fea2e22f79c3d03...1c77230c7d3b9c45fb102cd3c632d9c7248e085e
>---------------------------------------------------------------
commit 4c68f27cd1bb3875823c73b538e1a80d0c764fc3
Author: MarcosPividori <marcos.pividori at gmail.com>
Date: Fri Aug 19 15:08:24 2016 -0300
Always consider the splitting hyperplane to estimate the nearest/furthest child.
>---------------------------------------------------------------
4c68f27cd1bb3875823c73b538e1a80d0c764fc3
.../core/tree/spill_tree/spill_tree_impl.hpp | 55 +++++++---------------
1 file changed, 16 insertions(+), 39 deletions(-)
diff --git a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
index b60e84e..9edb7f9 100644
--- a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
+++ b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
@@ -330,18 +330,9 @@ SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>::
if (!right)
return *left;
- if (overlappingNode)
- {
- if (hyperplane.Left(point))
- return *left;
- return *right;
- }
- else
- {
- if (left->MinDistance(point) <= right->MinDistance(point))
- return *left;
- return *right;
- }
+ if (hyperplane.Left(point))
+ return *left;
+ return *right;
}
/**
@@ -368,9 +359,9 @@ SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>::
if (!right)
return *left;
- if (left->MaxDistance(point) > right->MaxDistance(point))
- return *left;
- return *right;
+ if (hyperplane.Left(point))
+ return *right;
+ return *left;
}
/**
@@ -394,25 +385,12 @@ SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>::
if (!right)
return left;
- if (overlappingNode)
- {
- if (hyperplane.Left(queryNode.Bound()))
- return left;
- if (hyperplane.Right(queryNode.Bound()))
- return right;
- // Can't decide.
- return NULL;
- }
- else
- {
- ElemType leftDist = left->MinDistance(&queryNode);
- ElemType rightDist = right->MinDistance(&queryNode);
- if (leftDist < rightDist)
- return left;
- if (rightDist < leftDist)
- return right;
- return NULL;
- }
+ if (hyperplane.Left(queryNode.Bound()))
+ return left;
+ if (hyperplane.Right(queryNode.Bound()))
+ return right;
+ // Can't decide.
+ return NULL;
}
/**
@@ -436,12 +414,11 @@ SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>::
if (!right)
return left;
- ElemType leftDist = left->MaxDistance(&queryNode);
- ElemType rightDist = right->MaxDistance(&queryNode);
- if (leftDist > rightDist)
- return left;
- if (rightDist > leftDist)
+ if (hyperplane.Left(queryNode.Bound()))
return right;
+ if (hyperplane.Right(queryNode.Bound()))
+ return left;
+ // Can't decide.
return NULL;
}
More information about the mlpack-git
mailing list