Search⌘ K
AI Features

The Linear Regression Model

Explore how linear regression models use features like distance to predict delivery times. Understand coefficients such as intercept and slope, learn the ordinary least squares method, and evaluate model accuracy using residuals and error metrics to improve forecasting reliability.

A delivery record with distance_km values of 1, 3, and 5 can have delivery times of 12, 18, and 24 minutes. Predicting the same average time for every order ignores information that dispatch can act on. Distance gives us a simple numeric feature for forecasting delivery_minutes.

distance_km

delivery_minutes

1

12

3

18

5

24

A slope is the change in a prediction when the feature increases by one unit. For these deliveries, a slope of 3 means each additional kilometer adds 3 predicted minutes. The operational unit matters. We read the slope as minutes per kilometer, not as a unit-free score.

An intercept is the prediction when the feature equals zero. If a delivery model has an intercept of 9, it predicts 9 minutes at 0 kilometers. That might represent fixed work such as accepting the order and handing it to a courier. The intercept can be useful even when a zero-kilometer delivery is not a realistic order.

Turning a line into delivery predictions

With distance as the feature, a linear regression uses a straight line to produce a predicted delivery time:

Here, y^\hat{y} is the ...