effective_xgboost_book
effective_xgboost_book copied to clipboard
Mersenne Twister generator in chapter 4
In chapter 4, the Mersenne Twister generator is used as a parameter of RandomState. According to the documentation, it seems that RandomState directly accepts a seed for its own Mersenne Twister generator, so it would be much simpler to just have:
rs = rn.RandomState(seed=42)
The result is not exactly the same because of the different ways the seed is considered in the two usages. The usage of RandomState shown on the book seems to be its legacy form, but probably is overcomplicating things for NumPy versions newer than 1.16.