Skip to content

Instantly share code, notes, and snippets.

@rcurtin
Created August 10, 2020 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcurtin/da725040ad9fd529476ef880ac37a245 to your computer and use it in GitHub Desktop.
Save rcurtin/da725040ad9fd529476ef880ac37a245 to your computer and use it in GitHub Desktop.
From 5da5475d34cf6b32fc105f2e7f4becc8c2caea6a Mon Sep 17 00:00:00 2001
From: Ryan Curtin <ryan@ratml.org>
Date: Sun, 9 Aug 2020 21:46:34 -0400
Subject: [PATCH 2/3] Fixes for compilation.
---
.../ann/loss_functions/soft_margin_loss.hpp | 2 +-
.../loss_functions/soft_margin_loss_impl.hpp | 5 ++--
.../bayesian_linear_regression.hpp | 2 +-
.../bayesian_linear_regression_impl.hpp | 27 +++++++++----------
4 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp b/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp
index 605087511..409856024 100644
--- a/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp
+++ b/src/mlpack/methods/ann/loss_functions/soft_margin_loss.hpp
@@ -81,7 +81,7 @@ class SoftMarginLoss
* Serialize the layer.
*/
template<typename Archive>
- void serialize(Archive& ar, const unsigned int /* version */);
+ void serialize(Archive& ar);
private:
//! Locally-stored output parameter object.
diff --git a/src/mlpack/methods/ann/loss_functions/soft_margin_loss_impl.hpp b/src/mlpack/methods/ann/loss_functions/soft_margin_loss_impl.hpp
index 87fdb3f80..976dc6366 100644
--- a/src/mlpack/methods/ann/loss_functions/soft_margin_loss_impl.hpp
+++ b/src/mlpack/methods/ann/loss_functions/soft_margin_loss_impl.hpp
@@ -60,10 +60,9 @@ void SoftMarginLoss<InputDataType, OutputDataType>::Backward(
template<typename InputDataType, typename OutputDataType>
template<typename Archive>
void SoftMarginLoss<InputDataType, OutputDataType>::serialize(
- Archive& ar,
- const unsigned int /* version */)
+ Archive& ar)
{
- ar & BOOST_SERIALIZATION_NVP(reduction);
+ ar & CEREAL_NVP(reduction);
}
} // namespace ann
diff --git a/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.hpp b/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.hpp
index 415f63e59..dd4974707 100644
--- a/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.hpp
+++ b/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.hpp
@@ -213,7 +213,7 @@ class BayesianLinearRegression
* Serialize the BayesianLinearRegression model.
**/
template<typename Archive>
- void serialize(Archive& ar, const unsigned int /* version */);
+ void serialize(Archive& ar);
private:
//! Center the data if true.
diff --git a/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_impl.hpp b/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_impl.hpp
index 9c4cb20f0..108a305cd 100644
--- a/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_impl.hpp
+++ b/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression_impl.hpp
@@ -21,21 +21,20 @@ namespace regression {
* Serialize the Bayesian linear regression model.
*/
template<typename Archive>
-void BayesianLinearRegression::serialize(Archive& ar,
- const unsigned int /* version */)
+void BayesianLinearRegression::serialize(Archive& ar)
{
- ar & BOOST_SERIALIZATION_NVP(centerData);
- ar & BOOST_SERIALIZATION_NVP(scaleData);
- ar & BOOST_SERIALIZATION_NVP(nIterMax);
- ar & BOOST_SERIALIZATION_NVP(tol);
- ar & BOOST_SERIALIZATION_NVP(dataOffset);
- ar & BOOST_SERIALIZATION_NVP(dataScale);
- ar & BOOST_SERIALIZATION_NVP(responsesOffset);
- ar & BOOST_SERIALIZATION_NVP(alpha);
- ar & BOOST_SERIALIZATION_NVP(beta);
- ar & BOOST_SERIALIZATION_NVP(gamma);
- ar & BOOST_SERIALIZATION_NVP(omega);
- ar & BOOST_SERIALIZATION_NVP(matCovariance);
+ ar & CEREAL_NVP(centerData);
+ ar & CEREAL_NVP(scaleData);
+ ar & CEREAL_NVP(nIterMax);
+ ar & CEREAL_NVP(tol);
+ ar & CEREAL_NVP(dataOffset);
+ ar & CEREAL_NVP(dataScale);
+ ar & CEREAL_NVP(responsesOffset);
+ ar & CEREAL_NVP(alpha);
+ ar & CEREAL_NVP(beta);
+ ar & CEREAL_NVP(gamma);
+ ar & CEREAL_NVP(omega);
+ ar & CEREAL_NVP(matCovariance);
}
} // namespace regression
--
2.28.0.rc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment