[mlpack-git] master: Serialize correctly. (475edaa)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Dec 23 11:43:42 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/de9cc4b05069e1fa4793d9355f2f595af5ff45d2...6070527af14296cd99739de6c62666cc5d2a2125
>---------------------------------------------------------------
commit 475edaa0aa3cb1515a2bb1d5ed887443987e5cb2
Author: ryan <ryan at ratml.org>
Date: Thu Oct 1 19:12:36 2015 -0400
Serialize correctly.
>---------------------------------------------------------------
475edaa0aa3cb1515a2bb1d5ed887443987e5cb2
.../methods/hoeffding_trees/streaming_decision_tree.hpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp b/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
index b8a3027..c902439 100644
--- a/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
+++ b/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
@@ -42,6 +42,7 @@ class StreamingDecisionTree
}
const SplitType& Split() const { return split; }
+ SplitType& Split() { return split; }
template<typename VecType>
void Train(const VecType& data, const size_t label);
@@ -64,7 +65,20 @@ class StreamingDecisionTree
{
ar & data::CreateNVP(split, "split");
- //ar & data::CreateNVP(children, "children");
+ size_t numChildren;
+ if (Archive::is_saving::value)
+ numChildren = children.size();
+ ar & data::CreateNVP(numChildren, "numChildren");
+ if (Archive::is_loading::value)
+ children.resize(numChildren, StreamingDecisionTree(data::DatasetInfo(), 0,
+ 0));
+
+ for (size_t i = 0; i < numChildren; ++i)
+ {
+ std::ostringstream name;
+ name << "child" << i;
+ ar & data::CreateNVP(children[i], name.str());
+ }
}
private:
More information about the mlpack-git
mailing list