<p>In <a href="https://github.com/mlpack/mlpack/pull/740#discussion_r72484785">src/mlpack/tests/imputation_test.cpp</a>:</p>
<pre style='color:#555'>&gt; +          DatasetMapper&lt;MissingPolicy&gt;,
&gt; +          CustomImputation&lt;double&gt;&gt; allImputer(allInfo, allCustomStrategy);
&gt; +  // convert a or nan to 99 for all dimensions.
&gt; +  allImputer.Impute(allInput, &quot;a&quot;);
&gt; +
&gt; +  // Custom imputation result check
&gt; +  BOOST_REQUIRE_CLOSE(allInput(0, 0), 99.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(0, 1), 5.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(0, 2), 8.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(1, 0), 2.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(1, 1), 6.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(1, 2), 9.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(2, 0), 3.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(2, 1), 99.0, 1e-5);
&gt; +  BOOST_REQUIRE_CLOSE(allInput(2, 2), 10.0, 1e-5);
&gt; +
</pre>
<p>Hi, Keon, I think we should do the test on rowMajor data too.</p>

<pre><code>// Now, try impute() overload with all dimensions.
  arma::mat allInputColumnWise;
  MissingPolicy allPolicy({"a"});
  DatasetMapper&lt;MissingPolicy&gt; allInfo(allPolicy);
  BOOST_REQUIRE(data::Load("test_file.csv", allInputColumnWise, allInfo) == true);
  arma::mat allInputRowWise = allInputColumnWise;

  // convert missing vals to 99.
  CustomImputation&lt;double&gt; allCustomStrategy(99);
  Imputer&lt;double,
          DatasetMapper&lt;MissingPolicy&gt;,
          CustomImputation&lt;double&gt;&gt; allImputer(allInfo, allCustomStrategy);
  // convert a or nan to 99 for all dimensions.
  allImputer.Impute(allInputColumnWise, "a");
  allImputer.ColumnMajor() = true; //I add a new function to access ColumnMajor
  allImputer.Impute(allInputRowWise, "a");

  // Custom imputation result check
  auto requireClose = [](arma::mat const &amp;input)
  {
      BOOST_REQUIRE_CLOSE(input(0, 0), 99.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(0, 1), 5.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(0, 2), 8.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(1, 0), 2.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(1, 1), 6.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(1, 2), 9.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(2, 0), 3.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(2, 1), 99.0, 1e-5);
      BOOST_REQUIRE_CLOSE(input(2, 2), 10.0, 1e-5);
  };

  requireClose(allInputColumnWise);  
  requireClose(allInputRowWise);

</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/7e05bb9831e8dd58ee9e8d246dc0704a28afbe65#r72484785">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFGW2_llOiuMTy3z4nbF7e4OS6Psmks5qZ5YKgaJpZM4JU0It">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFI_ti9EdvJh1dNZrYRLMwA7Owg6yks5qZ5YKgaJpZM4JU0It.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/7e05bb9831e8dd58ee9e8d246dc0704a28afbe65#r72484785"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>