<p>Some problems need to be solved.</p>
<p>Optimizer of ann will take the address of DecomposableFunctionType, the solution I come up is </p>
<pre><code>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);
}
</code></pre>
<p>optimizer part</p>
<pre><code>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");
}
</code></pre>
<p>What do you think about it?Thanks</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/513#issuecomment-179082507">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFF_Y6jtaKbtnS51UO2IYcRbJ4Szwks5pga9DgaJpZM4HQHGn.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/mlpack/mlpack/issues/513#issuecomment-179082507"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>