econ-ark / HARK

Heterogenous Agents Resources & toolKit
Apache License 2.0
315 stars 195 forks source link

We should not use both `seed` and `RNG`. #1381

Open alanlujan91 opened 3 months ago

alanlujan91 commented 3 months ago

We should only expose publicly the seed variable, which internally sets the RNG. The user should never have to create or pass an RNG object, and should never have to use the RNG object directly.

Additionally, recommended seeds are huge strings or numbers, so we should not be using 12345 or the like to set the RNG.

alanlujan91 commented 3 months ago

For inspiration https://blog.scientific-python.org/numpy/numpy-rng/

llorracc commented 3 months ago

How about

314159265358979323846

?

I’m guessing that it’s not so much that “small seeds” are deprecated, as it is seeds that might be commonly chosen, like the first x digits of pi?

From: Alan Lujan @.> Date: Wednesday, February 7, 2024 at 08:43 To: econ-ark/HARK @.> Cc: Subscribed @.***> Subject: [econ-ark/HARK] We should not use both seed and RNG. (Issue #1381)

We should only expose publicly the seed variable, which internally sets the RNG. The user should never have to create or pass an RNG object, and should never have to use the RNG object directly.

Additionally, recommended seeds are huge strings or numbers, so we should not be using 12345 or the like to set the RNG.

— Reply to this email directly, view it on GitHubhttps://github.com/econ-ark/HARK/issues/1381, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKCK76HJ5MVCD7YNQE6QJ3YSOAILAVCNFSM6AAAAABC53LGUWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZDGMBXGE3DGOI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sbenthall commented 3 months ago

Yes, I agree, better discipline around this would be good. We must keep it in mind as we refactor. It is also something that we will need to think about for the DSL design.

llorracc commented 3 months ago

Actually, my fairly strong preference is to use the date at which you choose the seed as the seed itself:

date +%Y%m%d%H%M%S

That way you can always decode when it was that you most recently set up the seed without having to explore github history.

On Wed, Feb 7, 2024 at 8:57 AM Christopher Carroll @.***> wrote:

How about

314159265358979323846

?

I’m guessing that it’s not so much that “small seeds” are deprecated, as it is seeds that might be commonly chosen, like the first x digits of pi?

From: Alan Lujan @.> Date: Wednesday, February 7, 2024 at 08:43 To: econ-ark/HARK @.> Cc: Subscribed @.**> Subject: *[econ-ark/HARK] We should not use both seed and RNG. (Issue #1381)

We should only expose publicly the seed variable, which internally sets the RNG. The user should never have to create or pass an RNG object, and should never have to use the RNG object directly.

Additionally, recommended seeds are huge strings or numbers, so we should not be using 12345 or the like to set the RNG.

— Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/1381, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKCK76HJ5MVCD7YNQE6QJ3YSOAILAVCNFSM6AAAAABC53LGUWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZDGMBXGE3DGOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--