dask 2021.10.0

NotesParametersReturns
poisson(self, lam=1.0, size=None, chunks='auto', **kwargs)

This docstring was copied from numpy.random.mtrand.RandomState.poisson.

Some inconsistencies with the Dask version may exist.

The Poisson distribution is the limit of the binomial distribution for large N.

note

New code should use the poisson method of a default_rng() instance instead; please see the :None:ref:`random-quick-start`.

Notes

The Poisson distribution

$$f(k; \lambda)=\frac{\lambda^k e^{-\lambda}}{k!}$$

For events with an expected separation $\lambda$ the Poisson distribution $f(k; \lambda)$ describes the probability of $k$ events occurring within the observed interval $\lambda$ .

Because the output is limited to the range of the C int64 type, a ValueError is raised when :None:None:`lam` is within 10 sigma of the maximum representable value.

Parameters

lam : float or array_like of floats

Expected number of events occurring in a fixed-time interval, must be >= 0. A sequence must be broadcastable over the requested size.

size : int or tuple of ints, optional

Output shape. If the given shape is, e.g., (m, n, k) , then m * n * k samples are drawn. If size is None (default), a single value is returned if lam is a scalar. Otherwise, np.array(lam).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized Poisson distribution.

Draw samples from a Poisson distribution.

See Also

Generator.poisson

which should be used for new code.

Examples

Draw samples from the distribution:

This example is valid syntax, but we were not able to check execution
>>> import numpy as np  # doctest: +SKIP
... s = np.random.poisson(5, 10000) # doctest: +SKIP

Display histogram of the sample:

This example is valid syntax, but we were not able to check execution
>>> import matplotlib.pyplot as plt  # doctest: +SKIP
... count, bins, ignored = plt.hist(s, 14, density=True) # doctest: +SKIP
... plt.show() # doctest: +SKIP

Draw each 100 values for lambda 100 and 500:

This example is valid syntax, but we were not able to check execution
>>> s = np.random.poisson(lam=(100., 500.), size=(100, 2))  # doctest: +SKIP
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/random.py#369
type: <class 'function'>
Commit: