Re: [Numpy-discussion] reseed random generator (1.19)

2020-07-04 Thread Robert Kern
On Sat, Jul 4, 2020, 2:39 PM Neal Becker wrote: > > > On Sat, Jul 4, 2020 at 1:56 PM Robert Kern wrote: > > >> >> 3. Is there a way of telling the number of draws a generator did? >>> >>> The use case is to checkpoint the number of draws and `.advance` the >>> bit generator when resuming fr

Re: [Numpy-discussion] reseed random generator (1.19)

2020-07-04 Thread Neal Becker
On Sat, Jul 4, 2020 at 1:56 PM Robert Kern wrote: > > 3. Is there a way of telling the number of draws a generator did? >> >> The use case is to checkpoint the number of draws and `.advance` the >> bit generator when resuming from the checkpoint. (The runs are longer >> then the batch queue

Re: [Numpy-discussion] reseed random generator (1.19)

2020-07-04 Thread Robert Kern
On Sat, Jul 4, 2020 at 1:03 PM Evgeni Burovski wrote: > Thanks Kevin, thanks Robert, this is very helpful! > > I'd strongly agree with Matti that your explanations could/should make > it to the docs. Maybe it's something for the GSoD. > > While we're on the subject, one comment and two (hopefully

Re: [Numpy-discussion] reseed random generator (1.19)

2020-07-04 Thread Evgeni Burovski
Thanks Kevin, thanks Robert, this is very helpful! I'd strongly agree with Matti that your explanations could/should make it to the docs. Maybe it's something for the GSoD. While we're on the subject, one comment and two (hopefully last) questions: 1. My two cents w.r.t. `np.random.simple_seed()

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 11:30 AM Robert Kern wrote: > On Mon, Jun 29, 2020 at 11:10 AM Kevin Sheppard < > kevin.k.shepp...@gmail.com> wrote: > >> >>1. The total number of digits in the binary representation is >>somewhere between 32 and 128. >> >> > I like using the standard library `secr

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 11:10 AM Kevin Sheppard wrote: > It can be anything, but “good practice” is to use a number that would have > 2 properties: > > > >1. When expressed as binary number, it would have a large number of >both 0s and 1s > > The properties of the SeedSequence algorithm r

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
]> > > > Kevin> > > > > > From: Evgeni Burovski> Sent: Monday, June 29, 2020 2:21 PM> To: Discussion of Numerical Python> Subject: Re: [Numpy-discussion] reseed random generator (1.19)> > > > (apologies for jumping into a conversation)> > So what

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Evgeni Burovski
gt; > > Kevin > > > > > > From: Evgeni Burovski > Sent: Monday, June 29, 2020 2:21 PM > To: Discussion of Numerical Python > Subject: Re: [Numpy-discussion] reseed random generator (1.19) > > > > (apologies for jumping into a conversation) > > So what i

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Robert Kern
On Mon, Jun 29, 2020 at 8:02 AM Neal Becker wrote: > I was using this to reset the generator, in order to repeat the same > sequence again for testing purposes. > In general, you should just pass in a new Generator that was created with the same seed. def function_to_test(rg): x = rg.standa

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Matti Picus
On 6/29/20 5:37 PM, Kevin Sheppard wrote: The best practice is to use a SeedSequence to spawn child SeedSequences, and then to use these children to initialize your generators or bit generators.  

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
needs to be wrapped in a generatorrngs = [Generator(PCG64(child)) for child in children] Kevin  From: Evgeni BurovskiSent: Monday, June 29, 2020 2:21 PMTo: Discussion of Numerical PythonSubject: Re: [Numpy-discussion] reseed random generator (1.19) (apologies for jumping into a conversation)So what

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Evgeni Burovski
y reseeding. > > > > Kevin > > > > > > > > From: Neal Becker > Sent: Monday, June 29, 2020 1:01 PM > To: Discussion of Numerical Python > Subject: Re: [Numpy-discussion] reseed random generator (1.19) > > > > I was using this to reset the g

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Kevin Sheppard
just create a new object. At some point in the development of Generator both methods were timed and there was no performance to reusing the same object by reseeding. Kevin   From: Neal BeckerSent: Monday, June 29, 2020 1:01 PMTo: Discussion of Numerical PythonSubject: Re: [Numpy-discussion] reseed

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-29 Thread Neal Becker
I was using this to reset the generator, in order to repeat the same sequence again for testing purposes. On Wed, Jun 24, 2020 at 6:40 PM Robert Kern wrote: > On Wed, Jun 24, 2020 at 3:31 PM Neal Becker wrote: > >> Consider the following: >> >> from numpy.random import default_rng >> rs = defau

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-24 Thread Robert Kern
On Wed, Jun 24, 2020 at 3:31 PM Neal Becker wrote: > Consider the following: > > from numpy.random import default_rng > rs = default_rng() > > Now how do I re-seed the generator? > I thought perhaps rs.bit_generator.seed(), but there is no such attribute. > In general, reseeding an existing gene

Re: [Numpy-discussion] reseed random generator (1.19)

2020-06-24 Thread Kevin Sheppard
Just call rs = default_rng() Again. On Wed, Jun 24, 2020, 20:31 Neal Becker wrote: > Consider the following: > > from numpy.random import default_rng > rs = default_rng() > > Now how do I re-seed the generator? > I thought perhaps rs.bit_generator.seed(), but there is no such attribute. > >

[Numpy-discussion] reseed random generator (1.19)

2020-06-24 Thread Neal Becker
Consider the following: from numpy.random import default_rng rs = default_rng() Now how do I re-seed the generator? I thought perhaps rs.bit_generator.seed(), but there is no such attribute. Thanks, Neal -- *Those who don't understand recursion are doomed to repeat it*