<p>In <a href="https://github.com/mlpack/mlpack/pull/694#discussion_r69922415">src/mlpack/core/data/imputation_methods/median_imputation.hpp</a>:</p>
<pre style='color:#555'>> + const bool transpose = true)
> + {
> + //initiate output
> + output = input;
> +
> + if (transpose)
> + {
> + arma::Mat<T> medianMat = arma::median(input, 1);
> + for (size_t i = 0; i < input.n_cols; ++i)
> + {
> + if (input(dimension, i) == mappedValue ||
> + std::isnan(input(dimension, i)))
> + {
> + output(dimension, i) = medianMat(dimension, 0);
> + }
> + }
</pre>
<p>Iterate non contiguous memory frequently would slow down the speed. But in this case I think this is necessary, because this imputation is apply to a single row only</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<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#r69922415">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFI01tnSTuI0TSFZ4NZqy3Mj06ysSks5qTRQJgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFG07_yj_NVQG8GOLmx0uF7SOM3beks5qTRQJgaJpZM4I07W-.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#r69922415"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>