<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&amp; ar, const unsigned int /* version */)
  {
    using mlpack::data::CreateNVP;

    ar &amp; CreateNVP(outSize, "outSize");
    ar &amp; CreateNVP(bias, "bias");
    ar &amp; CreateNVP(weights, "weights");
    ar &amp; CreateNVP(delta, "delta");
    ar &amp; CreateNVP(gradient, "gradient");
    ar &amp; CreateNVP(inputParameter, "inputParameter");
    ar &amp; CreateNVP(outputParameter, "outputParameter");
    ar &amp; CreateNVP(optimizer, "optimizer");    
    ar &amp; CreateNVP(ownsOptimizer, "ownsOptimizer");

    //after serialize optimizer, 
    optimizer.DecomposableFunction(*this);
  }

</code></pre>

<p>optimizer part</p>

<pre><code>template&lt;typename Archive&gt;
  void Serialize(Archive&amp; 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 &amp; CreateNVP(function, "function");
    ar &amp; CreateNVP(lr, "lr");
    ar &amp; CreateNVP(alpha, "alpha");
    ar &amp; CreateNVP(eps, "eps");
    ar &amp; CreateNVP(meanSquaredGad, "meanSquaredGad");
    ar &amp; 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;">&mdash;<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>