RMSE: root mean square error — it is a measure of how well the regression line fits the data points. RMSE can also be interpreted as the standard deviation of the residual.
Consider these points: (1, 1), (2, 2), (2, 3), (3, 6).
We split the above data points into the 1st list.
Login :
x = [1, 2, 2, 3] y = [1, 2, 3, 6]
Code: Regression Plot

Code: Average
# in the next step we will find the equation of the line of best fit
# we will use the slope of a linear algebra point to find the equation of the regression line
# the shape of the slope is represented by y = mx + c
# where m means slope (change in y) / (change in x)
# c is a constant, it represents where the line will cross the Yaxis
# Slope m can be formulated like this:
"" "
N
m =? (xi  Xmean) (yi  Ymean) /? (xi  Xmean) ^ 2
i = 1
"" "
# calculate Xmean and Ymean
ct
=
len
(x)
sum_x
=
0
sum_y
=
0
for
i
in
x:
sum_x
=
sum_x
+
i
x_mean
=
sum_x
/
ct
print
(
` Value of X mean`
, x_mean)
for
i
in
y:
sum_y
=
sum_y
+
i
y_mean
= sum_y
/
ct
print
(
`value of Y mean`
, y_mean)
# we have x mean and y_mean
Output:
Value of X mean 2.0 value of Y mean 3.0
Code: linear equation

Output:
Intercept 2.0
Code: Medium square error


Output:
Root mean square error 0.6123724356957945
Code: RMSE Calculation

Output:
Root Mean square error using maths 0.6123724356957945
Rsquared error or coefficient of determination
Error R2 answers the following question.
How much y changes with change in x. Basically, the percentage change in y when changing from x
Code: RSquared Error

Output:
Rsquared error 0.8928571428571429
Code: RSquared Error with sklear

Output:
0.8928571428571429