evhub / bbopt

Black box hyperparameter optimization made easy.
Apache License 2.0
75 stars 8 forks source link

[BUG]: `numpy.random.mtrand.RandomState` object has no attribute `integers` -> switch to `np.random.Generator` #17

Closed themasterlink closed 2 years ago

themasterlink commented 2 years ago

Hey,

I found a bug, which is easy to fix, the hyperopt backend does not use the deprecated np.random.RandomState anymore and replaced it with np.random.Generator, this means the following line:

https://github.com/evhub/bbopt/blob/408e210e57b7a2aaf3cfd3a3c225fc2af6b3c56d/bbopt/backends/hyperopt.py#L176

Should be changed to:

    def setup_backend(self, params, algo=tpe.suggest, rstate=np.random.default_rng(), show_progressbar=False, **options): 

This is explained in the following issue on hyperopt:

https://github.com/hyperopt/hyperopt/issues/838

Best, Max

evhub commented 2 years ago

Thanks for the bug report! Should be fixed now in bbopt>=1.3.9.