Skip to content

Commit

Permalink
fix: numpy.random.RandomState is no longer an accepted random state b…
Browse files Browse the repository at this point in the history
…y hyperopt. Use numpy.random.Generator instead (#50)
  • Loading branch information
thededlier committed Apr 10, 2023
1 parent 23bbe72 commit 691fcd4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
1 change: 0 additions & 1 deletion auto_surprise/context/result_logging_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import time
import datetime
import pathlib
import logging

class ResultLoggingManager:
Expand Down
2 changes: 1 addition & 1 deletion auto_surprise/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class Engine(object):
def __init__(
self, verbose=True, algorithms=FULL_ALGO_LIST, random_state=numpy.random
self, verbose=True, algorithms=FULL_ALGO_LIST, random_state=numpy.random.default_rng()
):
"""
Initialize new engine
Expand Down
8 changes: 3 additions & 5 deletions docs/usage/reproducing_experiments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ Reproducing Experiments
You may want to make sure that your results are reproducible. This can be done easily by setting the seed and random state when initializing `Engine`.

.. code-block:: python
import numpy
from auto_surprise.engine import Engine
random.seed(123)
numpy.random.seed(123)
# Intitialize auto surprise engine with random state set
engine = Engine(verbose=True, random_state=numpy.random.RandomState(123))
engine = Engine(verbose=True, random_state=numpy.random.default_rng(12345))
This will make sure that you're results will be exactly the same, provided you're other training params also stay the same.

33 changes: 18 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
cloudpickle==2.0.0
commonmark==0.9.1
future==0.18.2
cloudpickle==2.2.1
future==0.18.3
hyperopt==0.2.7
joblib==1.1.0
networkx==2.7.1
numpy==1.22.3
pandas==1.4.1
py4j==0.10.9.5
Pygments==2.11.2
joblib==1.2.0
markdown-it-py==2.2.0
mdurl==0.1.2
networkx==3.1
numpy==1.24.2
pandas==2.0.0
py4j==0.10.9.7
Pygments==2.14.0
python-dateutil==2.8.2
pytz==2022.1
rich==12.0.1
scikit-learn==1.0.2
scikit-surprise==1.1.1
scipy==1.8.0
pytz==2023.3
rich==13.3.3
scikit-learn==1.2.2
scikit-surprise==1.1.3
scipy==1.10.1
six==1.16.0
threadpoolctl==3.1.0
tqdm==4.63.1
tqdm==4.65.0
typing-extensions==4.5.0
tzdata==2023.3

0 comments on commit 691fcd4

Please sign in to comment.