List of main probability distributions used in machine learning and statistics and code in python

Introduction

Machine learning uses a large number of probability distributions, but it is difficult to remember the characteristics of each, so I summarized them in a list.

Probability distribution list

Probability distribution name      Notation Probability (density) function range Parameters average Median Mode Distributed Code of probability density function (or probability mass function) in python
Bernoulli 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
Poisson 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
Uniform U(a,b) \large\frac{1}{b-a} a\le x\le b -\infty \large\frac{b-a}{2} \large\frac{b-a}{2} [a,b] \large\frac{(b-a)^2}{12} scipy.stats.uniform.pdf
beta 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
regular 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
Cauchy 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
Laplace 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
gamma 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
Inverse gamma 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
Kai squared 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
index \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
Multivariate normal 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
Multivariate 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} (investigating..)

About the future

I would like to add and update the explanation of each distribution.

Revision history

April 12, 2020: First edition, tag name correction April 15, 2020: Link correction

References

This article was written with reference to the following information.

-Introduction to Bayesian Statistics with Python

Recommended Posts

List of main probability distributions used in machine learning and statistics and code in python
List of Python code used in big data analysis
[python] Frequently used techniques in machine learning
[Machine learning] List of frequently used packages
Summary of probability distributions that often appear in statistics and data analysis
Python: Preprocessing in machine learning: Handling of missing, outlier, and imbalanced data
Full disclosure of methods used in machine learning
Summary of evaluation functions used in machine learning
Get a glimpse of machine learning in Python
List of Python code to move and remember
Mayungo's Python Learning Note: List of stories and links
A collection of code often used in personal Python
Used in machine learning EDA
The result of Java engineers learning machine learning in Python www
Decrypt one line of code in Python lambda, map, list
Spit out a list of file name, last modified date and character code in python3
Difference between list () and [] in Python
Significance of machine learning and mini-batch learning
Classification and regression in machine learning
Python: Preprocessing in Machine Learning: Overview
Coursera Machine Learning Challenges in Python: ex5 (Adjustment of Regularization Parameters)
List of Linear Programming (LP) solvers and modelers available in Python
Installation of Visual studio code and installation of python
Paiza Skill Check List of Frequently Used D and C Ranks ~ Python ~
[Linux] List of Linux commands used in practice
Display a list of alphabets in Python 3
Difference between append and + = in Python list
Python: Preprocessing in machine learning: Data acquisition
Source code of sound source separation (machine learning practice series) learned with Python
Python and machine learning environment construction (macOS)
Summary of built-in methods in Python list
[Python] Saving learning results (models) in machine learning
Python: Preprocessing in machine learning: Data conversion
Get the EDINET code list in Python
Project Euler # 1 "Multiples of 3 and 5" in Python
plot the coordinates of the processing (python) list and specify the number of times in draw ()
[Basics of modern mathematical statistics with python] Chapter 2: Probability distribution and expected value
A memorandum of method often used in machine learning using scikit-learn (for beginners)
Study machine learning and computer science. Resource list
[Python] Sort the list of pathlib.Path in natural sort
Python & Machine Learning Study Memo ⑤: Classification of irises
List of frequently used built-in functions and methods
Numerai Tournament-Fusion of Traditional Quants and Machine Learning-
Python & Machine Learning Study Memo ②: Introduction of Library
Make a copy of the list in Python
List of links that machine learning beginners are learning
Links and memos of Python character code strings
Code often used in Python / Django apps [prefectures]
Explanation of edit distance and implementation in Python
The first step for those who are amateurs of statistics but want to implement machine learning models in Python
Simple code that gives a score of 0.81339 in Kaggle's Titanic: Machine Learning from Disaster
I compared the speed of the reference of the python in list and the reference of the dictionary comprehension made from the in list.
"Linear regression" and "Probabilistic version of linear regression" in Python "Bayesian linear regression"
Full-width and half-width processing of CSV data in Python
Build an interactive environment for machine learning in Python
Calculation of standard deviation and correlation coefficient in Python
Implemented List and Bool in Python and SQLite3 (personal note)
List of Python libraries for data scientists and data engineers
Tool MALSS (application) that supports machine learning in Python
Machine learning python code summary (updated from time to time)
Coursera Machine Learning Challenges in Python: ex2 (Logistic Regression)