Fix reproducibility warnings by adding explicit random parameters#2978
Fix reproducibility warnings by adding explicit random parameters#2978
Conversation
|
Performance benchmarks:
|
|
@quaquel is it now best-practice that we need to pass |
That is already how it's done. |
|
While I get where the design originates from, I find this very confusing for end-users. Especially from the concept of guided learning with easy entry and gracefully learning more powerful features (@tpike3 how do you always call that?). Adding a space is often one of the first things people do, and now they get a warning and they have to dive into random number generators and which parts of spaces have access to what model design. That's all unneeded complexity introduced too early to I get that we need the whole |
|
We debated this before while developing both the discrete space and the new experimental continuous space. From a learning perspective, I don't see the problem as long as the tutorials and examples always pass From an implementation point of view, I also don't know of a simple solution, apart from trying to get @properyt
def random:
try:
return getattr(self, "_random"
except AttribtueError:
# figure it out via agents
|
|
@quaquel code wise, is this good to go? |
| @@ -1,5 +1,6 @@ | |||
| """Test the backends of the visualization package.""" | |||
|
|
|||
| import random | |||
There was a problem hiding this comment.
Is this the right random that's imported?
Summary
Fixes
UserWarningabout missing random number generators in tests and examples by explicitly passingrandomparameters to grid constructors.Motive
Several tests were generating warnings that "Random number generator not specified, this can make models non-reproducible."
Implementation
Added explicit
randomparameter to all affected grid and cell constructors:random=self.randomto inherit model's RNGrandom=random.Random(42)for deterministic test behaviorUsage Examples
Part of #2904.