graspologic icon indicating copy to clipboard operation
graspologic copied to clipboard

Add option to utilize numpy.random.Generator object in sample_edges

Open PerifanosPrometheus opened this issue 4 years ago • 3 comments

Issue:

Sample_edges utilizes numpy.random.RandomState, would be nice to be able to utilize a numpy.random.Generator object as well.

Solution:

Add option input to sample_edges that accepts a numpy.random.Generator object. If this input is provided then sample_edges should use the numpy.random.Generator object to sample from bernoulli.

References

numpy.random.Generator is the newly adopted pseudo-random number generator utilized and maintained by numpy. Check out here in the numpy doc the compatibility guarantee for numpy.random.RandomState which is what is currently being used.

PerifanosPrometheus avatar Dec 10 '20 06:12 PerifanosPrometheus

@bdpedigo I opened the new issue to add this feature.

Please let me know if it is still something desirable.

PerifanosPrometheus avatar Dec 10 '20 06:12 PerifanosPrometheus

issue looks good, are you planning on adding this to sample_edges somehow?

bdpedigo avatar Dec 10 '20 13:12 bdpedigo

Yes, my plan is to add as input the random.number.Generator to the sample_edges. If this input isn't given that function work as it is , if the input is given than use the provided object.

PerifanosPrometheus avatar Dec 11 '20 03:12 PerifanosPrometheus