<blockquote>
<p>void(double value) and void(const double value) are the same thing, compiler treat them as same symbol, and since the copy of primitive would not have any side effect, could I just declare them as non const?like void(double value) rather than void(const double value).</p>
</blockquote>

<p>Yeah, these are the same.  I often write 'const double' just to denote that the double won't be modified, but it doesn't really make a difference either way.</p>

<blockquote>
<p>About the default constructor, I cannot find a good way to design a default constructor to fulfill the requirements for mlpack yet, so I think it is better to remain the old way(no default constructor)</p>
</blockquote>

<p>In some cases I've made a default constructor that takes the model's size but nothing else.  Take a look at the constructor I made for <code>NaiveBayesClassifier</code> yesterday; maybe that is a strategy that could be applied here?</p>

<p><a href="https://github.com/mlpack/mlpack/commit/4a469b2733c122870274ab813528182157b12211#diff-9ce92a606304271ed37a8531bb3de99dR69" class="commit-link"><tt>4a469b2</tt>#diff-9ce92a606304271ed37a8531bb3de99dR69</a></p>

<p>I think maybe instead of default constructors, simple constructors that don't take data can be used.</p>

<blockquote>
<p>The last thing is, if you do not care about breaking the old api, I would like to replace the SparseAutoencder and SparseAutoencoderFunction under the folder methods/sparse_autoencoder</p>
</blockquote>

<p>Replace it with what?  Do you mean moving it to <code>src/mlpack/methods/ann/</code> or something?  I've got no problem changing the API; we're preparing for a release that will not be reverse-compatible (API-wise) anyway.  Lots of the old design abstractions turned out to not be the best ones.</p>

<blockquote>
<p>I forgot to said, rather than add a default constructor, I would suggest adding one more constructors , this way the users can reuse the trained parameters to train the model if they want to.</p>
</blockquote>

<p>I didn't completely understand this idea, could you elaborate more please?</p>

<blockquote>
<p>But this also mean these two classes better offer users "save" and "load" functions.<br>
sm.save("smoke_params_of_sm");<br>
sm.load("smoke_params_of_sm");</p>
</blockquote>

<p>Why not just use the existing <code>data::Load()</code> function that works with <code>boost::serialization</code> once <code>Serialize()</code> is implemented?  That would look like this:</p>

<pre><code>data::Save("model_file.xml" /* or .bin or .txt */, "softmax_regression", sm);
data::Load("model_file.xml", "softmax_regression", sm);
</code></pre>

<blockquote>
<p>This way the users can reuse the trained results easier, I intent to use boost::serialization to store and save the data of the class, what do you think about it?</p>
</blockquote>

<p><code>boost::serialization</code> is pretty nice to use; you can take a look at the other classes I've used for examples (for instance, <code>NaiveBayesClassifier</code>, which I just did), or refer to their documentation.  The only difference is the serialization shim that means you can write a <code>Serialize()</code> method instead of a <code>serialize()</code> method (although, as a technical note, if you write a <code>serialize()</code> method, it will still work.  If you like template metaprogramming, take a look at <code>src/mlpack/core/data/serialization_shim.hpp</code>; it was a lot of fun to write. :) ).</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/454#issuecomment-143461939">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFKxv81vtAjIe17vraMgtgdxFvE4kks5o1qwUgaJpZM4GDtwe.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/454#issuecomment-143461939"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>