深度學習必懂的13種機率分佈

導讀:作為機器學習從業者,你需要知道機率分佈相關的知識。這裡有一份最常見的基本機率分佈教程,大多數和使用 Python 庫進行深度學習有關。
來源:AI開發者
原文連結:
https://github.com/graykode/distribution-is-all-you-need
機率分佈概述:
  • 共軛意味著它有共軛分佈的關係。
    在貝葉斯機率論中,如果後驗分佈 p(θx)與先驗機率分佈 p(θ)在同一機率分佈族中,則先驗和後驗稱為共軛分佈,先驗稱為似然函式的共軛先驗。共軛先驗維基百科在這裡
    https://en.wikipedia.org/wiki/Conjugate_prior
  • 多分類表示隨機方差大於 2。


  • n 次意味著我們也考慮了先驗機率 p(x)。


  • 為了進一步瞭解機率,我建議閱讀 [pattern recognition and machine learning,Bishop 2006]。
分佈機率與特徵:
01 均勻分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/uniform.py
均勻分佈在 [a,b] 上具有相同的機率值,是簡單機率分佈。
02 伯努利分佈(離散)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/bernoulli.py 
  • 先驗機率 p(x)不考慮伯努利分佈。因此,如果我們對最大似然進行最佳化,那麼我們很容易被過度擬合。


  • 利用二元交叉熵對二項分類進行分類。它的形式與伯努利分佈的負對數相同。
03 二項分佈(離散)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/binomial.py
  • 引數為 n 和 p 的二項分佈是一系列 n 個獨立實驗中成功次數的離散機率分佈。


  • 二項式分佈是指透過指定要提前挑選的數量而考慮先驗機率的分佈。
04 多伯努利分佈,分類分佈(離散)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/categorical.py 
  • 多伯努利稱為分類分佈。


  • 交叉熵和採取負對數的多伯努利分佈具有相同的形式。
05 多項式分佈(離散)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/multinomial.py 
多項式分佈與分類分佈的關係與伯努爾分佈與二項分佈的關係相同。
06 β分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/beta.py 
  • β分佈與二項分佈和伯努利分佈共軛。


  • 利用共軛,利用已知的先驗分佈可以更容易地得到後驗分佈。


  • 當β分佈滿足特殊情況(α=1,β=1)時,均勻分佈是相同的。


07 Dirichlet 分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/dirichlet.py 
  • dirichlet 分佈與多項式分佈是共軛的。


  • 如果 k=2,則為β分佈。


08 伽馬分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/gamma.py 
  • 如果 gamma(a,1)/gamma(a,1)+gamma(b,1)與 beta(a,b)相同,則 gamma 分佈為β分佈。


  • 指數分佈和卡方分佈是伽馬分佈的特例。


09 指數分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/exponential.py 
指數分佈是 α 為 1 時 γ 分佈的特例。
10 高斯分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/gaussian.py 

高斯分佈是一種非常常見的連續機率分佈。


11 正態分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/normal.py 

正態分佈為標準高斯分佈,平均值為 0,標準差為 1。


12 卡方分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/chi-squared.py 
  • k 自由度的卡方分佈是 k 個獨立標準正態隨機變數的平方和的分佈。


  • 卡方分佈是 β 分佈的特例


13 t 分佈(連續)
  • 程式碼:
    https://github.com/graykode/distribution-is-all-you-need/blob/master/student-t.py 
t 分佈是對稱的鐘形分佈,與正態分佈類似,但尾部較重,這意味著它更容易產生遠低於平均值的值。
延伸閱讀👇
延伸閱讀《神經網路與深度學習》


相關文章