[mlpack-git] master, mlpack-1.0.x: The maxLeafSize parameter is unused (other than an assert) so remove it entirely. (4421441)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:44:52 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 4421441c0ebd94731b2fd2d9ed552916b8248636
Author: Ryan Curtin <ryan at ratml.org>
Date:   Sat Mar 1 19:37:19 2014 +0000

    The maxLeafSize parameter is unused (other than an assert) so remove it
    entirely.


>---------------------------------------------------------------

4421441c0ebd94731b2fd2d9ed552916b8248636
 src/mlpack/methods/det/dtree.cpp | 7 +------
 src/mlpack/methods/det/dtree.hpp | 1 -
 src/mlpack/tests/det_test.cpp    | 2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/mlpack/methods/det/dtree.cpp b/src/mlpack/methods/det/dtree.cpp
index 6178039..a91c513 100644
--- a/src/mlpack/methods/det/dtree.cpp
+++ b/src/mlpack/methods/det/dtree.cpp
@@ -130,7 +130,6 @@ bool DTree::FindSplit(const arma::mat& data,
                       double& splitValue,
                       double& leftError,
                       double& rightError,
-                      const size_t maxLeafSize,
                       const size_t minLeafSize) const
 {
   // Ensure the dimensionality of the data is the same as the dimensionality of
@@ -172,9 +171,6 @@ bool DTree::FindSplit(const arma::mat& data,
     // Sort the values in ascending order.
     dimVec = arma::sort(dimVec);
 
-    // Get ready to go through the sorted list and compute error.
-    assert(dimVec.n_elem > maxLeafSize);
-
     // Find the best split for this dimension.  We need to figure out why
     // there are spikes if this minLeafSize is enforced here...
     for (size_t i = minLeafSize - 1; i < dimVec.n_elem - minLeafSize; ++i)
@@ -297,8 +293,7 @@ double DTree::Grow(arma::mat& data,
     size_t dim;
     double splitValueTmp;
     double leftError, rightError;
-    if (FindSplit(data, dim, splitValueTmp, leftError, rightError, maxLeafSize,
-        minLeafSize))
+    if (FindSplit(data, dim, splitValueTmp, leftError, rightError, minLeafSize))
     {
       // Move the data around for the children to have points in a node lie
       // contiguously (to increase efficiency during the training).
diff --git a/src/mlpack/methods/det/dtree.hpp b/src/mlpack/methods/det/dtree.hpp
index f8cadac..be04c5b 100644
--- a/src/mlpack/methods/det/dtree.hpp
+++ b/src/mlpack/methods/det/dtree.hpp
@@ -295,7 +295,6 @@ class DTree
                  double& splitValue,
                  double& leftError,
                  double& rightError,
-                 const size_t maxLeafSize = 10,
                  const size_t minLeafSize = 5) const;
 
   /**
diff --git a/src/mlpack/tests/det_test.cpp b/src/mlpack/tests/det_test.cpp
index e24e959..9e4e91e 100644
--- a/src/mlpack/tests/det_test.cpp
+++ b/src/mlpack/tests/det_test.cpp
@@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(TestFindSplit)
 
   testDTree.logVolume = log(7.0) + log(4.0) + log(7.0);
   BOOST_REQUIRE(testDTree.FindSplit(testData, obDim, obSplit, obLeftError,
-      obRightError, 2, 1));
+      obRightError, 1));
 
   BOOST_REQUIRE(trueDim == obDim);
   BOOST_REQUIRE_CLOSE(trueSplit, obSplit, 1e-10);



More information about the mlpack-git mailing list