<p>In <a href="https://github.com/mlpack/mlpack/pull/694#discussion_r70571245">src/mlpack/core/data/imputation_methods/median_imputation.hpp</a>:</p>
<pre style='color:#555'>&gt; +              const bool transpose = true)
&gt; +  {
&gt; +    //initiate output
&gt; +    output = input;
&gt; +
&gt; +    if (transpose)
&gt; +    {
&gt; +      arma::Mat&lt;T&gt; medianMat = arma::median(input, 1);
&gt; +      for (size_t i = 0; i &lt; input.n_cols; ++i)
&gt; +      {
&gt; +        if (input(dimension, i) == mappedValue ||
&gt; +            std::isnan(input(dimension, i)))
&gt; +        {
&gt; +          output(dimension, i) = medianMat(dimension, 0);
&gt; +        }
&gt; +      }
</pre>
<p>Hmm... so should I make an overload that replaces the whole matrix?</p>

<blockquote>
<p>It would also be slower in this case because we would be calculating the mean for every dimension every time we called the method.<br>
I believe this problem can be solved in the following pull request. I am building a Statistics class that calculates mean, median, std, skew, kurtosis.. etc only on a give dimension. </p>
</blockquote>

<p>But I guess it will still not be the optimal solution, since it'll still going through each column.</p>

<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/694/files/a8818316a04506530e2269a2e0a32ba2f6a1c83b#r70571245">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFNdfjSEIcNNTTjjTtinXxIo2eU2Mks5qVIhWgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFKA_ZJwC3Pi_Zsgc-1ANDI-04dZ_ks5qVIhWgaJpZM4I07W-.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/694/files/a8818316a04506530e2269a2e0a32ba2f6a1c83b#r70571245"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>