Professional Documents
Culture Documents
Regression
MODELS
BMSCE - ME
MCL - Python
| PA G E 1
Data Types
Variable that has infinite possible values Variable that has finite possible values
BMSCE - ME
MCL - Python
| PA G E 2
Average Temperature in Bengaluru
27.5
27
26.5
26
25.5
25
24.5
24
23.5
23
22.5
1970 1975 1980 1985 1990 1995 2000 2005 2010 2015 2020
BMSCE - ME
MCL - Python
| PA G E 3
Data
Relationships
BMSCE - ME
MCL - Python
| PA G E 4
x y x y
2 5 2 8.49
4 9 4 12.31
1 3 1 6.20
3 7 3 10.61
7 15 7 18.07
Can you try 8 17 8 20.45
this ? 10 21 10 24.96
13 27 13 30.05
5 11 5 14.73
Can you come up with the equation Can you come up with the equation
BMSCE - ME
MCL - Python
| PA G E 5
Visualize the data
Is there a trend ?
BMSCE - ME
MCL - Python
| PA G E 6
Trend
BMSCE - ME
MCL - Python
| PA G E 7
Error
BMSCE - ME
MCL - Python
| PA G E 8
Error
BMSCE - ME
MCL - Python
| PA G E 9
HOW DOES
IT WORK ?
BMSCE - ME
MCL - Python
| PA G E 10
Gradient Descent –
Simple Linear
Regression
𝐸𝑟𝑟𝑜𝑟 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛
𝛽0
𝛽1
BMSCE - ME
MCL - Python
| PA G E 12
What is Regression?
o Equation:
o Cost Function:
BIAS :
How well the model fits the data
Complete Dataset
Model
Testing
Training Error Error
BMSCE - ME
MCL - Python
| PA G E 16
Cross Validation (K-fold)
BMSCE - ME
MCL - Python
| PA G E 17
Leave one out cross validation
RUN 1 1 2 3 4 5 N
RUN 2 1 2 3 4 5 N
RUN 3 1 2 3 4 5
RUN 4 1 2 3 4 5
RUN K 1 2 3 4 5 N
BMSCE - ME
MCL - Python
| PA G E 18
Multiple Linear Regression
Continuous or Discrete
o Equation:
o Cost Function:
o Equation:
o Cost Function:
Example 1 YES
Example 2 YES
Example 3 YES
Example 4 NO
Scikit-Learn
• Python library (installation required)
BMSCE - ME
MCL - Python
| PA G E 23