[mlpack-git] master: Add Serialize() implementation. (e01baa6)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Mon Dec 21 15:32:28 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/51205e0ad285b2cf421546d8876fc63e994f2d73...e01baa6582c6ce3cfda243157159de9c30e2cbd8
>---------------------------------------------------------------
commit e01baa6582c6ce3cfda243157159de9c30e2cbd8
Author: ryan <ryan at ratml.org>
Date: Mon Dec 21 15:32:07 2015 -0500
Add Serialize() implementation.
>---------------------------------------------------------------
e01baa6582c6ce3cfda243157159de9c30e2cbd8
src/mlpack/methods/cf/cf_impl.hpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/mlpack/methods/cf/cf_impl.hpp b/src/mlpack/methods/cf/cf_impl.hpp
index 0781e7b..16975e4 100644
--- a/src/mlpack/methods/cf/cf_impl.hpp
+++ b/src/mlpack/methods/cf/cf_impl.hpp
@@ -148,6 +148,21 @@ void CF::Train(const arma::sp_mat& data,
Timer::Stop("cf_factorization");
}
+//! Serialize the model.
+template<typename Archive>
+void CF::Serialize(Archive& ar, const unsigned int /* version */)
+{
+ // This model is simple; just serialize all the members. No special handling
+ // required.
+ using data::CreateNVP;
+
+ ar & CreateNVP(numUsersForSimilarity, "numUsersForSimilarity");
+ ar & CreateNVP(rank, "rank");
+ ar & CreateNVP(w, "w");
+ ar & CreateNVP(h, "h");
+ ar & CreateNVP(cleanedData, "cleanedData");
+}
+
} // namespace mlpack
} // namespace cf
More information about the mlpack-git
mailing list