You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported by pram on 11 Sep 42124316 15:22 UTC
We have random number generators from the uniform distribution in MLpack which use the boost library. Apparently, there are normal (Gaussian) random number generators in boost as well. Is there any way to add them to MLPack.
Commented by rcurtin on 20 Jun 42129453 03:36 UTC
I added RandNormal() which gives numbers on the standard normal distribution as well as an overload which takes a mean and variance. I don't want to wrap all the distributions there, so if we have any other commonly-used ones, we can add them to random.hpp but it's fairly easy to use one of the other ones in your code:
// some stuff
...
// Now I need a random number!
boost::random::cauchy_distribution<> dist;
double randomNumber = dist(randGen);
This exploits the global object 'randGen', which is basically the random seed object all the Boost random number generators use (it's defined in random.hpp and is of type boost::random::mt19937).
Careful though -- before Boost 1.47, all of the Boost.Random stuff was just in the boost namespace; now, it's in boost::random. You can see how I handle this in random.hpp pretty easily.
Let me know if maybe there is a better name we could use than RandNormal().
Reported by pram on 11 Sep 42124316 15:22 UTC
We have random number generators from the uniform distribution in MLpack which use the boost library. Apparently, there are normal (Gaussian) random number generators in boost as well. Is there any way to add them to MLPack.
Example of boost::normal_distribution:
http://www.bnikolic.co.uk/blog/cpp-boost-rand-normal.html
This is the boost documentation on normal_distribution.
http://www.boost.org/doc/libs/1_35_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/normal_dist.html
The text was updated successfully, but these errors were encountered: