81
101

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

機械学習や統計学で使う主な確率分布一覧とpythonでのコード

Last updated at Posted at 2020-04-12

はじめに

機械学習では多数の確率分布を使いますが、それぞれの特徴などを覚えるのが大変なので、一覧でまとめてみました。

確率分布一覧

| 確率分布名 | 表記 | 確率(密度)関数 | 範囲 | パラメータ | 最頻値 | 分散 | pythonでの確率密度関数(もしくは確率質量関数)のコード |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
|ベルヌーイ | $B_r(q)$ | $q^x(1-q)^{1-x}$ | $x=0,1$ | $0\le q \le 1$ | $q$ | 0 or 1 | 0 or 1 | $q(1-q)$ | scipy.stats.bernoulli.pmf |
| ポアソン | $Po(\lambda)$ | $\Large\frac{\lambda^x e^{-\lambda}}{x!}$ | $x=0,1,2,...$ | $\lambda >0$ | $\lambda$ | - | $\lceil \lambda\rceil-1,\lfloor\lambda\rfloor$ | $\lambda$ | scipy.stats.poisson.pmf |
| 一様 | $U(a,b)$ | $\large\frac{1}{b-a}$ | $a\le x\le b$ | $-\infty<a<b<\infty$ | $\large\frac{b-a}{2}$ | $\large\frac{b-a}{2}$ | $[a,b]$ | $\large\frac{(b-a)^2}{12}$ | scipy.stats.uniform.pdf |
| ベータ | $Be(\alpha,\beta)$ | $\large\frac{x^{\alpha-1}(1-x)^{\beta-1}}{B(\alpha,\beta)}$ | $0\le x\le 1$ | $\alpha>0,\beta > 0$ | $\large\frac{\alpha}{\alpha + \beta}$ | - | $\large\frac{\alpha - 1}{\alpha + \beta - 2}$ | $\large\frac{\alpha\beta}{(\alpha + \beta)^2(\alpha + \beta + 1)}$ | scipy.stats.beta.pdf |
| 正規 | $N(\mu,\sigma^2)$ | ${\large\frac{1}{\sqrt{2\pi\sigma^2}}}\exp\left[-\frac{(x-\mu)^2}{2\sigma^2}\right]$ | $x\in \mathbb{R}$ | $\mu\in \mathbb{R},\sigma^2 > 0$ | $\mu$ | $\mu$ | $\mu$ | $\sigma^2$ | scipy.stats.norm.pdf |
| t | $T(\nu,\mu,\sigma^2)$ | $\frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)\sqrt{}\nu\pi\sigma^2}\left[1+\frac{(x-\mu)^2}{\nu\sigma^2}\right]^{-\frac{\nu+1}{2}}$ | $x\in \mathbb{R}$ | $\nu>0,\mu\in\mathbb{R},\sigma^2>0$ | $\mu$ | $\mu$ | $\mu$ | ${\large\frac{\nu}{\nu-2}}\sigma^2$ | scipy.stats.t.pdf |
| コーシー | $Ca(\mu,\sigma)$ | ${\large\frac{1}{\pi\sigma} }\left[ 1+ {\large\left(\frac{x-\mu}{\sigma}\right)}^2 \right]^{-1}$ | $x\in \mathbb{R}$ | $\mu\in \mathbb{R},\sigma > 0$ | $n.a.$ | $\mu$ | $\mu$ | $n.a.$ | scipy.stats.cauchy.pdf |
| ラプラス | $La(\mu,\sigma)$ | ${\large\frac{1}{2\sigma}} \exp \left[ -{\large\frac{|x-\mu|}{\sigma}} \right]$ | $x\in \mathbb{R}$ | $\mu\in \mathbb{R},\sigma > 0$ | $\mu$ | $\mu$ | $\mu$ | $2\sigma^2$ | scipy.stats.laplace.pdf |
| ガンマ | $Ga(\alpha,\beta)$ | ${\large\frac{\beta^{\alpha}}{\Gamma(\alpha)}}x^{\alpha-1}e^{-\beta x}$ | $x>0$ | $\alpha >0,\beta>0$ | ${\large\frac{\alpha}{\beta}}$ | - | ${\large\frac{\alpha-1}{\beta}}$ | ${\large\frac{\alpha}{\beta^2}}$ | scipy.stats.gamma.pdf |
| 逆ガンマ | $Ga^{-1}(\alpha,\beta)$ | ${\large\frac{\beta^{\alpha}}{\Gamma(\alpha)}}x^{-(\alpha+1)}e^{-\frac{\beta}{x}}$ | $x>0$ | $\alpha >0,\beta>0$ | ${\large\frac{\beta}{\alpha-1}}$ | - | ${\large\frac{\beta}{\alpha+1}}$ | ${\large\frac{\beta^2}{(\alpha-1)^2(\alpha-2)}}$ | scipy.stats.invgamma.pdf|
| カイ2乗 | $X^2(\nu)$ | $\frac{\left(\frac{1}{2}\right)^{\frac{\nu}{2}} }{\Gamma\left(\frac{\nu}{2}\right)}x^{\frac{\nu}{2}-1}e^{-\frac{x}{2}}$ | $x>0$ | $\nu>0$ | $\nu$ | - | $\nu-2$ | $2\nu$ | scipy.stats.chi2.pdf |
| 指数 | $\epsilon_{xp}(\lambda)$ | $\lambda e^{-\lambda x}$ | $x>0$ | $\lambda>0$ | ${\large\frac{1}{\lambda}}$ | ${\large\frac{\log{2}}{\lambda}}$ | 0 | ${\large\frac{1}{\lambda^2}}$ | scipy.stats.expon.pdf |
| 多変量正規 | $N_m({\bf\mu},{\bf\Sigma})$ | ${\large\frac{1}{(2\pi)^{\frac{m}{2}}\sqrt{|{\bf\Sigma}|}}} \exp \left[-\frac{1}{2}({\bf x}-{\bf \mu})^{\top}{\bf\Sigma}^{-1}({\bf x}-{\bf \mu})\right]$ | ${\bf x} \in\mathbb{R}^m$ | ${\bf\mu} \in\mathbb{R}^m,|{\bf\Sigma}|>0$ | ${\bf\mu}$ | - | ${\bf\mu}$ | ${\bf\Sigma}$ | scipy.stats.multivariate_normal.pdf |
| 多変量t | $T_m(\nu,{\bf\mu},{\bf\Sigma})$ | $\frac{\Gamma\left({\frac{\nu+m}{2}}\right)}{\Gamma\left({\frac{\nu}{2}}\right) (\pi\nu)^{\frac{m}{2}} |{\bf\Sigma}|^{\frac{1}{2}}} \left[ 1 + \frac{1}{\nu} (\textbf{x} - {\bf \mu})^{T} {\bf \Sigma}^{-1}(\textbf{x} - {\bf \mu})\right]^{\frac{-(\nu+m)}{2}}$ | ${\bf x} \in \mathbb{R}^m$ | $\nu>0,{\bf\mu} \in\mathbb{R}^m,|{\bf\Sigma}|>0$ | ${\bf\mu}$ | - | ${\bf\mu}$ | ${\large\frac{\nu}{\nu-2}}{\bf\Sigma}$ | (調査中。。) |

今後について

それぞれの分布についての説明などを追記・更新していきたいと思います。

改訂履歴

2020年4月12日 : 初版、タグ名修正
2020年4月15日 : リンク修正
2023年12月19日 : 現仕様に更新(テーブル構造が崩れました。。。)

参考文献

この記事は以下の情報を参考にして執筆しました。

81
101
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
81
101

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?