Chương 3: Hồi qui dữ liệu -...

52
1 Ch Ch ươ ươ ng ng 3: 3: Hi Hi qui qui ddliu liu Hck1 – 2011-2012 Khoa Khoa Khoa Khoa Hc Hc & & KKThut Thut Máy Máy Tính Tính Tr Tr ư ư ng ng Đ Đ i i Hc Hc Bách Bách Khoa Khoa Tp Tp . . HHChí Chí Minh Minh Cao Cao Hc Hc Ngành Ngành Khoa Khoa Hc Hc Máy Máy Tính Tính Giáo Giáo trình trình đ đ in in ttBiên Biên son son bi bi : TS. : TS. ThThNgc Ngc Châu Châu ( ( [email protected] [email protected] ) )

Transcript of Chương 3: Hồi qui dữ liệu -...

Page 1: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

1

1

ChChươươngng 3: 3: HồiHồi qui qui dữdữ liệuliệu

Học kỳ 1 – 2011-2012

KhoaKhoa KhoaKhoa HọcHọc & & KỹKỹ ThuậtThuật MáyMáy TínhTínhTrTrưườngờng ĐĐạiại HọcHọc BáchBách KhoaKhoa TpTp. . HồHồ ChíChí MinhMinh

CaoCao HọcHọc NgànhNgành KhoaKhoa HọcHọc MáyMáy TínhTính

GiáoGiáo trìnhtrình đđiệniện tửtử

BiênBiên soạnsoạn bởibởi: TS. : TS. VõVõ ThịThị NgọcNgọc ChâuChâu

(([email protected]@cse.hcmut.edu.vn))

Page 2: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

2

2

Tài liệu tham khảo[1] Jiawei Han, Micheline Kamber, “Data Mining: Concepts and Techniques”, Second Edition, Morgan Kaufmann Publishers, 2006.[2] David Hand, Heikki Mannila, Padhraic Smyth, “Principles of Data Mining”, MIT Press, 2001.[3] David L. Olson, Dursun Delen, “Advanced Data Mining Techniques”, Springer-Verlag, 2008.[4] Graham J. Williams, Simeon J. Simoff, “Data Mining: Theory, Methodology, Techniques, and Applications”, Springer-Verlag, 2006.[5] Hillol Kargupta, Jiawei Han, Philip S. Yu, Rajeev Motwani, and Vipin Kumar, “Next Generation of Data Mining”, Taylor & Francis Group, LLC, 2009.[6] Daniel T. Larose, “Data mining methods and models”, John Wiley & Sons, Inc, 2006.[7] Ian H.Witten, Eibe Frank, “Data mining : practical machine learning tools and techniques”, Second Edition, Elsevier Inc, 2005. [8] Florent Messeglia, Pascal Poncelet & Maguelonne Teisseire, “Successes and new directions in data mining”, IGI Global, 2008.[9] Oded Maimon, Lior Rokach, “Data Mining and Knowledge Discovery Handbook”, Second Edition, Springer Science + BusinessMedia, LLC 2005, 2010.

Page 3: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

3

3

Nội dungChương 1: Tổng quan về khai phá dữ liệuChương 2: Các vấn đề tiền xử lý dữ liệuChương 3: Hồi qui dữ liệuChương 4: Phân loại dữ liệuChương 5: Gom cụm dữ liệuChương 6: Luật kết hợpChương 7: Khai phá dữ liệu và công nghệ cơ sở dữliệuChương 8: Ứng dụng khai phá dữ liệuChương 9: Các đề tài nghiên cứu trong khai phá dữliệuChương 10: Ôn tập

Page 4: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

4

4

Chương 3: Hồi qui dữ liệu

3.1. Tổng quan về hồi qui

3.2. Hồi qui tuyến tính

3.3. Hồi qui phi tuyến

3.4. Ứng dụng

3.5. Các vấn đề với hồi qui

3.6. Tóm tắt

Page 5: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

5

5

3.0. Tình huống 1Ngày mai giá cổ phiếu STB sẽ làbao nhiêu???

Page 6: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

6

6

3.0. Tình huống 2

x

y

y = x + 1

X1

Y1

Y1’

Mô hình phân bố dữ liệu của y theo x???

Page 7: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

7

7

3.0. Tình huống 3Bài toán phân tích giỏ hàng thịtrường (market basket analysis)

sự kết hợp giữa các mặt hàng?

Page 8: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

8

8

3.0. Tình huống 4

Khảo sát các yếu tố tác động đến xu hướngsử dụng quảng cáo trực tuyến tại Việt Nam

Sự giải trí cảm nhận (+0.209)Chất lượng thông tin (+0.261)Chất lượng thông tin cảm nhận (+0.199)Sự khó chịu cảm nhận (-0.175)Sự tin cậy cảm nhậnThái độ về tính riêng tưSự tương tác (+0.373)Chuẩn chủ quan (+0.254)Nhận thức kiểm soát hành vi (+0.377)

Page 9: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

9

9

3.0. Tình huống …

Hồi qui (regression)

Khai phá dữ liệu có tính dự báo (Predictive data mining)

Tình huống ???

Khai phá dữ liệu có tính mô tả (Descriptive data mining)

Tình huống ???

Page 10: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

10

10

3.1. Tổng quan về hồi quiĐịnh nghĩa - Hồi qui (regression)

J. Han et al (2001, 2006): Hồi qui là kỹ thuật thốngkê cho phép dự đoán các trị (số) liên tục.

Wiki (2009): Hồi qui (Phân tích hồi qui – regression analysis) là kỹ thuật thống kê cho phép ước lượngcác mối liên kết giữa các biến

R. D. Snee (1977): Hồi qui (Phân tích hồi qui) là kỹthuật thống kê trong lĩnh vực phân tích dữ liệu vàxây dựng các mô hình từ thực nghiệm, cho phépmô hình hồi qui vừa được khám phá được dùng chomục đích dự báo (prediction), điều khiển (control), hay học (learn) cơ chế đã tạo ra dữ liệu.R. D. Snee, Validation of Regression Models: Methods and Examples, Technometrics, Vol. 19, No. 4. (Nov., 1977), pp. 415-428.

Page 11: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

11

11

3.1. Tổng quan về hồi qui

Mô hình hồi qui (regression model): mô hình môtả mối liên kết (relationship) giữa một tập cácbiến dự báo (predictor variables/independent variables) và một hay nhiều đáp ứng(responses/dependent variables).

Y = f(X, β)X: các biến dự báo (predictor/independent variables)

Y: các đáp ứng (responses/dependent variables)

β: các hệ số hồi qui (regression coefficients)

Page 12: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

12

12

3.1. Tổng quan về hồi qui

Phương trình hồi qui: Y = f(X, β)X: các biến dự báo (predictor/independent variables)

Y: các đáp ứng (responses/dependent variables)

β: các hệ số hồi qui (regression coefficients)

X dùng để giải thích sự biến đổi của các đáp ứng Y.

Y dùng đề mô tả các hiện tượng (phenomenon) được quan tâm/giải thích.

Quan hệ giữa Y và X được diễn tả bởi sự phụ thuộchàm của Y đối với X.

β mô tả sự ảnh hưởng của X đối với Y.

Page 13: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

13

13

3.1. Tổng quan về hồi qui

Phân loạiHồi qui tuyến tính (linear) và phi tuyến(nonlinear)Hồi qui đơn biến (single) và đa biến (multiple)Hồi qui có thông số (parametric), phi thông số(nonparametric), và thông số kết hợp(semiparametric)Hồi qui đối xứng (symmetric) và bất đối xứng(asymmetric)

Page 14: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

14

14

3.1. Tổng quan về hồi qui

Phân loạiHồi qui tuyến tính(linear) và phi tuyến(nonlinear)

Linear in parameters: kết hợp tuyến tính cácthông số tạo nên Y

Nonlinear in parameters: kết hợpphi tuyến các thông sốtạo nên Y

[Regression and Calibration.ppt]

Page 15: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

15

15

3.1. Tổng quan về hồi quiPhân loại

Hồi qui đơn biến (single) và đa biến (multiple)Single: X = (X1)

Multiple: X = (X1, X2, …, Xk)

1 2ˆ 6 .3 9 7 2 2 0 .4 9 2 1 0 .2 8 0 5y x x= + + ˆ 26.89 4.06y x= +[Chapter 6 Regression and Correlation.ppt]

Page 16: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

16

16

3.1. Tổng quan về hồi qui

Phân loạiHồi qui có thông số (parametric), phi thông số (nonparametric), và thông số kết hợp (semiparametric)

Parametric: mô hình hồi qui với hữu hạn thông số

Nonparametric: mô hình hồi qui với vô hạn thông số

Semiparametric: mô hình hồi qui với hữu hạn thông số được quan tâm

[Wikipedia][GAM - nonparameteric regression technique.ppt]P. Giudici, Applied Data Mining – Statistical Methods for Business and Industry, John Wiley & Sons Ltd, 2003.

Y = β0 + β1*X1 + f(X2)Semiparametric

Y = β0 + f(X)Nonparametric

Y = β0 + β1*XParametric

Mathematical FormTypes of (Additive) Model

Page 17: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

17

17

3.1. Tổng quan về hồi quiPhân loại

Hồi qui đối xứng (symmetric) và bất đối xứng(asymmetric)

Symmetric: mô hình hồi qui có tính mô tả (descriptive) (eg. log-linear models)

The objective of the analysis is descriptive – to describe the associative structure among the variables.

Asymmetric: mô hình hồi qui có tính dự báo (predictive) (eg. linear regression models, logistic regression models )

The variables are divided in two groups, response and explanatory – to predict the responses on the basis of the explanatory variables.

Generalized linear models: symmetric vs. asymmetricP. Giudici, Applied Data Mining – Statistical Methods for Business and Industry, John Wiley & Sons Ltd, 2003.

Page 18: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

18

18

3.2. Hồi qui tuyến tính

Hồi qui tuyến tính đơn biếnĐường hồi qui (regression line)

Hồi qui tuyến tính đa biếnMặt phẳng hồi qui (regression plane)

Page 19: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

19

19

3.2.1. Hồi qui tuyến tính đơn biến

Cho N đối tượng đã được quan sát, mô hình hồi qui tuyến

tính đơn biến được cho dưới dạng sau với εi dùng giữ phần

biến thiên của đáp ứng Y không được giải thích từ X:

-Dạng đường thẳng

-Dạng parabola

Page 20: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

20

20

3.2.1. Hồi qui tuyến tính đơn biến

•Y= β0 + β1*X1 → Y = 0.636 + 2.018*X•Dấu của β1 cho biết sự ảnh hưởng của X đối với Y.

Page 21: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

21

21

3.2.1. Hồi qui tuyến tính đơn biếnƯớc lượng bộ thông số β ( ) để đạt được môhình hồi qui tuyến tính đơn biến

Thặng dư (residual)

Tổng thặng dư bìnhphương (sum of squared residuals)

tối thiểu hóa

Trị ước lượng của β

Giả định (assumptions): thành phần lỗi có phương sai (variance) là hằng số, tuân theo phân bố chuẩn (normal distribution).

xi, yi: trị của x, y từ tập dữ liệuhuấn luyện

x, y: trị trung bình từ tập dữ liệuhuấn luyện

ŷi: trị ước lượng với bộ thông số β

Page 22: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

22

22

3.2.2. Hồi qui tuyến tính đa biến

Hồi qui tuyến tính đa biến: phân tích mốiquan hệ giữa biến phụ thuộc(response/dependent variable) và hai hay nhiều biến độc lập (independent variables)

yi = b0 + b1xi1 + b2xi2 + … + bkxik

i = 1..n với n là số đối tượng đã quan sátk = số biến độc lập (số thuộc tính/tiêu chí/yếu tố…)Y = biến phụ thuộcX = biến độc lậpb0 = trị của Y khi X = 0b1..k = trị của các hệ số hồi qui

Page 23: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

23

23

3.2.2. Hồi qui tuyến tính đa biến

0 1 1 2 2ˆ k ky b b x b x b x= + + + +K

( ) YXXXb TT 1−=

1,1 1,2 1,1 0

2,1 2,2 2,2 1

,1 ,2 ,

11

, ,

1

k

k

n n n kn k

x x xY bx x xY b

x x xY b

= = =

Y X b

K

K

M M M MM M

K

Trị ước lượng của Y

Trị ước lượng củabộ thông số b

Page 24: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

24

24

3.2.2. Hồi qui tuyến tính đa biến

Example: a sales manager of Tackey Toys, needs to predict sales of Tackey products in selected market area. He believes that advertising expenditures and the population in each market area can be used to predict sales. He gathered sample of toy sales, advertising expenditures and the population as below. Find the linear multiple regression equation which the best fit to the data.

[Chapter 6 Regression and Correlation.ppt]

Page 25: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

25

25

3.2.2. Hồi qui tuyến tính đa biến

40060010.0F1001003.0E2004006.0D4008008.0C3007005.0B1002001.0A

Toy sales (Thousands of Dollars) y

Population (Thousands) x2

Advertising Expenditures (Thousands of Dollars) x1

Market Area

[Chapter 6 Regression and Correlation.ppt]

Page 26: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

26

26

3.2.2. Hồi qui tuyến tính đa biến

1 2ˆ 6.3972 20.4921 0.2805y x x= + +

[Chapter 6 Regression and Correlation.ppt]

Page 27: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

27

27

3.3. Hồi qui phi tuyến

Y = f(X, β)Y là hàm phi tuyến cho việc kết hợp các thông sốβ.

Ví dụ: hàm mũ, hàm logarit, hàm Gauss, …

Xác định bộ thông số β tối ưu: các giải thuật tối ưuhóa

Tối ưu hóa cục bộ

Tối ưu hóa toàn cục cho tổng thặng dư bình phương (sum of squared residuals)

Page 28: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

28

28

3.4. Ứng dụng

Quá trình khai phá dữ liệu

Giai đoạn tiền xử lý dữ liệu

Giai đoạn khai phá dữ liệu

Khai phá dữ liệu có tính mô tả

Khai phá dữ liệu có tính dự báo

Các lĩnh vực ứng dụng: sinh học (biology), nông nghiệp (agriculture), xã hội (social issues), kinh tế (economy), kinh doanh(business), …

P. Giudici, Applied Data Mining – Statistical Methods for Business and Industry, John Wiley & Sons Ltd, 2003.

Page 29: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

29

29

3.5. Các vấn đề với hồi qui

Các giả định (assumptions) đi kèm với bàitoán hồi qui.

Lượng dữ liệu được xử lý.

Đánh giá mô hình hồi qui.

Các kỹ thuật tiên tiến cho hồi qui:

Artificial Neural Network (ANN)

Support Vector Machine (SVM)

Page 30: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

30

30

3.6. Tóm tắt

Hồi quiKỹ thuật thống kê, được áp dụng cho các thuộc tính liên tục(continuous attributes/features)

Có lịch sử phát triển lâu đời

Đơn giản nhưng rất hữu dụng, được ứng dụng rộng rãi

Cho thấy sự đóng góp đáng kể của lĩnh vực thống kê tronglĩnh vực khai phá dữ liệu

Các dạng mô hình hồi qui: tuyến tính/phi tuyến, đơn biến/đa biến, có thông số/phi thông số/thông số kết hợp, đối xứng/bất đối xứng

Page 31: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

31

31

HỏiHỏi & & ĐĐápáp ……

Page 32: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

32

32

ChChươươngng 3: 3: HồiHồi qui qui dữdữ liệuliệu

Phần 2

Page 33: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

33

33

Nội dung

Generalized linear models[2], section 11.3, pp. 384-390.

Logistic regression[2], section 10.7, pp. 354-355.

[9], section 25.3, pp. 529-532.

Generalized additive models[2], section 11.5.1, pp. 393-395.

Projection pursuit regression[2], section 11.5.2, pp. 395-397.

Page 34: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

34

34

Generalized linear models

Linear models: the response variable was decomposed into two parts

a weighted sum of the predictor variables

a random component: assumed that the ε(i) were independently distributed as N (0, σ2)

The generalized linear model extends the ideas of linear models.

Page 35: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

35

35

Generalized linear models

Generalized linear model(i) The Y(i) are independent random variables,with distribution N(µ(i), σ2).

Relax the requirement: random variables follow a normal distribution

(ii) The parameters enter the model in a linear way via the sum v(i) = ∑ajxj(i).

(iii) The v(i) and µ(i) are linked by v(i) = µ(i).

Generalize: g(µ(i)) = v(i) relates the parameter of the distribution to the linear term v(i) = ∑ajxj(i)

Page 36: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

36

36

Generalized linear modelsThe generalized linear model has three main features

(i) The Y(i), i=1, …n, are independent random variables, with the same exponential family distribution

The exponential family of distributions is an important family that includes the normal, the Poisson, the Bernoulli, and the binomial distributions.

If ø is known, then θ is called the natural or canonical parameter.When, as is often the case, α(ø) = ø, ø is called the dispersion or scale parameter.

(ii) The predictor variables are combined in a form v(i) = ∑ajxj(i) called the linear predictor, where the ajs are estimates of the αjs.(iii) The mean µ(i) of the distribution for a given predictor vector is related to the linear combination in (ii) through the link function gg(µ(i)) = v(i) = ∑ajxj(i).

Page 37: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

37

37

Generalized linear models

Prediction from a generalized linear model requires the inversion of the relationship gg(µ(i)) = ∑ajxj(i).

The nonlinearity means that an iterative scheme has to be adopted.

Maximum likelihood solution

A measure of the goodness of fit of a generalized linear model, analogous to the sum of squares used for linear regression: the deviance D(M) of a model

the sum of squares is the special case of deviance when it is applied to linear models

the difference between the log likelihood of model M and the log likelihood of the largest model we are prepared to contemplate, M*

Page 38: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

38

38

Logistic regression

Logistic functionthe parameter β determines the rate of growth or increase of the curvethe sign of β indicates whether the curve increases or decreases the magnitude of β determines the rate of that increase or decrease

β > 0: (x) increases as x increases.β < 0: π(x) decreases as x increases.β → 0: the curve tends to become a horizontal straight line.

When β = 0, Y is independent of X.

π(x) =

(a). β > 0

(b). β < 0

Page 39: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

39

39

Logistic regressionLogistic regression logistic discriminant analysis

Descriptive modela very powerful tool for classification problems in discriminantanalysis tends to have higher accuracy when training data is plenty as compared to Naïve Bayes

applied in many medical and clinical research studiesAs a neural network model without hidden nodes and with a logistic activation function and softmax output functionThe yis are binary variables and thus not normally distributed.

The distribution of yi given x is assumed to follow a Bernoulli distribution:

a linear function of x

Page 40: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

40

40

Logistic regressionLogistic regression logistic discriminant analysis

Estimate the β’s: maximum likelihood

find the smallest possible deviance between the observed and predicted values (kind of like finding the best fitting line) using calculus (derivatives specifically)

use different "iterations" in which it tries different solutions until it gets the smallest possible deviance or best fit

Once it has found the best solution, it provides a final value for the deviance D, which is usually referred to as "negative two log likelihood“ thought of as a Chi-square value.

π(x) = p(y=1|x) =

−=

elfulltheoflikelihoodelreducedtheoflikelihoodD

modmodln2

Likelihood of the reduced model = likelihood of predicted values (π(x))

Likelihood of the full model = probabilities of observed values (y=1/0)

Page 41: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

41

41

Logistic regression

The parameter estimates for the five variables selected in the final model, with the corresponding Wald statisticsNo variable appears to be not significant, using a significance level of 0.05.The variable Vdpflart indicates whether or not the price of the first purchase is paid in instalments; it is decisively estimated to be the variable most associated with the response variable.

P. Giudici, Applied Data Mining – Statistical Methods for Business and Industry, John Wiley & Sons Ltd, 2003, p.166.

Page 42: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

42

42

Generalized additive modelsExtension of the generalized linear model

Replace the simple weighted sums of the predictor variablesby weighted sums of transformedtransformed versions of the predictor variables

The right-hand side is sometimes termed the additive predictor.

The relationships between the response variable and thepredictor variables are estimated nonparametrically.

greater flexibility

When some of the functions are estimated from the data andsome are determined by the researcher, the generalized additive model is sometimes called “semiparametric.”

Page 43: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

43

43

Generalized additive models

The model retains the merits of linear and generalized linear models.

How gg changes with any particular predictor variable does not depend on how other predictor variables change.

Interpretation is eased.

This is at the cost of assuming that such an additive form does provide a good approximation to the “true” surface.

The model can be readily generalized by including multiple predictor variables within individual f components of the sum.

Relaxing the simple additive interpretation

The additive form also means that we can examine each smoothed predictor variable separately, to see how well it fits the data.

Page 44: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

44

44

Generalized additive modelsA GAM fitting algorithm

Backfitting algorithm to estimate functions fj and constant α

Proceed the following steps1. Initialize

2. Cycle

3. Continue 2 until the individual functions do not change.

[9], pp. 218-219.

Page 45: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

45

45

Generalized additive models

A GAM fitting algorithm1. Initialize: α =yi, fj = fj0, j = 1, …, p.

Each predictor is given an initial functional relationship to the response such as a linear one. The intercept is given an initial value of the mean of y.

2. Cycle: j = 1, …, p,1, …, p, ...

A single predictor is selected. Fitted values are constructed using all of the other predictors. These fitted values are subtracted from the response. A smoother Sj is applied to the resulting “residuals,” taken to be a function of the single excluded predictor. The smoother updates the function for that predictor. Each of the other predictors is, in turn, subjected to the same process.

3. Continue 2 until the individual functions do not change.

Page 46: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

46

46

Generalized additive modelsThese “adaptive” methods seem to be most useful

when the data have a high signal to noise ration,

when the response function is highly nonlinear,

when the variability in the response function changes dramatically from location to location.

Experience to date suggests that data from the engineering and physical sciences are most likely to meet these criteria.

Data from the social sciences are likely to be far too noisy.

Page 47: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

47

47

Generalized additive modelsNeural networks are a special case of the generalized additive linear models.

Multilayer feedforward neural networks with one hidden layer

where m is the number of processing-units in the hidden layer.

The family of functions that can be computed depends on the number of neurons in the hidden layer and the activationfunction σ .

Note that a standard multilayer feedforward network with a smooth activation function σ can approximate any continuous function on a compact set to any degree of accuracy if and only if the network’s activation function σ is not a polynomial.

Page 48: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

48

48

Projection pursuit regression

The additive models essentially focus on individual variables (albeit transformed versions of these).

The additive models can be extended so that each additive component involves several variables, but it is not clear how best toselect such subsets.

If the total number of available variables is large, then we may also be faced with a combinatorial explosion of possibilities.

Page 49: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

49

49

Projection pursuit regressionThe basic projection pursuit regression model

This is a linear combination of (potentially nonlinear) transformations of linear combinations of the raw variables.The f functions are not constrained (as in neural networks) to take a particular form, but are usually found by smoothing, as in generalized additive models.

The term projection pursuit arises from the viewpoint that one is projecting X in direction αk, and then seeking directions of projection that are optimal for some purpose.

optimal as components in a predictive model

the model is fitted using standard iterative procedures to estimate the parameters in the αk vector.

Page 50: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

50

50

Projection pursuit regressionThe projection pursuit regression model has obvious close similarities to the neural network model.

A generalization of neural networks

Projection pursuit regression models can be proven to have the same ability to estimate arbitrary functions as neural networks, but they are not aswidely used.

Estimating their parameters can have advantages over the neural network situation.

Projection pursuit regression tends may not be practical for data sets that are massive (large n) and high-dimensional (large p).

The fitting process is rather complex from a computational viewpoint.

Page 51: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

51

51

Tóm tắtRegression

Linear models

Generalized linear modelLogistic models

Feedforward neural networks

Back-propagration neural networks

Generalized additive models

Projection pursuit regression

Linearity to Nonlinearity

Descriptive vs. Predictive

Page 52: Chương 3: Hồi qui dữ liệu - scholar.vimaru.edu.vnscholar.vimaru.edu.vn/sites/default/files/thinhnv/files/dm_-_chapter_3... · Hồi qui có thông số(parametric), phi thông

52

52

Đọc thêmPredictive modeling for regression

[2], chapter 11, pp. 367-398.

Regression modeling, multiple regression and model building, logistic regression

[6], chapter 2-4, pp. 33-203.

Data mining within a regression framework[9], chapter 11, pp. 209-230.

Statistical methods for data mining[9], chapter 25, pp. 523-540.

Validation of regression models: methods and examplesRonald D. Snee, Technometrics, vol. 19, no. 4 (Nov, 1977), pp. 415-428.

Choosing between logistic regression and discriminant analysisS. James Press, Sandra Wilson, Journal of the American Statistical Association, vol. 73, no. 364 (Dec, 1978), pp. 699-705.

Fitting curves to data using nonlinear regression: a practical and nonmathematical review

Harvey J. Motulsky, Lennart A. Ransnas, FASEB J., vol. 1 (1987), pp. 365-374.