[mlpack-git] [mlpack/mlpack] Binarize Function + Test (#666)

Ryan Curtin notifications at github.com
Thu Jun 2 15:01:03 EDT 2016


> +    const umat& rhsCol = answer.col(i);
> +    for (size_t j = 0; j < lhsCol.n_rows; ++j)
> +    {
> +      if (std::abs(rhsCol(j)) < 1e-5)
> +        BOOST_REQUIRE_SMALL(lhsCol(j), 1e-5);
> +      else
> +        BOOST_REQUIRE_CLOSE(lhsCol(j), rhsCol(j), 1e-5);
> +    }
> +  }
> +}
> +
> +BOOST_AUTO_TEST_CASE(BinarizeThreshold)
> +{
> +  mat input(10, 10, fill::randu); // fill input with randome Number
> +  mat constMat(10, 10);
> +  math::RandomSeed((size_t) std::time(NULL));

We should avoid setting the random seed in the tests, this can make specific test errors really hard to reproduce.  What I like to do is set the random seed like you did here and run like 1000 tests on my local machine to make sure it works, then remove the line that sets the seed.

---
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/666/files/095842f1517c0200eaffa51ccdf05cbf28cff2dc#r65598729
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160602/ae72de23/attachment.html>


More information about the mlpack-git mailing list