<p>In <a href="https://github.com/mlpack/mlpack/pull/740#discussion_r72315082">src/mlpack/core/data/imputer.hpp</a>:</p>
<pre style='color:#555'>&gt; +              const std::string&amp; missingValue)
&gt; +  {
&gt; +    if (columnMajor)
&gt; +    {
&gt; +      for (size_t i = 0; i &lt; input.n_rows; ++i)
&gt; +      {
&gt; +        if (mapper.NumMappings(i) &gt; 0)
&gt; +        {
&gt; +          T mappedValue = static_cast&lt;T&gt;(mapper.UnmapValue(missingValue, i));
&gt; +          strategy.Impute(input, mappedValue, i, columnMajor);
&gt; +        }
&gt; +      }
&gt; +    }
&gt; +    else
&gt; +    {
&gt; +      for (size_t i = 0; i &lt; input.n_rows; ++i)
</pre>
<p>I think this one should be input.n_cols?<br>
Besides, we could reduce duplicate codes</p>

<pre><code>const size_t dimensions = columnMajor ? input.n_rows : input.n_cols;
for (size_t i = 0; i != dimensions ; ++i)
 {
        if (mapper.NumMappings(i) &gt; 0)
        {
          T mappedValue = static_cast&lt;T&gt;(mapper.UnmapValue(missingValue, i));
          strategy.Impute(input, mappedValue, i, columnMajor);
        }
}
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/740/files/645c58d4f0d413b2fe0c97766b1aa4bc486e21bb#r72315082">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFNNxejsD320-QF00BKIqvK3-uNH0ks5qZll2gaJpZM4JU0It">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFJsLRAMuwn41ha4FBkumok0d-fBeks5qZll2gaJpZM4JU0It.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/740/files/645c58d4f0d413b2fe0c97766b1aa4bc486e21bb#r72315082"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>