<p>In <a href="https://github.com/mlpack/mlpack/pull/465#discussion_r43120492">src/mlpack/methods/sparse_autoencoder/maximal_inputs.cpp</a>:</p>
<pre style='color:#555'>> + int const squareRows = (int)std::sqrt(paramTemp.n_cols);
> + int const buf = 1;
> +
> + int const offset = squareRows+buf;
> + output.ones(buf+rows*(offset),
> + buf+cols*(offset));
> +
> + VisualizeHiddenUnit(rows, cols, squareRows,
> + offset, paramTemp, output);
> +
> + double const max = output.max();
> + double const min = output.min();
> + if((max - min) != 0)
> + {
> + output = (output - min) / (max - min) * 255;
> + }
</pre>
<p>This scales the output to the range [0, 255], but is that always what the user will want? Maybe it's worth considering a few more parameters to <code>MaximalInputs()</code> for scaling? i.e. <code>bool scale</code>, <code>double min</code>, <code>double max</code>, and you could use defaults. What do you think? I don't know if everyone is going to want to be saving specifically to PGM (or another 8-bit grayscale image format) when using this function.</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/465/files#r43120492">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFNi6FqHaRNiZja1n7Qhk3-Rs3qEYks5o_3QKgaJpZM4GWT_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/files#r43120492"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>