[mlpack-git] master, mlpack-1.0.x: TraversalInfo class used by nearest-neighbor-like problems. Maybe it could be the same as the one in src/mlpack/core/tree/. (e80bd00)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:42:15 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit e80bd00bc98febf3b7537734beff19e678eb330d
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu Feb 6 20:10:58 2014 +0000
TraversalInfo class used by nearest-neighbor-like problems. Maybe it could be
the same as the one in src/mlpack/core/tree/.
>---------------------------------------------------------------
e80bd00bc98febf3b7537734beff19e678eb330d
.../methods/neighbor_search/ns_traversal_info.hpp | 70 ++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/src/mlpack/methods/neighbor_search/ns_traversal_info.hpp b/src/mlpack/methods/neighbor_search/ns_traversal_info.hpp
new file mode 100644
index 0000000..4a2f14a
--- /dev/null
+++ b/src/mlpack/methods/neighbor_search/ns_traversal_info.hpp
@@ -0,0 +1,70 @@
+/**
+ * @file ns_traversal_info.hpp
+ * @author Ryan Curtin
+ *
+ * This class holds traversal information for dual-tree traversals that are
+ * using the NeighborSearchRules RuleType.
+ */
+#ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_TRAVERSAL_INFO_HPP
+#define __MLPACK_METHODS_NEIGHBOR_SEARCH_TRAVERSAL_INFO_HPP
+
+namespace mlpack {
+namespace neighbor {
+
+/**
+ * Traversal information for NeighborSearch. This information is used to make
+ * parent-child prunes or parent-parent prunes in Score() without needing to
+ * evaluate the distance between two nodes.
+ *
+ * The information held by this class is the last node combination visited
+ * before the current node combination was recursed into and the distance
+ * between the node centroids.
+ */
+template<typename TreeType>
+class NeighborSearchTraversalInfo
+{
+ public:
+ /**
+ * Create the TraversalInfo object and initialize the pointers to NULL.
+ */
+ NeighborSearchTraversalInfo() :
+ lastQueryNode(NULL),
+ lastReferenceNode(NULL),
+ lastScore(0.0),
+ lastBaseCase(0.0) { /* Nothing to do. */ }
+
+ //! Get the last query node.
+ TreeType* LastQueryNode() const { return lastQueryNode; }
+ //! Modify the last query node.
+ TreeType*& LastQueryNode() { return lastQueryNode; }
+
+ //! Get the last reference node.
+ TreeType* LastReferenceNode() const { return lastReferenceNode; }
+ //! Modify the last reference node.
+ TreeType*& LastReferenceNode() { return lastReferenceNode; }
+
+ //! Get the score associated with the last query and reference nodes.
+ double LastScore() const { return lastScore; }
+ //! Modify the score associated with the last query and reference nodes.
+ double& LastScore() { return lastScore; }
+
+ //! Get the base case associated with the last node combination.
+ double LastBaseCase() const { return lastBaseCase; }
+ //! Modify the base case associated with the last node combination.
+ double& LastBaseCase() { return lastBaseCase; }
+
+ private:
+ //! The last query node.
+ TreeType* lastQueryNode;
+ //! The last reference node.
+ TreeType* lastReferenceNode;
+ //! The last distance.
+ double lastScore;
+ //! The last base case.
+ double lastBaseCase;
+};
+
+}; // namespace neighbor
+}; // namespace mlpack
+
+#endif
More information about the mlpack-git
mailing list