cupy.random.dirichlet#

cupy.random.dirichlet(alpha, size=None, dtype=<class 'float'>)[source]#

Dirichlet distribution.

Returns an array of samples drawn from the dirichlet distribution. Its probability density function is defined as

\[f(x) = \frac{\Gamma(\sum_{i=1}^K\alpha_i)} {\prod_{i=1}^{K}\Gamma(\alpha_i)} \prod_{i=1}^Kx_i^{\alpha_i-1}.\]
Parameters:
  • alpha (array) – Parameters of the dirichlet distribution \(\alpha\).

  • size (int or tuple of ints) – The shape of the array. If None, a zero-dimensional array is generated.

  • dtype – Data type specifier. Only numpy.float32 and numpy.float64 types are allowed.

Returns:

Samples drawn from the dirichlet distribution.

Return type:

cupy.ndarray