[mlpack-git] master: Serialize number of classes correctly. (1a55288)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Dec 23 11:45:08 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/de9cc4b05069e1fa4793d9355f2f595af5ff45d2...6070527af14296cd99739de6c62666cc5d2a2125
>---------------------------------------------------------------
commit 1a55288e2a3d89466c5df21d6636665a93fa4481
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Oct 27 08:45:23 2015 -0700
Serialize number of classes correctly.
>---------------------------------------------------------------
1a55288e2a3d89466c5df21d6636665a93fa4481
.../methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp b/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
index 5f573db..8f72d17 100644
--- a/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
+++ b/src/mlpack/methods/hoeffding_trees/hoeffding_numeric_split_impl.hpp
@@ -200,6 +200,12 @@ void HoeffdingNumericSplit<FitnessFunction, ObservationType>::Serialize(
labels.zeros(observationsBeforeBinning);
}
+ // Save the number of classes.
+ size_t numClasses;
+ if (Archive::is_saving::value)
+ numClasses = sufficientStatistics.n_rows;
+ ar & data::CreateNVP(numClasses, "numClasses");
+
for (size_t i = 0; i < samplesSeen; ++i)
{
std::ostringstream oss;
@@ -215,7 +221,7 @@ void HoeffdingNumericSplit<FitnessFunction, ObservationType>::Serialize(
{
// Clean other objects.
splitPoints.clear();
- sufficientStatistics.clear();
+ sufficientStatistics.zeros(numClasses, bins);
}
}
}
More information about the mlpack-git
mailing list