[mlpack-git] master: Add convenience typedef. (522cf72)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Dec 23 11:44:00 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/de9cc4b05069e1fa4793d9355f2f595af5ff45d2...6070527af14296cd99739de6c62666cc5d2a2125

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

commit 522cf72903cc4c848ab61093f4e59b44888e779b
Author: ryan <ryan at ratml.org>
Date:   Fri Oct 2 00:04:52 2015 -0400

    Add convenience typedef.


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

522cf72903cc4c848ab61093f4e59b44888e779b
 src/mlpack/methods/hoeffding_trees/CMakeLists.txt    |  1 +
 .../hoeffding_trees/streaming_decision_tree.hpp      |  7 +++++++
 src/mlpack/methods/hoeffding_trees/typedef.hpp       | 20 ++++++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/src/mlpack/methods/hoeffding_trees/CMakeLists.txt b/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
index ff116f1..957e609 100644
--- a/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
+++ b/src/mlpack/methods/hoeffding_trees/CMakeLists.txt
@@ -12,6 +12,7 @@ set(SOURCES
   numeric_split_info.hpp
   streaming_decision_tree.hpp
   streaming_decision_tree_impl.hpp
+  typedef.hpp
 )
 
 # Add directory name to sources.
diff --git a/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp b/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
index 89856e5..bf2aa43 100644
--- a/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
+++ b/src/mlpack/methods/hoeffding_trees/streaming_decision_tree.hpp
@@ -70,12 +70,14 @@ class StreamingDecisionTree
   template<typename Archive>
   void Serialize(Archive& ar, const unsigned int /* version */)
   {
+    std::cout << "serialize split\n";
     ar & data::CreateNVP(split, "split");
 
     size_t numChildren;
     if (Archive::is_saving::value)
       numChildren = children.size();
     ar & data::CreateNVP(numChildren, "numChildren");
+    std::cout << "serialize " << numChildren << " children\n";
     if (Archive::is_loading::value)
       children.resize(numChildren, StreamingDecisionTree(data::DatasetInfo(), 0,
           0));
@@ -84,7 +86,9 @@ class StreamingDecisionTree
     {
       std::ostringstream name;
       name << "child" << i;
+      std::cout << "try to deserialize " << name.str() << "\n";
       ar & data::CreateNVP(children[i], name.str());
+      std::cout << "serialized " << name.str() << "\n";
     }
   }
 
@@ -100,4 +104,7 @@ class StreamingDecisionTree
 // Include implementation.
 #include "streaming_decision_tree_impl.hpp"
 
+// Include convenience typedefs.
+#include "typedef.hpp"
+
 #endif
diff --git a/src/mlpack/methods/hoeffding_trees/typedef.hpp b/src/mlpack/methods/hoeffding_trees/typedef.hpp
new file mode 100644
index 0000000..ba8e1e9
--- /dev/null
+++ b/src/mlpack/methods/hoeffding_trees/typedef.hpp
@@ -0,0 +1,20 @@
+/**
+ * @file typedef.hpp
+ * @author Ryan Curtin
+ *
+ * Useful typedefs.
+ */
+#ifndef __MLPACK_METHODS_HOEFFDING_TREES_TYPEDEF_HPP
+#define __MLPACK_METHODS_HOEFFDING_TREES_TYPEDEF_HPP
+
+#include "streaming_decision_tree.hpp"
+
+namespace mlpack {
+namespace tree {
+
+typedef StreamingDecisionTree<HoeffdingSplit<>> HoeffdingTree;
+
+} // namespace tree
+} // namespace mlpack
+
+#endif



More information about the mlpack-git mailing list