Lecture 2 Machine Learning
Lecture 2 Machine Learning
Slope/Gradient
y = mx + c Y Intercept
Residual Sum of Squared Error
What is Error?
Hypothesis (Function):
Parameters: w,b
Cost function:
Goal: minimize f(w,b)
Regression Line | Best Fit Line
What is the Line of Best Fit?
• The Best Fit Line is the line that gives the minimum SSE.
• Amongst all the possible lines, there will be one line that will
be the best fit meaning greatest possible accuracy as a model.
• The line that minimizes the sum of squared error of residuals
is called Regression Line or the Best Fit Line.
• In Simple Terms, it represents a straight line that best
represents the data on scatterplot. It is drawn using the Least
Square Method.
Use the Least Square Method to Determine the Eqn. of Line of
Best Fit
x 8 2 11 6 5 4 12 9 6 1
y 3 10 3 6 8 12 1 4 9 14
Finding Best Fit Line Algorithm
How to find the Best Fit Line?
• The equation of the straight line is given by y = mx +c
m – slope of the line
c - Intercept (The point at which the straight line touches y axis.
• The Best Fit line is found basis the Least Squared Method.
Algorithm:
Mean of x and y values
Step1: Find the Mean of x-values and y-values
Step2: Calculate the slope of the line. It can be found using the following eqn. on
the right.