<p>In <a href="https://github.com/mlpack/mlpack/pull/694#discussion_r71076342">src/mlpack/tests/imputation_test.cpp</a>:</p>
<pre style='color:#555'>> +
> + BOOST_REQUIRE_CLOSE(output(0, 0), 3.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(0, 1), 99.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(0, 2), 2.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(0, 3), 0.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(1, 0), 5.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(1, 1), 6.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(1, 2), 0.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(1, 3), 6.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(2, 0), 9.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(2, 1), 8.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(2, 2), 4.0, 1e-5);
> + BOOST_REQUIRE_CLOSE(output(2, 3), 8.0, 1e-5);
> +
> + // overwrite to the input
> + imputer.Impute(input, mappedValue, 0/*dimension*/, true);
</pre>
<p>I think we can reduce some duplicate codes</p>
<pre><code>template<typename T>
void CheckEqual(arma::Mat<T> const &lhs, arma::Mat<T> const &rhs)
{
BOOST_REQUIRE(lhs.n_rows == rhs.n_rows);
BOOST_REQUIRE(lhs.n_cols == rhs.n_cols);
for(size_t i = 0; i != lhs.n_elem; ++i)
{
BOOST_REQUIRE_CLOSE(lhs[i], rhs[i], 1e-5);
}
}
//.......
// overwrite to the input
imputer.Impute(input, mappedValue, 0/*dimension*/, columnMajor);
CheckEqual(input, output);
</code></pre>
<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/e5d591e511ae449eae1523a80346357b93b968d1#r71076342">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFPkJslMGI1xi0ucIw-sLkmdhw9ffks5qWa_KgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFGUEt0oUZMr2Tcv35YSu9D0jxeNnks5qWa_KgaJpZM4I07W-.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/e5d591e511ae449eae1523a80346357b93b968d1#r71076342"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>