[mlpack-svn] r16630 - in mlpack/trunk/src/mlpack/core/tree: . rectangle_tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jun 4 13:47:08 EDT 2014


Author: andrewmw94
Date: Wed Jun  4 13:47:08 2014
New Revision: 16630

Log:
a few miscellanious small changes.  Added to CMake.

Modified:
   mlpack/trunk/src/mlpack/core/tree/CMakeLists.txt
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp

Modified: mlpack/trunk/src/mlpack/core/tree/CMakeLists.txt
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/CMakeLists.txt	(original)
+++ mlpack/trunk/src/mlpack/core/tree/CMakeLists.txt	Wed Jun  4 13:47:08 2014
@@ -31,6 +31,13 @@
   mrkd_statistic.hpp
   mrkd_statistic_impl.hpp
   mrkd_statistic.cpp
+  rectangle_tree.hpp
+  rectangle_tree/rectangle_tree.hpp
+  rectangle_tree/rectangle_tree_impl.hpp
+  rectangle_tree/r_tree_split.hpp
+  rectangle_tree/r_tree_split_impl.hpp
+  rectangle_tree/r_tree_descent_heuristic.hpp
+  rectangle_tree/r_tree_descent_heuristic_impl.hpp
   statistic.hpp
   traversal_info.hpp
   tree_traits.hpp

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp	Wed Jun  4 13:47:08 2014
@@ -40,8 +40,8 @@
   //! The minimum number of child nodes a non-leaf node can have.
   size_t minNumChildren;
   //! The number of child nodes actually in use (0 if this is a leaf node).
-  size_t numOfChildren;
-  //! The child nodes (Starting at 0 and ending at (numOfChildren-1) ).
+  size_t numChildren;
+  //! The child nodes (Starting at 0 and ending at (numChildren-1) ).
   std::vector<RectangleTree*> children;
   //! The parent node (NULL if this is the root of the tree).
   RectangleTree* parent;
@@ -150,11 +150,26 @@
   //! Return whether or not this node is a leaf (true if it has no children).
   bool IsLeaf() const;
 
-  //! Return the max leaf size.
+  //! Return the maximum leaf size.
   size_t MaxLeafSize() const { return maxLeafSize; }
-  //! Modify the max leaf size.
+  //! Modify the maximum leaf size.
   size_t& MaxLeafSize() { return maxLeafSize; }
 
+  //! Return the minimum leaf size.
+  size_t MinLeafSize() const { return minLeafSize; }
+  //! Modify the minimum leaf size.
+  size_t& MinLeafSize() { return minLeafSize; }
+
+  //! Return the maximum number of children (in a non-leaf node).
+  size_t MaxNumChildren() const { return maxNumChildren; }
+  //! Modify the maximum number of children (in a non-leaf node).
+  size_t& MaxNumChildren() { return maxNumChildren; }
+
+  //! Return the minimum number of children (in a non-leaf node).
+  size_t MinNumChildren() const { return minNumChildren; }
+  //! Modify the minimum number of children (in a non-leaf node).
+  size_t& MinNumChildren() { return minNumChildren; }
+
   //! Gets the parent of this node.
   RectangleTree* Parent() const { return parent; }
   //! Modify the parent of this node.
@@ -171,15 +186,10 @@
   //! Get the centroid of the node and store it in the given vector.
   void Centroid(arma::vec& centroid) { bound.Centroid(centroid); }
 
-  // TODO.  Think of a better name that makes the difference here obvious.
-
-  //! Return the number of children in this node.
-  size_t NumChildren() const;
-
   //! Return the number of child nodes.  (One level beneath this one only.)
-  size_t getNumOfChildren() const { return numOfChildren; }
+  size_t NumChildren() const { return numChildren; }
   //! Modify the number of child nodes.  Be careful.
-  size_t& getNumOfChildren() { return numOfChildren; }
+  size_t& NumChildren() { return numChildren; }
 
   //! Get the children of this node.
   const std::vector<RectangleTree*>& Children() const { return children; }
@@ -215,7 +225,7 @@
    */
   RectangleTree& Child(const size_t child) const;
 
-  //! Return the number of points in this node (0 if not a leaf).
+  //! Return the number of points in this node (returns 0 if this node is not a leaf).
   size_t NumPoints() const;
 
   /**

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp	Wed Jun  4 13:47:08 2014
@@ -42,12 +42,14 @@
   this.parentDistance = 0.0;
   this.furthestDescendantDistance = 0.0;
   this.dataset = new MatType(maxLeafSize+1); // Add one to make splitting the node simpler
-
+  this.children = new std::vector<RectangleTree*>(maxNumChildren+1); // ibid.
+  
   // For now, just insert the points in order.
   // This won't actually work for any meaningful size of data since the root changes.
   for(int i = 0; i < n_cols; i++) {
     insertPoint(data.col(i));
   }
+  
 }
 
 /**



More information about the mlpack-svn mailing list