# What is the difference between least squares method and mean squared method in calculating the error?

I think I am a little bit confused between the LSE (Least Squared Error) and the MSE (Mean Squared Error). So how can these two methods differ in calculating the error of the linear regression model? And if available, please provide the mathematical equation of both methods.

You can think of least squares method as minimization of mean squared errors. In other words the latter is the subject of minimization of the former with respect to the parameters $$\beta$$: $$\min_\beta MSE(\beta)$$ Once you find the optimal parameters $$\hat\beta$$ then $$MSE(\hat\beta)$$ is your LSE

Least squares minimizes the sum of the squared errors between the actual value and prediction of model. This is used to find the best fit line using Gradient Descent Optimisation. The line which gives the minimum least squared error is known as best fit line

LSE = Sum over all observation((Y_actual - Y_predicted)**2)

While MSE is mostly used as evaluation error and formulae is given below

The least squares method aims to minimize:

$$\sum_{i = 1}^n\bigg( y_i - \hat y_i \bigg)^2$$

Here, $$n$$ is the number of observations, the $$y_i$$ are the observed values of $$Y$$ (all $$n$$ of them), and the $$\hat y_i$$ are the predicted values of $$Y$$ (all $$n$$ of them). By calculus, this is equivalent to minimizing the following, even though the two will have different values of their respective minima.

$$\dfrac{1}{n}\sum_{i = 1}^n\bigg( y_i - \hat y_i \bigg)^2$$

In other words, both expressions will achieve their minima for the same $$\hat y_i$$ values, even though those minimum values are different.

The second expression is the mean squared error: $$MSE= \dfrac{1}{n}\sum_{i = 1}^n\bigg( y_i - \hat y_i \bigg)^2$$