[mlpack-git] [mlpack/mlpack] DatasetMapper & Imputer (#694)

Tham notifications at github.com
Fri Jun 24 05:42:24 EDT 2016


> +BOOST_AUTO_TEST_CASE(MeanImputationTest)
> +{
> +  arma::mat input("3.0 0.0 2.0 0.0;"
> +                  "5.0 6.0 0.0 6.0;"
> +                  "9.0 8.0 4.0 8.0;");
> +  arma::mat outputT; // assume input is transposed
> +  arma::mat output;  // assume input is not transposed
> +  double mappedValue = 0.0;
> +
> +  MeanImputation<double> imputer;
> +
> +  // transposed
> +  imputer.Apply(input, outputT, mappedValue, 0/*dimension*/, true);
> +
> +  BOOST_REQUIRE_CLOSE(outputT(0, 0), 3.0, 1e-5);
> +  BOOST_REQUIRE_CLOSE(outputT(0, 1), 2.5, 1e-5);

No matter how I calculate, the mean value should be 5.66666667
3+5+9+6+8+2+4+6+8 = 51
51/9 =  5.66666667

Maybe it is because to you forgot to initialize sum?


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/694/files/da4e40981c40e171858f41de4e85e08af2c7e48d..d8618ec909005b0453f0a3803ac1e6cc5e588f1f#r68376091
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160624/bdd36835/attachment.html>


More information about the mlpack-git mailing list