<blockquote>
<p>The purpose of this function is visualize the learning results of autoencoder , even it is non-image data, you could use this function to visualize it too(ex : audio data). Extract the maximal inputs into each col is more general, but I can not imagine what is the used of it, maybe this is a little bit over designed.</p>
</blockquote>

<p>How would this work for audio data?  Assuming that the input to the autoencoder is, say, a 30ms windowed frame of audio or something like that, displaying the maximal input as a square image doesn't really make sense---I would think it would be more sensible to display that as a drawn waveform, or even just play it back for the user.</p>

<blockquote>
<p>I agree with you, not all of the applications are image applications, but the purpose of this function is visualize the results learned by autoencoder ...</p>
</blockquote>

<p>Unless I've misunderstood above, I really think that the <code>MaximalInputs()</code> should be generalized not just to image data but to arbitrary types of data, and then maybe some other utility function to take the maximal inputs and turn them into a useful format for saving as images would be the better design: it allows users who are not working with image data to still use the <code>MaximalInputs()</code> function, and the users who are working with image data can then do some quick postprocessing on the output of <code>MaximalInputs()</code> to get the results they are interested in.  This postprocessing could be the <code>ColumnsToBlocks()</code> function I suggested in a previous comment, or maybe something similar to that.</p>

<p>Following that line of thought, I think it might be better to have the scaling in the postprocessing after <code>MaximalInputs()</code>, but I'm not picky either way as long as the default is for no scaling (the idea here is that it's better to make fewer assumptions on a user's data).  Maybe a better design would be like this:</p>

<pre><code>size_t rows, cols; // These get set to the size of the images.
arma::mat maximalInputs, parameters, output;
MaximalInputs(parameters, maximalInputs);
ColumnsToBlocks(maximalInputs, outputs, rows, cols, true /* do scaling */, 0, 255);
data::Save("file.pgm", output);
</code></pre>

<blockquote>
<p>Appreciate your inputs, this kind of conversations and code reviews really help me learn something.</p>
</blockquote>

<p>Thanks---it takes a long time to have discussions like this, but it is my belief that it leads to better code in the end.  I learn a lot from these discussions too. :)</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/465#issuecomment-153153268">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFA_TnmhuQzJ84uYm8OhYVJnbVob-ks5pB8SbgaJpZM4GWT_f.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/465#issuecomment-153153268"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>