-
Notifications
You must be signed in to change notification settings - Fork 271
Implement reproducible seeding #1288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e31b00d
a518d09
96cef67
59f156d
06255f3
bad199e
423b59f
af3c387
b2dc6cd
ca05063
5195f31
b910f94
5823a63
9ffc176
3ee324f
22491d7
d428499
35a5e3a
7669803
3caa9c7
e19ac93
059106c
9eac5a1
162814c
585148b
0d24c3e
84db8e9
28f7e82
77a7587
8615f1d
d784afe
a39a78b
be374ac
2cf50b6
13437ce
9f2a967
7983d93
cec3538
2f6b43b
f124448
4d5fee0
5d1cff0
d9d95a0
f0e0713
9c6da82
e308d21
eaf2d79
7811434
8a6930f
add852f
1363ea5
ca78119
fef4a40
02ecf68
14ba128
69ac7f4
28419c6
e6f18f3
f7e0b88
a796a2b
559f35b
637c59b
9e47ce3
950f1a5
d8b1c75
6987307
5897fdb
83b6db8
fa2ca0c
7b503ac
a8e6469
b9a0d30
fde9e4f
dc1d867
c4a7dac
a2d2826
5ec9b70
c196545
50a0735
b156230
b396f0d
79c3097
e42041e
1810617
1c2a8a8
d0859ab
47b1871
c3a0786
61f2c0e
9b2efb3
5128e4d
e9bb9ce
44bc97d
19b36f7
750f73c
ea2599d
c725138
e43d76a
693de4f
7ef70e1
40d9cb7
9ea9f98
f8821fc
398052a
2fad16a
dcd9d92
08987ae
c547b56
853b652
2e0e663
761f887
1fd9dd6
7c233a7
96c3352
3eac7c2
c37fd74
23b1d50
1e4ee69
7163497
57d4034
b0e00fe
11a6f1c
23a7cf4
82a22ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,18 @@ | |
|
||
# The order of imports matters! | ||
from axelrod.version import __version__ | ||
from axelrod.action import Action | ||
from axelrod.random_ import Pdf, RandomGenerator, BulkRandomGenerator | ||
|
||
# Initialize module level Random | ||
# This is initially seeded by the clock / OS entropy pool | ||
# It is not used if user specifies seeds everywhere and should only be | ||
# used internally by the library and in certain tests that need to set | ||
# its seed. | ||
_module_random = RandomGenerator() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the rational of calling this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't think much about the name, we can change it. The idea was that it's a "module level" RNG and so reproducibility wouldn't be guaranteed. But I think we could also probably eliminate it altogether, if we're willing to toss a few more warnings / exceptions at the user. The biggest issue in that case is instantiating evolvable players with insufficient parameters (for random initialization). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out we can remove the need for a seed from the current filter test and it still works. |
||
|
||
from axelrod.load_data_ import load_pso_tables, load_weights | ||
from axelrod import graph | ||
from axelrod.action import Action | ||
from axelrod.random_ import random_choice, random_flip, seed, Pdf | ||
from axelrod.plot import Plot | ||
from axelrod.game import DefaultGame, Game | ||
from axelrod.history import History, LimitedHistory | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have
hypothesis
inrequirements.txt
(and specifically excluded fromsetup.py
: https://github.com/Axelrod-Python/Axelrod/blob/master/setup.py#L4). Should we do the same withcoverage
,mypy
,isort
? (Just do be consistent.)(Happy for this to be done in a later PR - just a thought.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. It would be good to also have a "presubmit" script to run isort, mypy, etc. locally in line with config.yml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #1360