jax.random.poisson#

jax.random.poisson(key, lam, shape=None, dtype=<class 'int'>)[source]#

採樣具有給定形狀和整數 dtype 的 Poisson 隨機值。

這些值根據機率質量函數分佈

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

其中 k 是一個非負整數,\(\lambda > 0\)

參數:
  • key (ArrayLike) – 用作隨機金鑰的 PRNG 金鑰。

  • lam (RealArray) – 率參數(分佈的平均值),必須 >= 0。必須與 shape 廣播相容

  • shape (Shape | None | None) – 選項,一個表示結果形狀的非負整數元組。預設 (None) 產生的結果形狀等於 lam.shape

  • dtype (DTypeLikeInt) – 選項,返回值的整數 dtype(如果 jax_enable_x64 為 true,則預設為 int64,否則為 int32)。

返回值:

一個具有指定 dtype 和形狀的隨機陣列,如果 shape 不是 None,則形狀由 shape 給定,否則由 lam.shape 給定。

返回類型:

Array