恭喜你!

Generalized Linear Models in Python

Ita Cirovic Donev

Data Science Consultant

模型

  • 資料 $\rightarrow$
  • 連結函式 $\rightarrow$
  • 模型 $\rightarrow$
  • $x$ 增加 1 單位 $\rightarrow$

邏輯斯回歸

  • 二元
  • Logit
  • $logit(y) = \beta_0+\beta_1x_1$
  • 使 $\color{red}{\text{對數勝算}}$ 增加 $\beta_1$

線性模型

  • 連續
  • 恒等
  • $y = \beta_0+\beta_1x_1$
  • 使 $\color{red}{y}$ 增加 $\beta_1$

卜瓦松回歸

  • 計數
  • 對數
  • $log(\lambda) = \beta_0+\beta_1x_1$
  • 將 $\color{red}{\text{\lambda 乘上}}$ $exp(\beta_1)$
Generalized Linear Models in Python

主要 Python 函式

  • 擬合模型
    statmodels $\rightarrow$

線性模型

glm('y ~ x', data)
glm('y ~ x', data, 
    family = sm.families.Gaussian())

邏輯斯回歸

glm('y ~ x', data, 
    family = sm.families.Binomial())

卜瓦松回歸

glm('y ~ x', data, 
    family = sm.families.Poisson())
Generalized Linear Models in Python

下一步…

  • DataCamp 課程
  • 精采參考書
    • Frank E. Harrell, Jr. 著:Regression Modeling Strategies
    • Alan Agresti 著:An Introduction to Categorical Data Analysis
    • Max Kuhn、Kjell Johnson 著:Applied Predictive Modeling
Generalized Linear Models in Python

建模順利!

Generalized Linear Models in Python

Preparing Video For Download...