mxnet.np.random.gamma

gamma(shape, scale=1.0, size=None, dtype=None, device=None, out=None)

Draw samples from a Gamma distribution.

Samples are drawn from a Gamma distribution with specified parameters, shape (sometimes designated “k”) and scale (sometimes designated “theta”), where both parameters are > 0.

The Gamma distribution is often used to model the times to failure of electronic components, and arises naturally in processes for which the waiting times between Poisson distributed events are relevant.

Parameters
  • shape (float or array_like of floats) – The shape of the gamma distribution. Should be greater than zero.

  • scale (float or array_like of floats, optional) – The scale of the gamma distribution. Should be greater than zero. Default is equal to 1.

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

  • 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 shape and scale are both scalars. Otherwise, np.broadcast(shape, scale).size samples are drawn.

  • device (Device, optional) – Device context of output. Default is current device.

Returns

out – Drawn samples from the parameterized gamma distribution.

Return type

ndarray or scalar