<p>In <a href="https://github.com/mlpack/mlpack/pull/694#discussion_r66935874">src/mlpack/core/data/impute_strategies/mean_strategy.hpp</a>:</p>
<pre style='color:#555'>&gt; +   * @param dimension
&gt; +   * @param index
&gt; +   * @param transpose
&gt; +   */
&gt; +  template &lt;typename MatType&gt;
&gt; +  void Impute(const MatType &amp;input,
&gt; +              MatType &amp;output,
&gt; +              const size_t dimension,
&gt; +              const size_t index,
&gt; +              const bool transpose = true)
&gt; +  {
&gt; +    if (transpose)
&gt; +    {
&gt; +      // TODO: The mean must be calculated
&gt; +      // without NaN or target missing variable.
&gt; +      MatType meanMat = arma::mean(input, 1);
</pre>
<p>I think we can store the mean in the class, this way we do not need to recalculate the mean over and over.<br>
We can store the mapper to help us filter out what are the NaN or target missing variable too.</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/5a517c25ef55de1f4814dc3605190d17f868ff82#r66935874">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFD5tjDkk2EkafC3R6uzCJuThwEQ1ks5qLnKWgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFGTCDWr0u0jUTHE2siVtP88IRtw2ks5qLnKWgaJpZM4I07W-.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/5a517c25ef55de1f4814dc3605190d17f868ff82#r66935874"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>