[mlpack-git] [mlpack] Serialization of ann (#513)
stereomatchingkiss
notifications at github.com
Wed Feb 3 03:18:11 EST 2016
Some problems need to be solved.
Optimizer of ann will take the address of DecomposableFunctionType, the solution I come up is
```
void Serialize(Archive& ar, const unsigned int /* version */)
{
using mlpack::data::CreateNVP;
ar & CreateNVP(outSize, "outSize");
ar & CreateNVP(bias, "bias");
ar & CreateNVP(weights, "weights");
ar & CreateNVP(delta, "delta");
ar & CreateNVP(gradient, "gradient");
ar & CreateNVP(inputParameter, "inputParameter");
ar & CreateNVP(outputParameter, "outputParameter");
ar & CreateNVP(optimizer, "optimizer");
ar & CreateNVP(ownsOptimizer, "ownsOptimizer");
//after serialize optimizer,
optimizer.DecomposableFunction(*this);
}
```
optimizer part
```
template<typename Archive>
void Serialize(Archive& ar, const unsigned int /* version */)
{
using mlpack::data::CreateNVP;
//do not serialize function, the address of the function
//should be setup by the DecomposableFunction
//ar & CreateNVP(function, "function");
ar & CreateNVP(lr, "lr");
ar & CreateNVP(alpha, "alpha");
ar & CreateNVP(eps, "eps");
ar & CreateNVP(meanSquaredGad, "meanSquaredGad");
ar & CreateNVP(gradient, "gradient");
}
```
What do you think about it?Thanks
---
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/513#issuecomment-179082507
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160203/ed5b6f26/attachment.html>
More information about the mlpack-git
mailing list