Welcome to ML tutorial
In regression what we need to do is finding Best Slope for given linear data set. So how can we find the best slope? If we think data as x set and y set like in the given image,
We can calculate best slope with following function
This expression means that avarage of all Xs
.jpg)
Now we need to calculate Y intercept, formula of intercept is

When we connect our ys we calcualte with our function we will have following slope:

But how can we sure this is a good line? We need to use Coefficient of determination.

This formula will give us accuracy of line with comparison with mean of ys line with using squared error(distance). As an example if squarred error of mean line of ys is 0.5 and squared error of our line is 0.1 it means that 1 - (0.1/0.5) = 0.8 and this is our accuracy.

