Try   HackMD
tags: MLCC

Logistic Regression 邏輯迴歸

Calculating a Probability

  • 有效率計算機率
  • 使用 (As is)機率,也就是二分類法,是或不是的概念

sigmoid function S型函數

  • 我們需要的輸出 y 為[0,1],就可以用此函數

  • 公式為

    y=1ez+1,如下圖
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • 輸入 z 後,輸出的 y 為 [0,1]
  • z=b+w1x1+w2x2+...+wnxn=log(y1y)

    • w 為 model 自學的權重 -> 特徵權重
    • b 是 bias
    • x 是 該 feature 的個數
    • z 也被視為 log-odd function,也就是 1的機率 / 0的機率

Loss and Regularization

  • (x,y)Dylog(y)(1y)log(1y)
    • (x,y)∈D => (x,y) 屬於已經有 label 的數據
    • y => 每一個 y 介在[0,1],從有 label 的數據中計算 logistic regression
    • y' => 每一個 y' 介在[0,1],從 x feature 的預測值

沒有正規化的後果

  • 如果沒有正規化就會變成單純拿最小 loss ,容易造成 overfitting
  • 如果沒有正規化,可能會導致每一個 feature 權重變成 -∞ 或 +∞
    • 因為有一些example只出現一次的feature / crossed feature / id
    • 當 data 有高維時,可能發生在 feature crosses 會出現

減少 model complexity 的常用方法 (2種)

  1. L2 regularization
  2. Early stopping 限制訓練時最大可以走幾步(就收斂) 或是 學習速率
  • L1 regularization (後面模板會提到)