[mlpack-git] master: added Save(), Load(), Type() to LaplaceDistribution (797503d)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:57:26 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 797503df3d14b51becf35d39da84a88e8d8ebc1d
Author: michaelfox99 <michaelfox99 at gmail.com>
Date: Sat Aug 9 18:56:43 2014 +0000
added Save(), Load(), Type() to LaplaceDistribution
>---------------------------------------------------------------
797503df3d14b51becf35d39da84a88e8d8ebc1d
src/mlpack/core/dists/laplace_distribution.cpp | 13 +++++++++++++
src/mlpack/core/dists/laplace_distribution.hpp | 7 +++++++
2 files changed, 20 insertions(+)
diff --git a/src/mlpack/core/dists/laplace_distribution.cpp b/src/mlpack/core/dists/laplace_distribution.cpp
index ef9b4af..992b00f 100644
--- a/src/mlpack/core/dists/laplace_distribution.cpp
+++ b/src/mlpack/core/dists/laplace_distribution.cpp
@@ -89,3 +89,16 @@ std::string LaplaceDistribution::ToString() const
convert << util::Indent(data.str());
return convert.str();
}
+
+/*
+ * Save to or Load from SaveRestoreUtility
+ */
+void LaplaceDistribution::Save(util::SaveRestoreUtility& sr) const {
+ sr.SaveParameter(Type(), "type");
+ sr.SaveParameter(mean, "mean");
+ sr.SaveParameter(scale, "scale");
+}
+void LaplaceDistribution::Load(const util::SaveRestoreUtility& sr) {
+ sr.LoadParameter(mean, "mean");
+ sr.LoadParameter(scale, "scale");
+}
\ No newline at end of file
diff --git a/src/mlpack/core/dists/laplace_distribution.hpp b/src/mlpack/core/dists/laplace_distribution.hpp
index 59fa17f..83e1980 100644
--- a/src/mlpack/core/dists/laplace_distribution.hpp
+++ b/src/mlpack/core/dists/laplace_distribution.hpp
@@ -130,6 +130,13 @@ class LaplaceDistribution
//! Return a string representation of the object.
std::string ToString() const;
+ /*
+ * Save to or Load from SaveRestoreUtility
+ */
+ void Save(util::SaveRestoreUtility& n) const;
+ void Load(const util::SaveRestoreUtility& n);
+ static std::string const Type() { return "LaplaceDistribution"; }
+
private:
//! Mean of the distribution.
arma::vec mean;
More information about the mlpack-git
mailing list