<p><a href="https://github.com/rcurtin" class="user-mention">@rcurtin</a> <a href="https://github.com/stereomatchingkiss" class="user-mention">@stereomatchingkiss</a> <br>
I think now the overloads that produces output matrix are little bit more optimized.<br>
The previous method went through every matrix again and again when imputing each dimensions.</p>

<p>Now the copy of the matrix happens at the same time calculating the mean (or median or anything). And target vector still remains to reduce the work of going through the dimension again.<br>
So now it becomes (1m + 1t) (copy and caculate + replace) instead of previous (1m + 1d + 1t) (copy + caculate + replace). (m is the whole matrix, d is dimension, and t is the target vector). This showed slight improvements in performance.</p>

<p>However for the executable, I made it so that when going through every dimensions, first to check if any mappings exist in the dimension, put them in a list of dirtyDimensions, and apply the imputation methods on those dimensions. And when applying the changes using <code>Impute()</code>, the executable uses the overload that does not produce the output matrix. This one results in (1d + 1t) for every dimensions that have missing value mappings.</p>

<p>Benchmarks:<br>
data: 'imputer.csv' as CSV data.  Size is 400850 x 4.</p>

<pre><code>[INFO ] 15970 mappings in dimension 0.
[INFO ] 2646 mappings in dimension 1.
[INFO ] 2646 mappings in dimension 2.
[INFO ] 2661 mappings in dimension 3.
mlpack_preprocess_imputer -i imputer.csv -d 0 -m a -s mean -v 
</code></pre>

<p>Impute one dimension</p>

<ul>
<li>overload producing output (1m + 1d + 1t) for every dimensions: <code>0.058182s</code>
</li>
<li>overload producing output (1m + 1t) for every dimensions: <code>0.056293s</code>
</li>
<li>overload without producing output (1d + 1t) for every dimensions: <code>0.047528s</code>
</li>
</ul>

<p>And for FYI - Impute all dimensions<br>
Same data,<br>
<code>mlpack_preprocess_imputer -i imputer.csv -m a -s mean -v</code></p>

<ul>
<li>overload without producing output(1d + 1t) for every dimensions.</li>
</ul>

<pre><code>[INFO ]   imputation: 0.197194s
[INFO ]   loading_data: 18.417980s
[INFO ]   total_time: 18.616683s
</code></pre>

<p>I know this is being fixed, but the most of the overhead comes from the loading_data right now.</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#issuecomment-233244428">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFMlT_Q4JGiSIVWbd16JvSiwwK9cdks5qWx6SgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFDi1gDUulyE7sQV2WxA9FFo5NzO7ks5qWx6SgaJpZM4I07W-.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#issuecomment-233244428"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>