Simple theory: Linear regression predicts a continuous number by fitting a straight line through data. The best line is the one whose predictions are closest to the real values on average.
Imagine you're trying to predict the price of a house based on its size. Bigger house → higher price. Simple, right? That relationship — finding a straight line through data points — is exactly what Linear Regression does.
How does it work?
The algorithm tries different lines and measures how wrong each one is. The total wrongness is called the Loss (or Error). It keeps adjusting the line until the loss is as small as possible.
The line is described by two numbers: Slope (how steep it is) and Intercept (where it crosses the y-axis). These are the model's parameters that it learns from data.