Regression: predict a value, not a category
Regression predicts a numerical target, such as a duration or a sensor reading. A linear regressor learns a weighted sum of input features plus an intercept; nonlinear models can predict numerical targets too.
The output being a number is not enough to define regression. A classifier's probability is numerical, but its target is still a category.
Fitting is a matrix operation
NumPy can fit a small linear model without an iterative training loop. The final column of ones supplies the intercept.
import numpy as np
x = np.array([0., 1., 2., 3.])
y = np.array([2., 5., 8., 11.])
design = np.column_stack([x, np.ones_like(x)])
weights, _, _, _ = np.linalg.lstsq(design, y, rcond=None)
prediction = np.array([4., 1.]) @ weights
The fitted line is 3*x + 2, so the prediction at four is fourteen. Real data need not lie on a line; least squares chooses coefficients minimizing the summed squared residuals.
That objective gives large errors disproportionate influence. Absolute-error and quantile losses answer different questions about the target distribution. A regression output is also not automatically a confidence interval: uncertainty needs its own model or estimation procedure.