<blockquote>
<p>Sorry for my misunderstanding, I should open an issue before I treat it as a bug next time.</p>
</blockquote>
<p>No worries, I guess the pull request makes it sometimes easier to talk about changes.</p>
<blockquote>
<p>Do you mean you want to set the ration when you call the Forward function?</p>
</blockquote>
<p>I would put <code>scale = 1.0 / (1.0 - ratio);</code>at the beginning of the <code>Forward(...)</code> function, so the <code>scale</code> value is calculated even in prediction only mode. Additionally a user could change the scale value afterwards through the <code>Ratio()</code> function.</p>
<pre><code>template<typename eT>
void Forward(const arma::Mat<eT>& input, arma::Mat<eT>& output)
{
scale = 1.0 / (1.0 - ratio);
// The dropout mask will not be multiplied in the deterministic mode
// (during testing).
if (deterministic)
{
output = input;
if (rescale)
output *= scale;
}
else
{
// Scale with input / (1 - ratio) and set values to zero with probability
// ratio.
mask = arma::randu<arma::Mat<eT> >(input.n_rows, input.n_cols);
mask.transform( [&](double val) { return (val > ratio); } );
output = input % mask * scale;
}
}
</code></pre>
<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/463#issuecomment-150184035">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFABDqYQBB-QvZL34MNxjabITgvuFks5o-L0dgaJpZM4GSg7s.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/463#issuecomment-150184035"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>