[mlpack-svn] r11590 - mlpack/trunk/src/mlpack/core/tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Feb 22 18:26:51 EST 2012
Author: jcline3
Date: 2012-02-22 18:26:50 -0500 (Wed, 22 Feb 2012)
New Revision: 11590
Modified:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp
Log:
Add a splitDimension variable and getter for determining which dimension a node is split on.
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp 2012-02-22 22:46:23 UTC (rev 11589)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp 2012-02-22 23:26:50 UTC (rev 11590)
@@ -61,6 +61,8 @@
StatisticType stat;
//! The leaf size.
size_t leafSize;
+ //! The dimension this node split on if it is a parent.
+ size_t splitDimension;
public:
//! So other classes can use TreeType::Mat.
@@ -243,6 +245,11 @@
*/
BinarySpaceTree* Right() const;
+ /**
+ * Returns the dimension this parent's children are split on.
+ */
+ size_t GetSplitDimension() const;
+
/**
* Obtains the number of nodes in the tree, starting with this.
*/
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp 2012-02-22 22:46:23 UTC (rev 11589)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree_impl.hpp 2012-02-22 23:26:50 UTC (rev 11590)
@@ -353,6 +353,12 @@
}
template<typename BoundType, typename StatisticType, typename MatType>
+inline size_t BinarySpaceTree<BoundType, StatisticType, MatType>::GetSplitDimension() const
+{
+ return splitDimension;
+}
+
+template<typename BoundType, typename StatisticType, typename MatType>
inline bool BinarySpaceTree<BoundType, StatisticType, MatType>::IsLeaf() const
{
return !left;
@@ -431,6 +437,7 @@
splitDim = d;
}
}
+ splitDimension = splitDim;
// Split in the middle of that dimension.
double splitVal = bound[splitDim].Mid();
@@ -480,6 +487,7 @@
splitDim = d;
}
}
+ splitDimension = splitDim;
// Split in the middle of that dimension.
double splitVal = bound[splitDim].Mid();
More information about the mlpack-svn
mailing list