<p>Serialization for the ANN code would be absolutely great. In fact, someone asks me some time ago, to implement a feature to save the trained model, so I think the serialization function will come in handy. Opening another pull request to discuss the implementation details sounds great. In most cases it shouldn't be more than saving the weights.</p>

<p>Reusing the existing ann code to implement an autoencoder should be straightforward. We have to implement a new performance function to calculate the reconstruction error, the regularization cost and the KL divergence cost terms to monitor the training process and because we don't have a target value we use the already provided input.</p>

<p>I don't have a good solution for warning the user if the layer combinations doesn't make sense at all. As <a href="https://github.com/rcurtin" class="user-mention">@rcurtin</a> already said using static_assert could be a good way to solve the problem, but I'm not sure if it's the best. Every time someone implements a new layer, he needs to think about in which context this layer makes sense, maybe this effort is negligible. So maybe it's enough, if we just define some default models. If a user is interested in a special layer combination, I would say he knows what combination makes sense. I guess this is what <a href="https://github.com/rcurtin" class="user-mention">@rcurtin</a> suggested as another solution.</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/pull/451#issuecomment-162036050">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFPeoXkX3jFZE1sVwtC3mRS0rhN-Sks5pMcxLgaJpZM4GAqt4.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/pull/451#issuecomment-162036050"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>