<p>In <a href="https://github.com/mlpack/mlpack/pull/451#discussion_r40166914">src/mlpack/methods/ann/sparse_autoencoder_function.hpp</a>:</p>
<pre style='color:#555'>> + * //using SAEF = nn::SparseAutoencoderFunction;
> + *
> + * size_t const Features = 16*16;
> + * arma::mat data = randu<mat>(Features, 10000);
> + *
> + * SAEF encoderFunction(data, Features, Features / 2);
> + * const size_t numIterations = 100; // Maximum number of iterations.
> + * const size_t numBasis = 10;
> + * optimization::L_BFGS<SAEF> optimizer(encoderFunction, numBasis, numIterations);
> + *
> + * arma::mat parameters = encoderFunction.GetInitialPoint();
> + *
> + * // Train the model.
> + * Timer::Start("sparse_autoencoder_optimization");
> + * const double out = optimizer.Optimize(parameters);
> + * Timer::Stop("sparse_autoencoder_optimization");
</pre>
<p>The API here is the way Siddharth originally wrote it, using the standard mlpack optimizers to optimize the weights of the network. But maybe it would be a better idea to make this class work with the <code>Trainer</code> class in <code>src/mlpack/methods/ann/</code>? Kind of like the examples in <code>convolutional_network_test.cpp</code> and <code>feedforward_network_test.cpp</code>:</p>
<pre><code>SAEF autoencoder(...);
Trainer<SAEF> trainer(autoencoder, ...);
trainer.Train(...);
</code></pre>
<p>This would help make all of the ANN-related code in mlpack have a unified interface. I'd be interested in zoq's comments on this too, since I don't know his plans for what the API there will eventually look like.</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/pull/451/files#r40166914">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFJLznHl4q9cPCk8NbJwMAR0Iw4z7ks5o0gpSgaJpZM4GAqt4.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/files#r40166914"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>