# Maximum likelihood estimator compared to least squares [duplicate]

The maximum likelihood estimator is often compared to the least squares method. I'm struggling to see how these things are related at all. I would like to understand what the maximum likelihood estimator means in practice. Can you adapt the maximum likelihood estimator to the example below and use the example to explain it?

Let's say we are trying to predict house prices (target) from the size of the house (as the only feature). We are using Linear Regression, so we are trying to learn (optimize) parameters B0 and B1 in predicted price = B0 + B1 * size. If we are using Ordinary Least Squares, we want to minimize the sum of squared differences between prediction and real target. For example, if we predict target 1000 for some house and the actual target is 900, the difference is 100. The squared difference is 100^2 = 10000. So this house would increase the sum by 10000. We want to choose B0 and B1 in a way that minimizes the sum of these squares. Simple.

Now substitute Maximum Likelihood Estimator in place of Ordinary Least Squares. Wikipedia tells us that it's "finding the parameter values that maximize the likelihood of making the observations given the parameters". How does this relate to the example with parameters B0, B1 and a difference of 100 between predicted target and real target?

$$\frac{-n}{2} \log(\sigma^{2}) - \frac{1}{2 \sigma^{2}} \sum_{i=1}^{n} (y_{i}-x_{i} \beta)^{2}$$