[mlpack-git] master: Add Serialize(). (5cfb713)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Tue Sep 29 09:33:33 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/cbeb3ea17262b7c5115247dc217e316c529249b7...f85a9b22f3ce56143943a2488c05c2810d6b2bf3

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

commit 5cfb71330998522a6c8244ecba8a83d29c6c55a8
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Sep 25 21:32:59 2015 +0000

    Add Serialize().


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

5cfb71330998522a6c8244ecba8a83d29c6c55a8
 src/mlpack/methods/amf/update_rules/nmf_als.hpp            |  4 ++++
 src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp      |  4 ++++
 src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp       |  4 ++++
 src/mlpack/methods/amf/update_rules/svd_batch_learning.hpp | 13 +++++++++++++
 4 files changed, 25 insertions(+)

diff --git a/src/mlpack/methods/amf/update_rules/nmf_als.hpp b/src/mlpack/methods/amf/update_rules/nmf_als.hpp
index 395f93d..23f8163 100644
--- a/src/mlpack/methods/amf/update_rules/nmf_als.hpp
+++ b/src/mlpack/methods/amf/update_rules/nmf_als.hpp
@@ -112,6 +112,10 @@ class NMFALSUpdate
       }
     }
   }
+
+  //! Serialize the object (in this case, there is nothing to serialize).
+  template<typename Archive>
+  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
 }; // class NMFALSUpdate
 
 } // namespace amf
diff --git a/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp b/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp
index c8e96a7..025fc0d 100644
--- a/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp
+++ b/src/mlpack/methods/amf/update_rules/nmf_mult_dist.hpp
@@ -90,6 +90,10 @@ class NMFMultiplicativeDistanceUpdate
   {
     H = (H % (W.t() * V)) / (W.t() * W * H);
   }
+
+  //! Serialize the object (in this case, there is nothing to serialize).
+  template<typename Archive>
+  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
 };
 
 } // namespace amf
diff --git a/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp b/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp
index bd972c0..018d9ee 100644
--- a/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp
+++ b/src/mlpack/methods/amf/update_rules/nmf_mult_div.hpp
@@ -143,6 +143,10 @@ class NMFMultiplicativeDivergenceUpdate
       }
     }
   }
+
+  //! Serialize the object (in this case, there is nothing to serialize).
+  template<typename Archive>
+  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
 };
 
 } // namespace amf
diff --git a/src/mlpack/methods/amf/update_rules/svd_batch_learning.hpp b/src/mlpack/methods/amf/update_rules/svd_batch_learning.hpp
index 265c8a8..e3a3738 100644
--- a/src/mlpack/methods/amf/update_rules/svd_batch_learning.hpp
+++ b/src/mlpack/methods/amf/update_rules/svd_batch_learning.hpp
@@ -159,6 +159,19 @@ class SVDBatchLearning
     H += mH;
   }
 
+  //! Serialize the SVDBatch object.
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int /* version */)
+  {
+    using data::CreateNVP;
+    ar & CreateNVP(u, "u");
+    ar & CreateNVP(kw, "kw");
+    ar & CreateNVP(kh, "kh");
+    ar & CreateNVP(momentum, "momentum");
+    ar & CreateNVP(mW, "mW");
+    ar & CreateNVP(mH, "mH");
+  }
+
  private:
   //! Step size of the algorithm.
   double u;



More information about the mlpack-git mailing list