mardi 31 octobre 2017

Using `numpy.random.randint()` for another distribution, only one input

I think I am misunderstanding something, so hopefully someone on this forum can straighten me out. I have an array foo. Based on the length of the array, I am drawing random numbers from a discrete Uniform distribution:

import numpy as np 
random_draw = np.random.randint(length(foo))

which draws a random integer from [0, length(foo)]

What would be the equivalent for another distribution, e.g. a Gaussian or Poisson? I believe certain distributions which require several parameters would not be feasible with this approach.

The idea would be to only provide this input length(foo) to draw from this distribution. In the case of Gaussian, perhaps mean=length(foo)/2 and standard deviation np.std(length(foo))?




Aucun commentaire:

Enregistrer un commentaire