jeudi 1 octobre 2020

What's the difference between numpy.random vs numpy.random.Generate

I've been trying to simulate some Monte Carlos simulations lately and came across numpy.random. Checking the documentation of the exponential generator I've noticed that that's a warning in the page, which tells that

Generator.exponential should be used for new code.

Althought that, numpy.random.exponential still works, but I couldn't run the Generate counterpart. I've been getting the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-c4cc7e61aa98> in <module>
----> 1 np.random.Generator.exponential(2, 1000)

TypeError: descriptor 'exponential' for 'numpy.random._generator.Generator' objects doesn't apply to a 'int' object

My questions are:

  1. What's the difference between these 2?

  2. How to generate a sample with Generate?




Aucun commentaire:

Enregistrer un commentaire