TL;DRLinear regression fits a straight line — the simplest predictor of a continuous value.
It models the target as a weighted sum of features plus a bias (y = w·x + b), fitting the line that minimizes squared error. It's interpretable (each weight is a feature's effect), fast, and a strong baseline. Its limits: it assumes a linear relationship and is sensitive to outliers. Always try it first — beating a simple baseline is the bar for a complex model.
Key points
y = w·x + b, fit by minimizing squared error
Interpretable: weights = feature effects
Fast, a strong baseline
Assumes linearity; outlier-sensitive
Common mistakes
Forcing it onto clearly nonlinear data
Ignoring outliers skewing the fit
Skipping it as a baseline before complex models
Try it: Explain what each weight in a linear model represents.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>price = w1·area + w2·beds + b
each w = that feature’s effect on price
baseline first → then beat it</pre></body></html>