Linear regression is the first model worth learning because it is simple and explainable. The idea is easy: draw one straight line through the data points so the total error is smallest.
Picture Cambodia's GDP-per-capita data from the World Bank: the x axis is the year, the y axis is GDP. A straight line y = a·x + b has two numbers: a, the slope, tells how much GDP grows per year, and b is the intercept. Training means finding the a and b that minimise the sum of squared errors — the least squares method.
The full form handles many features: y = a₁·x₁ + a₂·x₂ + … + b. For example: house price ≈ a₁·size + a₂·rooms + a₃·distance-to-market + b. Each a tells how much that feature contributes while the others stay fixed.
A key rule: correlation is not causation. If ice-cream sales and sea-bathing numbers rise together in the hot season, ice cream did not cause the swimming — the weather caused both. A straight-line model only sees correlation.
What to remember:
- Linear regression = the straight line that minimises squared error
- a = how much y changes when x rises by one unit
- Use it as a baseline before trying more complex models