Page 329 - AI Ver 3.0 Class 11
P. 329
Least Squares Method—Finding the Line of Best Fit
Consider the following example, where marks of 10 students are shown, which they scored after a certain number of
hours of study:
No. of Hours Studied Marks
2 44
9 98
5 80
3 75
7 70
1 63
8 53
6 92
2.5 71
4 65
Assuming No. of Hours Studied as x and Marks as y, let us learn to plot the above data on a Scatterplot using Excel.
120
100
80
Marks (Y) 60
40
20
0
0 1 2 3 4 5 6 7 8 9 10
No. of Hours Studied (X)
We will also try to find the line that best fits the data i.e. the line that passes close to most of the data points. This line
is called the ‘Line of Best Fit’ or ‘Regression Line’.
Let us find the m (slope) and b (y-intercept) that suits that data
y = mx + b + e
Step 1: Type the given data in Excel.
Step 2: Select x and y. Click on Insert Chart → select the first scatter plot option.
Machine Learning Algorithms 327

