method
RandomState.poisson(lam=1.0, size=None)
Draw samples from a Poisson distribution.
The Poisson distribution is the limit of the binomial distribution for large N.
Parameters: |
|
---|---|
Returns: |
|
The Poisson distribution
For events with an expected separation the Poisson distribution describes the probability of events occurring within the observed interval .
Because the output is limited to the range of the C int64 type, a ValueError is raised when lam
is within 10 sigma of the maximum representable value.
[1] | Weisstein, Eric W. “Poisson Distribution.” From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/PoissonDistribution.html |
[2] | Wikipedia, “Poisson distribution”, https://en.wikipedia.org/wiki/Poisson_distribution |
Draw samples from the distribution:
>>> import numpy as np >>> s = np.random.poisson(5, 10000)
Display histogram of the sample:
>>> import matplotlib.pyplot as plt >>> count, bins, ignored = plt.hist(s, 14, density=True) >>> plt.show()
Draw each 100 values for lambda 100 and 500:
>>> s = np.random.poisson(lam=(100., 500.), size=(100, 2))
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/random/generated/numpy.random.mtrand.RandomState.poisson.html