Page 252 - Touhpad Ai
P. 252
Let us find the best m (slope) and b (y-intercept) that suits the data.
y = mx + b
2
Step 1 For each (x,y), we have to calculate x and xy as shown in the table below:
x y x 2 xy
0 20 0 0
1 40 1 40
2 60 4 120
3 80 9 240
4 92 16 368
5 105 25 525
2
2
Step 2 We have to add all the elements present in x, y, x and xy (which gives us Σx, Σy, Σx and Σxy):
x y x 2 xy
0 20 0 0
1 40 1 40
2 60 4 120
3 80 9 240
4 92 16 368
5 105 25 525
2
∑Σx=15 ∑Σy=397 ∑Σx =55 ∑Σxy=1293
N = Number of data samples = 6
Step 3 Now we will calculate the slope m:
N(Σxy) – (Σx) (Σy)
m =
2
N(Σx ) – (Σx) 2
6(1293) – 15(397)
=
6(55) – (15) 2
= 7758 – 5955
330 – 225
1803
=
105
= 17.17
Step 4 After calculating the slope, now we need to calculate the intercept b:
Σy – m Σx
b =
N
397 – 17.17 (15)
=
6
139.45
=
6
= 23.24
Step 5 Now we will assemble the equation of a line:
y = mx + b
y = 17.17x + 23.24
250 Touchpad Artificial Intelligence - XI

