[mlpack-svn] r16877 - mlpack/trunk/src/mlpack/core/tree/rectangle_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Jul 28 08:55:22 EDT 2014
Author: andrewmw94
Date: Mon Jul 28 08:55:21 2014
New Revision: 16877
Log:
code cleanup for R tree
Modified:
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/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 Mon Jul 28 08:55:21 2014
@@ -425,11 +425,6 @@
//! 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 @@
*/
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
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 Mon Jul 28 08:55:21 2014
@@ -48,7 +48,6 @@
// 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 @@
for (int i = 0; i < numChildren; i++) {
delete children[i];
}
- //if(numChildren == 0)
delete localDataset;
}
@@ -108,8 +106,6 @@
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 @@
}
/**
- * Set the dataset to null.
+ * Set the local dataset to null.
*/
template<typename SplitType,
typename DescentType,
@@ -326,8 +322,6 @@
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 @@
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 @@
}
/**
- * 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 @@
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();
More information about the mlpack-svn
mailing list