Tình huống … Hồi qui regression Khai phá dữ liệu có tính dự báo Predictive data... 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
Trang 1(chauvtn@cse.hcmut.edu.vn)
Trang 2Tà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 + Business
Media, LLC 2005, 2010.
Trang 3Nội dung
Chương 1: Tổng quan về khai phá dữ liệu
Chương 2: Các vấn đề tiền xử lý dữ liệu
Chương 4: Phân loại dữ liệu
Chương 5: Gom cụm dữ liệu
Chương 6: Luật kết hợp
Chương 7: Khai phá dữ liệu và công nghệ cơ sở dữ
liệu
Chương 8: Ứng dụng khai phá dữ liệu
Chương 9: Các đề tài nghiên cứu trong khai phá dữ
liệu
Chương 10: Ôn tập
Trang 4Chương 3: Hồi qui dữ liệu
Trang 53.0 Tình huống 1
Ngày mai giá cổ phiếu STB sẽ là bao nhiêu???
Trang 6Mô hình phân bố dữ liệu của y theo x???
Trang 73.0 Tình huống 3
Bà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?
Trang 83.0 Tình huống 4
Khảo sát các yếu tố tác động đến xu hướng
sử 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)
Trang 93.0 Tình huống …
Hồi qui (regression)
Khai phá dữ liệu có tính dự báo (Predictive data
Trang 103.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ống
kê 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ượng
cá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ép
mô hình hồi qui vừa được khám phá được dùng cho
mụ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.
Trang 113.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ác
biến dự báo (predictor variables/independent
variables) và một hay nhiều đáp ứng
Trang 123.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ộc
hàm của Y đối với X
Æ β mô tả sự ảnh hưởng của X đối với Y
Trang 13 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)
Trang 143.1 Tổng quan về hồi qui
Ph ân loại
Hồ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]
Trang 16 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.
Mathematical Form Types of (Additive) Model
Trang 17Asymmetric: 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 asymmetric
P Giudici, Applied Data Mining – Statistical Methods for Business and Industry, John Wiley & Sons Ltd, 2003.
Trang 183.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ến
Mặt phẳng hồi qui (regression plane)
Trang 193.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
Trang 213.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ình
phươ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ệu huấn luyện
x, y: trị trung bình từ tập dữ liệu huấn luyện
ŷi: trị ước lượng với bộ thông số β
Trang 223.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ối
quan 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át
k = số biến độc lập (số thuộc tính/tiêu chí/yếu tố…)
Trang 23k k
K
Trị ước lượng của Y
Trị ước lượng của
bộ thông số b
Trang 243.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
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]
Trang 253.2.2 Hồi qui tuyến tính đa biến
400 600
10.0 F
100 100
3.0 E
200 400
6.0 D
400 800
8.0 C
300 700
5.0 B
100 200
1.0 A
Toy sales
(Thousands of Dollars) y
Population (Thousands) x2
Advertising Expenditures (Thousands of Dollars) x1
Market
Area
[Chapter 6 Regression and Correlation.ppt]
Trang 27 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)
Trang 283.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.
Trang 293.5 Các vấn đề với hồi qui
Các giả định (assumptions) đi kèm với bài
toá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)
Trang 30 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ê trong
lĩ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
Trang 31Hỏi & Đáp …
Trang 32Phần 2
Trang 34Generalized 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.
Trang 35Generalized 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) = ∑a j x j (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) = ∑a j x j (i)
Trang 36Generalized linear models
The 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) =
∑a j x j (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 g(µ(i)) = v(i) = ∑a g j x j (i).
Trang 37Generalized linear models
Prediction from a generalized linear model requires
the inversion of the relationship g(µ(i)) = ∑a g j x j (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*
Trang 38 the sign of β indicates whether the curve increases or decreases
the magnitude of β determines the rate of that increase or decrease
Trang 39Logistic regression
Logistic regression Ỉ logistic discriminant analysis
Descriptive model
a very powerful tool for classification problems in discriminant
analysis Ỉ tends to have higher accuracy when training data is plenty as compared to Nạve Bayes
applied in many medical and clinical research studies
As a neural network model without hidden nodes and with a
logistic activation function and softmax output function
The y is are binary variables and thus not normally distributed.
The distribution of y i given x is assumed to follow a Bernoulli
distribution:
Ỉ a linear function of x
Trang 40Logistic regression
Logistic 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
the of
likelihood
el reduced
the of
likelihood D
mod
mod ln
2
Likelihood of the reduced model = likelihood of predicted values (π(x)) Likelihood of the full model = probabilities of observed values (y=1/0)
Trang 41Logistic regression
The parameter estimates for the five variables selected in the final model, with the corresponding Wald
statistics
No 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.
Trang 42Generalized additive models
Extension of the generalized linear model
Replace the simple weighted sums of the predictor variables
by weighted sums of transformed versions of the predictor transformed
variables
The right-hand side is sometimes termed the additive predictor.
The relationships between the response variable and the
predictor variables are estimated nonparametrically.
greater flexibility
When some of the functions are estimated from the data and
some are determined by the researcher, the generalized
additive model is sometimes called “semiparametric.”
Trang 43Generalized additive models
The model retains the merits of linear and generalized linear
models.
How g changes with any particular predictor variable does not g
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.
Trang 44Generalized additive models
A GAM fitting algorithm
Backfitting algorithm to estimate functions f j and
Trang 45Generalized additive models
A GAM fitting algorithm
1 Initialize: α =yi, f j = f j 0 , 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.
Trang 46Generalized additive models
These “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.
Trang 47Generalized additive models
Neural 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 activation function σ
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.