Table Of Contents
Table Of Contents

mxnet.ndarray.random.poisson

mxnet.ndarray.random.poisson(lam=1, shape=_Null, dtype=_Null, ctx=None, out=None, **kwargs)[source]

Draw random samples from a Poisson distribution.

Samples are distributed according to a Poisson distribution parametrized by lambda (rate). Samples will always be returned as a floating point data type.

Parameters
  • lam (float or NDArray, optional) – Expectation of interval, should be >= 0.

  • shape (int or tuple of ints, optional) – The number of samples to draw. If shape is, e.g., (m, n) and lam is a scalar, output shape will be (m, n). If lam is an NDArray with shape, e.g., (x, y), then output will have shape (x, y, m, n), where m*n samples are drawn for each entry in lam.

  • dtype ({'float16', 'float32', 'float64'}, optional) – Data type of output samples. Default is ‘float32’

  • ctx (Context, optional) – Device context of output. Default is current context. Overridden by lam.context when lam is an NDArray.

  • out (NDArray, optional) – Store output to an existing NDArray.

Examples

>>> mx.nd.random.poisson(1)
[ 1.]
<NDArray 1 @cpu(0)>
>>> mx.nd.random.poisson(1, shape=(2,))
[ 0.  2.]
<NDArray 2 @cpu(0)>
>>> lam = mx.nd.array([1,2,3])
>>> mx.nd.random.poisson(lam, shape=2)
[[ 1.  3.]
 [ 3.  2.]
 [ 2.  3.]]
<NDArray 3x2 @cpu(0)>