จะสร้าง GLM อย่างไร?

Generalized Linear Models ใน Python

Ita Cirovic Donev

Data Science Consultant

องค์ประกอบของ GLM

การแสดงสูตรสำหรับ random component

Generalized Linear Models ใน Python

องค์ประกอบของ GLM

การแสดงสูตรสำหรับ random component และ systematic component

Generalized Linear Models ใน Python

องค์ประกอบของ GLM

การแสดงสูตรสำหรับ random component และ systematic component พร้อมภาพประกอบ interaction effect

Generalized Linear Models ใน Python

องค์ประกอบของ GLM

การแสดงสูตรสำหรับ random component และ systematic component พร้อมภาพประกอบ interaction effect และ curvilinear effect

Generalized Linear Models ใน Python

องค์ประกอบของ GLM

การแสดงสูตรสำหรับ random component, systematic component และ link function

Generalized Linear Models ใน Python

ต่อเนื่อง $\rightarrow$ Linear Regression

กราฟการแจกแจงของตัวแปรสุ่มแบบต่อเนื่อง

ประเภทข้อมูล: ต่อเนื่อง
โดเมน: $(-\infty,\infty)$
ตัวอย่าง: ราคาบ้าน, เงินเดือน, ส่วนสูง

Family: Gaussian()
Link: identity
$g(\mu) = \mu = E(y)$

โมเดล = Linear regression

Generalized Linear Models ใน Python

ไบนารี $\rightarrow$ Logistic regression

กราฟการแจกแจงของตัวแปรสุ่มแบบไบนารี

ประเภทข้อมูล: ไบนารี
โดเมน: $0,1$
ตัวอย่าง: True/False

Family: Binomial()
Link: logit

โมเดล = Logistic regression

Generalized Linear Models ใน Python

นับ $\rightarrow$ Poisson regression

กราฟการแจกแจงของข้อมูลแบบนับ

ประเภทข้อมูล: นับ
โดเมน: $0, 1, 2, ..., \infty$
ตัวอย่าง: จำนวนคะแนนเสียง, จำนวนพายุเฮอริเคน

Family: Poisson()
Link: logarithm

โมเดล = Poisson regression

Generalized Linear Models ใน Python

Link function

การแจกแจง Link: $\eta=g(\mu)$ Link เริ่มต้น glm(family=...)
Normal $\eta = \mu$ identity Gaussian()
Poisson $\eta = log(\mu)$ logarithm Poisson()
Binomial $\eta = log[p/(1-p)]$ logit Binomial()
Gamma $\eta = 1/\mu$ inverse Gamma()
Inverse Gaussian $\eta = 1/\mu^2$ inverse squared InverseGaussian()
Generalized Linear Models ใน Python

ข้อดีของ GLM

  • กรอบการทำงานเดียวรองรับการแจกแจงข้อมูลได้หลายรูปแบบ
    • Exponential family of distributions
  • Link function
    • แปลงค่าคาดหวังของ y
    • ช่วยให้ใช้การรวมเชิงเส้นได้
    • เทคนิคจาก linear model หลายอย่างใช้กับ GLM ได้เช่นกัน
Generalized Linear Models ใน Python

มาฝึกกันเถอะ!

Generalized Linear Models ใน Python

Preparing Video For Download...