[mlpack-git] master: Fix serialization. (a71b57c)

gitdub at mlpack.org gitdub at mlpack.org
Thu Aug 4 12:51:44 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/0f4b25acd6aaa14294c044874ba6cc0751712baa...0a19d07bd39e6223991976474bc79671ba8aa0f0

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

commit a71b57caa90311f5542180bc0553449c3691395d
Author: MarcosPividori <marcos.pividori at gmail.com>
Date:   Thu Aug 4 13:51:44 2016 -0300

    Fix serialization.


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

a71b57caa90311f5542180bc0553449c3691395d
 src/mlpack/core/tree/spill_tree/hyperplane.hpp        | 10 ++++++++++
 src/mlpack/core/tree/spill_tree/projection_vector.hpp | 18 ++++++++++++++++++
 src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp   |  1 +
 3 files changed, 29 insertions(+)

diff --git a/src/mlpack/core/tree/spill_tree/hyperplane.hpp b/src/mlpack/core/tree/spill_tree/hyperplane.hpp
index 6d59ec3..9363371 100644
--- a/src/mlpack/core/tree/spill_tree/hyperplane.hpp
+++ b/src/mlpack/core/tree/spill_tree/hyperplane.hpp
@@ -124,6 +124,16 @@ class HyperplaneBase
       return 0;
     return projVect.Project(bound).Lo() > splitVal;
   };
+
+  /**
+   * Serialization.
+   */
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int /* version */)
+  {
+    ar & data::CreateNVP(projVect, "projVect");
+    ar & data::CreateNVP(splitVal, "splitVal");
+  };
 };
 
 /**
diff --git a/src/mlpack/core/tree/spill_tree/projection_vector.hpp b/src/mlpack/core/tree/spill_tree/projection_vector.hpp
index 140d138..4b0b2b9 100644
--- a/src/mlpack/core/tree/spill_tree/projection_vector.hpp
+++ b/src/mlpack/core/tree/spill_tree/projection_vector.hpp
@@ -68,6 +68,15 @@ class AxisParallelProjVector
   {
     return bound[dim];
   };
+
+  /**
+   * Serialization.
+   */
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int /* version */)
+  {
+    ar & data::CreateNVP(dim, "dim");
+  };
 };
 
 /**
@@ -122,6 +131,15 @@ class ProjVector
     const double radius = bound.Radius();
     return math::Range(center - radius, center + radius);
   };
+
+  /**
+   * Serialization.
+   */
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int /* version */)
+  {
+    ar & data::CreateNVP(projVect, "projVect");
+  };
 };
 
 } // namespace tree
diff --git a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
index e086ad2..6b39210 100644
--- a/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
+++ b/src/mlpack/core/tree/spill_tree/spill_tree_impl.hpp
@@ -670,6 +670,7 @@ void SpillTree<MetricType, StatisticType, MatType, HyperplaneType, SplitType>::
   ar & CreateNVP(count, "count");
   ar & CreateNVP(pointsIndex, "pointsIndex");
   ar & CreateNVP(overlappingNode, "overlappingNode");
+  ar & CreateNVP(hyperplane, "hyperplane");
   ar & CreateNVP(bound, "bound");
   ar & CreateNVP(stat, "statistic");
   ar & CreateNVP(parentDistance, "parentDistance");




More information about the mlpack-git mailing list