[mlpack-git] master: Set leafSize correctly when calling BuildModel() to avoid memory issues. (8e3a424)

gitdub at mlpack.org gitdub at mlpack.org
Fri Oct 7 20:09:01 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/51b9a33e90b8b239047aaacd7d6f59d9a53add8f...8e3a4248904a7e2b3f1833cf41fb56cfe4146dde

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

commit 8e3a4248904a7e2b3f1833cf41fb56cfe4146dde
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Oct 7 20:07:52 2016 -0400

    Set leafSize correctly when calling BuildModel() to avoid memory issues.


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

8e3a4248904a7e2b3f1833cf41fb56cfe4146dde
 src/mlpack/methods/range_search/rs_model.cpp | 5 ++++-
 src/mlpack/methods/rann/ra_model_impl.hpp    | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/range_search/rs_model.cpp b/src/mlpack/methods/range_search/rs_model.cpp
index 140b53c..e493810 100644
--- a/src/mlpack/methods/range_search/rs_model.cpp
+++ b/src/mlpack/methods/range_search/rs_model.cpp
@@ -30,7 +30,8 @@ RSModel::RSModel(TreeTypes treeType, bool randomBasis) :
     rpTreeRS(NULL),
     maxRPTreeRS(NULL),
     ubTreeRS(NULL),
-    octreeRS(NULL)
+    octreeRS(NULL),
+    leafSize(0)
 {
   // Nothing to do.
 }
@@ -53,6 +54,8 @@ void RSModel::BuildModel(arma::mat&& referenceSet,
     math::RandomBasis(q, referenceSet.n_rows);
   }
 
+  this->leafSize = leafSize;
+
   // Clean memory, if necessary.
   CleanMemory();
 
diff --git a/src/mlpack/methods/rann/ra_model_impl.hpp b/src/mlpack/methods/rann/ra_model_impl.hpp
index 8184c35..a3bdb25 100644
--- a/src/mlpack/methods/rann/ra_model_impl.hpp
+++ b/src/mlpack/methods/rann/ra_model_impl.hpp
@@ -599,6 +599,8 @@ void RAModel<SortPolicy>::BuildModel(arma::mat&& referenceSet,
   delete ubTreeRA;
   delete octreeRA;
 
+  this->leafSize = leafSize;
+
   if (randomBasis)
     referenceSet = q * referenceSet;
 




More information about the mlpack-git mailing list