Unit-02 - Supervised Machine Learning
Unit-02 - Supervised Machine Learning
Unit 02
Supervised Learning
1
10/3/2025
Linear regression
Linear Regression:
a statistical approach to modeling the relationship
between a dependent variable and a given set of
independent variables
Linear regression
Linear Regression:
There is a non-linear
correlation when there is a
relationship between variables
but the relationship is
not linear (straight)
2
10/3/2025
3
10/3/2025
4
10/3/2025
y = a0 + a1X
Where,
y: Predicted value
a0: Y- intersect
a1 : Slope of independent variable
X : Independent variable
5
10/3/2025
6
10/3/2025
7
10/3/2025
Where,
Xi: ‘i‘
i th input variable
yi: ‘i‘ th onput variable
x̅ : Mean of all X values
y̅ : Mean of all y values
R. B. Mannade, Asst. Professor Govt. College of Engineering, Aurangabad(MS) | 15
a1
a0 = y̅ - a1x͞
8
10/3/2025
9
10/3/2025
2004 3445.67
Fi l Exam
Final E = 32.02
32 02 + 0.5816
0 5816 x (Mid Term)
T )
10
10/3/2025
Squaring makes all errors positive and penalizes large mistakes more than
small ones
For example, being wrong by 10 (error² = 100) is much worse than being
wrong by 2 (error² = 4)
R. B. Mannade, Asst. Professor Govt. College of Engineering, Aurangabad(MS) | 22
11
10/3/2025
12
10/3/2025
13
10/3/2025
14
10/3/2025
15
10/3/2025
Exam_Score = a0 + a1(Hours_Studied ) 4 55
5 62
6 70
Least Square Method: 7 72
8 78
9 85
10 90
12 ?
16
10/3/2025
17
10/3/2025
18
10/3/2025
19
10/3/2025
20
10/3/2025
F4: Condition of
the house
F5: Price of
House ? Dependent Variable
y = a0+a1x1+a2x2+a3x3+ …… anxn + є
Where,
a0 : ‘y’ Intercept
a1 , a2 , a3 , … an : Slope or Coefficient of regression
x1 , x2 , x3 , … xn : Independent / Predictor variables
Є : Error
21
10/3/2025
F2: No. of
Bedrooms
F3: Locality
F4: Condition of
the house Price of House =
F5: Price of a0 + a1(Size of the house) + a2(No.
House ? of Bed rooms) + a3(Locality) +
a4(Condition of the house)
y The relationship
Linearity: p between dependent
p and
independent variables should be linear
22
10/3/2025
3 8 8
4 2 12
6 10 ?
Bi
Bias I t
Intersect
t
Coeff. Of
Equation of Y-Intersect and Slopes will be TV
as: Coeff. Of
Mobile
2 5 6
3 8 8
4 2 12
6 10 ?
23
10/3/2025
2 5 6
3 8 8
4 2 12
6 10 ?
2 5 6
3 8 8
4 2 12
6 10 ?
24
10/3/2025
2 5 6
3 8 8
4 2 12
6 10 ?
Intersect
Coeff. Of
TV
Coeff. Of
Mobile
Weekly Sales = 2 5 6
-1.69+3.48(TV)+0.05(Mobile) 3 8 8
4 2 12
= -1.69+3.48(6)+0.05(10) 6 10 ?
= 19.69
19 69
25
10/3/2025
Polynomial Regression
26
10/3/2025
Polynomial Regression
Polynomial Regression
27
10/3/2025
Polynomial Regression
n = No. of
elements
Polynomial Regression
Numerical Example:
Apply Polynomial Regression on
given a dataset and find the
equation.
Also predict the value of y when x =
7.
28
10/3/2025
Polynomial Regression
Numerical Example:
Polynomial Regression
Numerical Example:
Equation:
29
10/3/2025
Polynomial Regression
Advantages
Captures non-linear relationships.
More flexible than simple linear regression.
Disadvantages
Overfitting if polynomial degree is too high.
Sensitive to outliers.
Interpretation becomes harder for high-degree polynomials.
Polynomial Regression
30