Professional Documents
Culture Documents
Regression
Regression
by
Shavantrevva S. B. & Padmashree G.
Dept. of Data Science and Computer Applications
Manipal Institute of Technology, Manipal
February 5, 2024
1 Regression Models
1 Regression Models
β0 = Ȳ − β1 X̄
Where
X̄ is the mean of X values.
Ȳ is the mean of Y values.
1
1
https://www.youtube.com/watch?v=JUQXyQ2U1b8
Shavantrevva S B , Dept of DSCA Subject Code: DSE 2222 14 / 45
Linear Regression: Matrix method
2
https://www.youtube.com/watch?v=JUQXyQ2U1b8
Shavantrevva S B , Dept of DSCA Subject Code: DSE 2222 15 / 45
Multiple Linear Regression
Simple Linear Regression, where a single Independent/Predictor(X)
variable is used to model the response variable (Y).
What if, the response variable is affected by more than one predictor
variable
Multiple Linear Regression algorithm is used.
Multiple Linear Regression which models the linear relationship be-
tween a single dependent continuous variable and more than one
independent variable.
Keypoints about MLR
For MLR, the dependent or target variable(Y) must be the continu-
ous/real, but the predictor or independent variable may be of continuous
or categorical form.
Each feature variable must model the linear relationship with the depen-
dent variable.
MLR tries to fit a regression line through a multidimensional space of
data-points.
Shavantrevva S B , Dept of DSCA Subject Code: DSE 2222 16 / 45
Assumptions for Multiple Linear Regression
Even though the equation contains terms with x raised to various pow-
ers, it’s still considered a form of linear regression because the linearity
refers to the coefficients, not the input variables.
Equation
1
P(x) = (1)
1+ e − (β 0 + β1 x)
3
3
https://www.youtube.com/watch?v=2C8IqOLO1os&t=0s
Shavantrevva S B , Dept of DSCA Subject Code: DSE 2222 31 / 45
Logistic Regression Equation
EXAMPLE:
4
https://www.youtube.com/watch?v=2C8IqOLO1os&t=0s
Shavantrevva S B , Dept of DSCA Subject Code: DSE 2222 37 / 45
Logistic Regression Solved Example
Coefficient Shrinkage:
The presence of the penalty term encourages the optimization algo-
rithm to minimize not only the error term but also the sum of squared
coefficients.
As a result, the coefficients of the linear regression model are ”shrunk”
toward zero.
Ridge regression
Ridge regression adds the “squared magnitude” of the coefficient as a
penalty term to the loss function(L).
n m
1X X
cost = (yi − yˆi )2 + λ wi2 (3)
n
i=1 i=1