[mlpack] 230/324: code cleanup for R tree

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:13 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 f2fe64e56a5426f2b4978292636ea1793ac4bbce
Author: andrewmw94 <andrewmw94 at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Mon Jul 28 12:55:21 2014 +0000

    code cleanup for R tree
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16877 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 .../core/tree/rectangle_tree/rectangle_tree.hpp    | 14 ----------
 .../tree/rectangle_tree/rectangle_tree_impl.hpp    | 31 +++-------------------
 2 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
index 536a199..32c888c 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
@@ -425,11 +425,6 @@ class RectangleTree
   //! Modify the index of the beginning point of this subset.
   size_t& Begin() { return begin; }
 
-  /**
-   * Gets the index one beyond the last index in the subset.  CURRENTLY MEANINGLESS!
-   */
-  size_t End() const;
-
   //! Return the number of points in this subset.
   size_t Count() const { return count; }
   //! Modify the number of points in this subset.
@@ -466,15 +461,6 @@ class RectangleTree
    */
   void SplitNode(std::vector<bool>& relevels);
 
-  /**
-   * Splits the current node, recursing up the tree.
-   * CURRENTLY IT DOES NOT Also returns a list of the changed indices (because there are none).
-   *
-   * @param data Dataset which we are using.
-   * @param oldFromNew Vector holding permuted indices NOT IMPLEMENTED.
-   */
-  void SplitNode(std::vector<size_t>& oldFromNew);
-
  public:
   /**
    * Condense the bounding rectangles for this node based on the removal of
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
index d40d675..392458b 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
@@ -48,7 +48,6 @@ localDataset(new MatType(data.n_rows, static_cast<int> (maxLeafSize) + 1)) // Ad
   // For now, just insert the points in order.
   RectangleTree* root = this;
 
-  //for(int i = firstDataIndex; i < 57; i++) { // 56,57 are the bound for where it works/breaks
   for (size_t i = firstDataIndex; i < data.n_cols; i++) {
     root->InsertPoint(i);
   }
@@ -93,7 +92,6 @@ RectangleTree<SplitType, DescentType, StatisticType, MatType>::
   for (int i = 0; i < numChildren; i++) {
     delete children[i];
   }
-  //if(numChildren == 0)
   delete localDataset;
 }
 
@@ -108,8 +106,6 @@ typename MatType>
 void RectangleTree<SplitType, DescentType, StatisticType, MatType>::
 SoftDelete()
 {
-  //if(numChildren != 0)
-  //dataset = NULL;
   parent = NULL;
   for (int i = 0; i < children.size(); i++) {
     children[i] = NULL;
@@ -119,7 +115,7 @@ SoftDelete()
 }
 
 /**
- * Set the dataset to null.
+ * Set the local dataset to null.
  */
 template<typename SplitType,
 typename DescentType,
@@ -326,8 +322,6 @@ typename MatType>
 size_t RectangleTree<SplitType, DescentType, StatisticType, MatType>::
 TreeDepth() const
 {
-  /* Because R trees are balanced, we could simplify this.  However, X trees are not
-     guaranteed to be balanced so I keep it as is: */
   int n = 1;
   RectangleTree<SplitType, DescentType, StatisticType, MatType>* currentNode =
           const_cast<RectangleTree*> (this);
@@ -444,27 +438,10 @@ typename MatType>
 inline size_t RectangleTree<SplitType, DescentType, StatisticType, MatType>::
 Point(const size_t index) const
 {
-  return dataset(points[index]);
+  return points[index];
 }
 
 /**
- * Return the last point in the tree.  WARNING: POINTS ARE NOT MOVED IN THE ORIGINAL DATASET,
- * SO THIS IS RATHER POINTLESS.
- */
-template<typename SplitType,
-typename DescentType,
-typename StatisticType,
-typename MatType>
-inline size_t RectangleTree<SplitType, DescentType, StatisticType, MatType>::End() const
-{
-  if (numChildren)
-    return begin + count;
-  return children[numChildren - 1]->End();
-}
-
-//have functions for returning the list of modified indices if we end up doing it that way.
-
-/**
  * Split the tree.  This calls the SplitType code to split a node.  This method should only
  * be called on a leaf node.
  */
@@ -637,7 +614,7 @@ bool RectangleTree<SplitType, DescentType, StatisticType, MatType>::ShrinkBoundF
 }
 
 /**
- * Shrink the bound so it fits tightly after the removal of this bound.
+ * Shrink the bound so it fits tightly after the removal of another bound.
  */
 template<typename SplitType,
 typename DescentType,
@@ -686,7 +663,7 @@ std::string RectangleTree<SplitType, DescentType, StatisticType, MatType>::ToStr
   convert << "  Min num of children: " << minNumChildren << std::endl;
   convert << "  Parent address: " << parent << std::endl;
 
-  // How many levels should we print?  This will print 3 levels (counting the root).
+  // How many levels should we print?  This will print the top 3 levels (counting the root).
   if (parent == NULL || parent->Parent() == NULL) {
     for (int i = 0; i < numChildren; i++) {
       convert << children[i]->ToString();

-- 
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