Unit 4 · Tutorial 2 of 8
The Linear Model: Features, Weights and Bias
Tutorial 1 framed the problem. This tutorial builds the model. You will write down the hypothesis function, learn to read each weight as a statement about the data, understand what the bias term actually does, and see the whole thing collapse into a single matrix multiplication.
1 Learning objectives
By the end of this tutorial you will be able to
- Write the hypothesis function for a linear model with any number of features, in both sum notation and vector notation.
- Interpret each weight as a partial effect — the change in the prediction per unit change in its feature, holding all other features constant.
- Explain what the bias (intercept) term does and why omitting it constrains the model in a way that is usually undesirable.
- Distinguish linear in the parameters from linear in the features, and explain why only the former matters for a linear model.
- Build the augmented design matrix by prepending a column of ones, and write the model compactly as ŷ = Xw.
- Compute predictions by hand from a fitted model, and reason about how the predictions change under unit changes to features or weights.
- Explain how feature scaling changes the numerical values of the weights without changing the model's predictions.
- State the principal limitations of the linear model and recognise when a linear form is inappropriate.
Estimated time
30 minutes of reading, plus 20–25 minutes for the practice exercises and problem set. The notation introduced here is used in every subsequent tutorial in this course, so it is worth getting comfortable with it now.
2 Motivating example
Tutorial 1 left us with a well-posed problem: predict the number of bike rentals at a station in the next hour, from features that will be known at the time the prediction is made.
We have a target, we have features, and we have a baseline. What we do not yet have is a model — a specific mathematical form that takes a feature vector and produces a prediction. There are infinitely many such forms. We could predict that rentals equal the square root of temperature, or that they oscillate sinusoidally with the hour of the day, or that they depend on some complicated interaction between the two.
The linear model is the simplest of these forms, and it is the one we will start with. It says: the prediction is a weighted sum of the features, plus a constant.
That is all it says. There is no hidden structure, no clever transformation, no interaction between features. Each feature contributes independently, in proportion to its value, scaled by its own weight. The model then adds everything up.
ŷ = w₁x₁ + w₂x₂ + … + wdxd + b
For the bike-share problem with a single temperature feature, this reduces to the equation of a straight line: ŷ = wx + b. With two features it becomes a flat plane in three dimensions. With many features it is a flat hyperplane in a space you cannot draw — but the arithmetic is unchanged.
You have seen this equation before, in secondary school algebra. What is new is not the mathematics. What is new is the interpretation: the weights are not arbitrary numbers to be found, they are statements about the data, and reading them correctly is most of what makes a linear model useful in practice.
What the linear model gives you
- A prediction for any feature vector
- Coefficients you can explain in plain language
- A form that is cheap to compute and cheap to store
- A fitting problem with a closed-form solution
What it costs you
- No interactions between features unless you construct them
- No curvature — the effect of a feature is constant across its range
- Very sensitive to outliers and to correlated features
- Extrapolates badly outside the observed range
3 Concept explanation
3.1 The hypothesis function
A supervised model is a function that maps a feature vector to a prediction. That function is called the hypothesis, written h(x), and it is parameterised by the weights and the bias.
Linear hypothesis function
Sum form: hw,b(x) = w₁x₁ + w₂x₂ + … + wdxd + b
Compact sum: hw,b(x) = Σj=1d wjxj + b
Vector form: hw,b(x) = wᵀx + b
The subscript on h records the fact that the function depends on the parameters. Change the weights and you get a different hypothesis from the same family. Fitting or training the model means choosing the specific w and b that make the hypothesis fit the training data well. That is the subject of Tutorials 3, 4 and 5.
This tutorial is about the family itself — what it can represent, what the parameters mean, and how to write it down efficiently.
3.2 What a weight means
Take the weight wj. It multiplies the feature xj. To understand what it does, ask what happens when xj increases by one unit while every other feature is held constant. The prediction changes by exactly wj, because wj is the only term in the sum that involves xj.
The interpretation of a coefficient
wj is the change in the predicted target per one-unit increase in feature j, holding all other features fixed.
Three things are worth noticing about that sentence:
- "holding all other features fixed" is essential. With multiple features the coefficient is a partial effect. If two features move together in the data, each coefficient describes what happens when only one of them changes — a situation that may never occur in reality. This is why interpreting coefficients from observational data as causal effects is dangerous.
- The units matter. wj carries the units of the target divided by the units of the feature. A coefficient of 20.65 in a model predicting rentals from temperature is measured in "rentals per degree Celsius". Change the feature to Fahrenheit and the coefficient changes; the predictions do not.
- The sign is meaningful. A positive coefficient means the feature pushes the prediction up; a negative coefficient pushes it down. Both are informative, and a sign that contradicts domain knowledge is usually a signal that something is wrong with the data or the framing.
3.3 The bias term
The parameter b is called the bias, the intercept, or the offset. It is the value the model predicts when every feature is exactly zero:
h(0) = b
Its role is to let the model shift up or down without changing any of the slopes. Without it, the model would be forced to pass through the origin: if all features are zero, the prediction must be zero. That is occasionally the right constraint — if you are predicting a distance from a known starting point, for example — but it is wrong far more often than it is right.
The intercept is often not physically meaningful
In the bike-share model, the fitted intercept is around −62.6 rentals. That would mean the model predicts negative rentals at 0 °C, which is obviously impossible. This is not a defect in the model. It is a reminder that the intercept describes the value of the line where it meets the y-axis, and that point is often far outside the range of the data.
The observed temperatures run from 8 °C to 30 °C. The intercept lives at 0 °C, which is extrapolation. Do not interpret it. If you want an interpretable constant, centre the feature first — subtract the mean so that zero corresponds to the average temperature — and the intercept becomes the prediction at the average.
Mechanically, the bias is easy to overlook because it is not attached to any feature. The cleanest way to handle it is to pretend it is attached to a feature that is always equal to 1. That is exactly what the augmented design matrix does, in Section 3.6.
3.4 From one feature to many
With a single feature, the model is a line: ŷ = wx + b. With two features it is a plane. With three or more it is a hyperplane — a flat surface in a space with as many dimensions as there are features.
The arithmetic does not change. You multiply each feature by its weight, add the results, and add the bias. What changes is only how many terms there are.
| Features | Hypothesis | Geometric shape |
|---|---|---|
| 1 | ŷ = w₁x₁ + b | A line in the plane |
| 2 | ŷ = w₁x₁ + w₂x₂ + b | A plane in three-dimensional space |
| 3 | ŷ = w₁x₁ + w₂x₂ + w₃x₃ + b | A three-dimensional hyperplane in four-dimensional space |
| d | ŷ = Σ wjxj + b | A (d−1)-dimensional hyperplane in d+1 dimensions |
The word hyperplane sounds intimidating, but it just means "flat". A hyperplane in four dimensions is no more conceptually difficult than a plane in three; you simply cannot picture it. The algebra is identical, and the vector notation of the next section makes that explicit.
3.5 Vector notation
Writing out a sum with a dozen terms is tedious and error-prone. The vector form is compact and generalises to any number of features:
hw,b(x) = wᵀx + b
Here w = [w₁, w₂, …, wd]ᵀ is the weight vector and x = [x₁, x₂, …, xd]ᵀ is the feature vector for one example. wᵀx is the dot product:
wᵀx = w₁x₁ + w₂x₂ + … + w_d x_d
⎡ x₁ ⎤
= [w₁ w₂ … w_d] ⎢ x₂ ⎥ = a single number
⎢ ⋮ ⎥
⎣ x_d⎦
The dot product has a useful geometric interpretation: it measures how much the feature vector aligns with the weight vector. Features whose values point in the same direction as their weights contribute positively to the prediction; features pointing against their weights contribute negatively. A large weight on a feature that is irrelevant to the target will do nothing if that feature's values are consistently near zero — which is why feature selection matters.
3.6 The augmented design matrix
Carrying the bias term separately through every derivation is awkward. The standard trick is to absorb it into the weight vector by introducing an extra feature that is always equal to 1.
Define:
x₀ = 1, w₀ = b
Then the model becomes a pure dot product with no separate constant:
h(x) = w₀x₀ + w₁x₁ + … + wdxd = wᵀx
For the whole dataset at once, stack the feature vectors into the design matrix X:
⎡ 1 x₁₁ x₁₂ ⋯ x₁d ⎤ ⎡ w₀ ⎤ ⎡ y₁ ⎤
X = ⎢ 1 x₂₁ x₂₂ ⋯ x₂d ⎥ , w = ⎢ w₁ ⎥ , y = ⎢ y₂ ⎥
⎢ ⋮ ⋮ ⋮ ⋱ ⋮ ⎥ ⎢ ⋮ ⎥ ⎢ ⋮ ⎥
⎣ 1 xₙ₁ xₙ₂ ⋯ xₙd ⎦ ⎣ wd ⎦ ⎣ yₙ ⎦
ŷ = X w (n × 1)
The design matrix has n rows — one per training example — and d+1 columns: a leading column of ones for the bias, plus one column per feature. The predictions for all n examples come from a single matrix–vector product.
Why the column of ones works
In row i of Xw, the first term of the dot product is 1 × w₀ = b. So every prediction automatically receives the same additive constant, exactly as the original formula required. The bias has not disappeared — it has simply been given a feature to attach to.
This convention is used everywhere: in the normal equation of Tutorial 3, in the matrix form of the gradient in Tutorial 4, and in every implementation of linear regression you will encounter.
3.7 What "linear" actually means
This is the point in the course where the word linear most often causes confusion, so it is worth being precise.
A linear model is linear in its parameters. It is not necessarily linear in the features.
Consider the model:
ŷ = w₀ + w₁x + w₂x²
Plotted against x, this is a parabola — clearly curved. But as a function of the parameters w₀, w₁ and w₂, it is a weighted sum. Define x₁ = x and x₂ = x², and it becomes exactly the linear model from Section 3.1. The weights enter linearly, so every technique in this unit applies without modification.
| Model | Linear in features? | Linear in parameters? | Fitted by linear regression? |
|---|---|---|---|
| ŷ = w₀ + w₁x | Yes | Yes | Yes |
| ŷ = w₀ + w₁x + w₂x² | No | Yes | Yes |
| ŷ = w₀ + w₁x₁ + w₂x₁x₂ | No | Yes | Yes |
| ŷ = w₀ + sin(w₁x) | No | No | No |
| ŷ = w₀ + w₁²x | Yes | No | No |
| ŷ = 1 / (1 + e−w₁x) | No | No | No |
The practical consequence is large. By constructing new features — squares, logs, products, indicator variables — you can fit a rich family of curved and interacting relationships using nothing more than the linear machinery of this unit. The engineering effort moves from the optimisation to the feature construction, which is where a great deal of applied machine learning actually happens.
More features is not free
Adding polynomial or interaction terms increases the number of parameters, and with it the risk of overfitting — fitting the noise in the training data rather than the signal. The bias–variance tradeoff of Tutorial 7 is exactly about this tension. For now, note that a linear model with fifty engineered features is still a linear model, and still subject to every limitation discussed in the next section.
3.8 Scaling changes the weights, not the model
Suppose you measure temperature in Celsius and fit the bike-share model, obtaining a slope of about 20.65 rentals per degree. Now convert the feature to Fahrenheit and refit. The new slope will be approximately 20.65 / 1.8 ≈ 11.47, because a one-degree change in Fahrenheit is a smaller physical change than one degree Celsius.
The predictions are identical. The model has not changed; only its parameterisation has. This has two consequences worth internalising:
- You cannot compare coefficient magnitudes across features measured in different units. A coefficient of 1,000 on a feature measured in millimetres and a coefficient of 1 on a feature measured in metres may represent the same physical effect. If you want to compare the relative importance of features, standardise them first — then all the coefficients are on the same scale.
- Feature scaling changes the loss surface. Tutorial 4 will show that the conditioning of the surface depends on the scale of the features, and Tutorial 5 will demonstrate that gradient descent can need tens of thousands of times more iterations on unscaled features than on scaled ones. The model is unchanged; the difficulty of finding it is not.
3.9 Limits of the linear model
A linear model assumes that the effect of each feature on the target is additive and constant. Both assumptions are often wrong.
| Limitation | What it means | Partial remedy |
|---|---|---|
| Non-linearity | The effect of a feature changes over its range — for example, rentals rise steeply with temperature up to about 25 °C and then flatten. | Add polynomial or spline features: x², x³, or piecewise terms. |
| Interactions | The effect of one feature depends on another — rain suppresses the effect of temperature. | Add product features: x₁x₂. |
| Outlier sensitivity | A single extreme observation can dominate the fit, because squared error grows quadratically. | Robust regression, or least absolute deviations. |
| Extrapolation | Outside the observed range, the constant-effect assumption is unlikely to hold and the prediction becomes unreliable. | None, within the linear framework. Report predictions beyond the observed range with explicit caution. |
The remedies in the third column all keep the model linear in its parameters, which means everything you learn in the rest of this unit still applies. But each one adds parameters, and each one therefore moves you closer to the overfitting problem. The discipline is to add complexity only when the residuals demand it — which is the subject of Tutorial 6.
A linear model fitted to non-linear data is not "wrong"
It is a straight line through curved data. It will still produce predictions, and those predictions may be perfectly adequate within a narrow range. What it will not do is tell you that it is struggling. That is what residual plots are for, and that is why Tutorial 6 exists. Never report a linear model's performance without looking at its residuals.
4 Visual illustration
5 Worked example
We will build and interpret a two-feature linear model for the bike-share problem, then compute predictions by hand and reason about what the coefficients mean.
Step 1 — Specify the model
Suppose we have two features available at prediction time:
- x₁ — forecast temperature in degrees Celsius
- x₂ — an indicator that equals 1 on a weekend day and 0 on a weekday
The hypothesis function is:
ŷ = w₁x₁ + w₂x₂ + b
Suppose that fitting this model to historical data — a process we will carry out properly in Tutorial 3 — gives the coefficients:
w₁ = 18.40 rentals per °C
w₂ = 62.50 rentals on weekends vs weekdays
b = −40.20 rentals
Model: ŷ = 18.40 · temperature + 62.50 · is_weekend − 40.20
Step 2 — Interpret each coefficient
| Parameter | Value | Units | Interpretation |
|---|---|---|---|
| w₁ | 18.40 | rentals per °C | Each additional degree Celsius is associated with 18.4 more rentals per hour, holding weekend status constant. |
| w₂ | 62.50 | rentals | On a weekend, the model predicts 62.5 more rentals than on a weekday at the same temperature. |
| b | −40.20 | rentals | The prediction for a weekday at 0 °C. Physically impossible, and far outside the observed temperature range — do not interpret it. |
Notice how the phrase "holding all other features fixed" does real work in the first two rows. The coefficient on temperature describes the effect of temperature at a fixed weekend status. If weekends were both warmer and busier, a model without the weekend indicator would attribute the weekend effect to temperature, inflating w₁. This is the omitted-variable problem, and it is one of the reasons coefficient interpretation from observational data requires care.
Step 3 — Compute predictions by hand
Case A: a Wednesday at 20 °C.
x₁ = 20 , x₂ = 0
ŷ = 18.40(20) + 62.50(0) − 40.20
= 368.00 + 0 − 40.20
= 327.80 rentals
Case B: a Saturday at 20 °C.
x₁ = 20 , x₂ = 1
ŷ = 18.40(20) + 62.50(1) − 40.20
= 368.00 + 62.50 − 40.20
= 390.30 rentals
The difference between the two predictions is exactly w₂ = 62.5 rentals, which is the definition of the weekend coefficient. This is the cleanest way to check that you have understood a coefficient: hold every other feature fixed, change the one you are interested in, and see how much the prediction moves.
Case C: a Sunday at 12 °C.
x₁ = 12 , x₂ = 1
ŷ = 18.40(12) + 62.50(1) − 40.20
= 220.80 + 62.50 − 40.20
= 243.10 rentals
Step 4 — Compare against the one-feature model
From Tutorial 3, the one-feature model — using only temperature — has coefficients w ≈ 20.65 and b ≈ −62.60, with an RMSE of about 10.2 rentals. The two-feature model will have a lower RMSE, but by how much depends on how much of the variation in rentals the weekend indicator actually explains.
Three observations are worth making:
- The temperature coefficient fell from 20.65 to 18.40 when the weekend indicator was added. Some of what the one-feature model attributed to temperature was in fact the weekend effect. This is normal and expected.
- The intercept moved from −62.60 to −40.20. It now refers to a different baseline: a weekday at 0 °C, rather than any day at 0 °C. The intercept is not a stable quantity; it depends entirely on what the "zero" of every feature means.
- Adding a feature cannot increase the training RMSE. The one-feature model is a special case of the two-feature model with w₂ = 0, so the two-feature model can always match it and usually improves on it. Whether that improvement generalises to new data is a different question, and it is the subject of Tutorials 6 and 7.
Step 5 — Write it in matrix form
Take the four predictions from the table below and assemble the design matrix. For a small dataset of four station-hours:
| Row | x₀ | x₁ (temp) | x₂ (weekend) | y |
|---|---|---|---|---|
| 1 | 1 | 20 | 0 | 330 |
| 2 | 1 | 20 | 1 | 395 |
| 3 | 1 | 12 | 1 | 248 |
| 4 | 1 | 12 | 0 | 186 |
⎡ 1 20 0 ⎤ ⎡ −40.20 ⎤
X = ⎢ 1 20 1 ⎥ , w = ⎢ 18.40 ⎥
⎢ 1 12 1 ⎥ ⎣ 62.50 ⎦
⎣ 1 12 0 ⎦
ŷ = Xw
⎡ 1 20 0 ⎤ ⎡ −40.20 ⎤ ⎡ 1(−40.20) + 20(18.40) + 0(62.50) ⎤ ⎡ 327.80 ⎤
⎢ 1 20 1 ⎥ ⎢ 18.40 ⎥ = ⎢ 1(−40.20) + 20(18.40) + 1(62.50) ⎥ = ⎢ 390.30 ⎥
⎢ 1 12 1 ⎥ ⎢ 62.50 ⎥ ⎢ 1(−40.20) + 12(18.40) + 1(62.50) ⎥ ⎢ 243.10 ⎥
⎣ 1 12 0 ⎦ ⎣ ⎦ ⎣ 1(−40.20) + 12(18.40) + 0(62.50) ⎦ ⎣ 180.60 ⎦
Every row of the output is one prediction, computed as a single dot product. The leading column of ones is doing nothing except adding b = −40.20 to every row, exactly as intended.
The residuals for these four rows are [330−327.80, 395−390.30, 248−243.10, 186−180.60] = [+2.20, +4.70, +4.90, +5.40]. All four are positive, which suggests the model is systematically under-predicting on this small sample. On a larger dataset that pattern would be a warning sign — it is exactly the kind of thing Tutorial 6 teaches you to look for.
The same computation in code
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
df = pd.DataFrame({
"temp_c": [20, 20, 12, 12],
"is_weekend": [ 0, 1, 1, 0],
"rentals": [330, 395, 248, 186],
})
X = df[["temp_c", "is_weekend"]].to_numpy()
y = df["rentals"].to_numpy()
# --- Route 1: the augmented design matrix, by hand ---
n = len(X)
X_aug = np.column_stack([np.ones(n), X]) # prepend a column of ones
w_aug = np.linalg.solve(X_aug.T @ X_aug, X_aug.T @ y)
b, w1, w2 = w_aug
print(f"by hand : ŷ = {w1:.2f}·temp + {w2:.2f}·weekend + ({b:.2f})")
# --- Route 2: scikit-learn ---
model = LinearRegression().fit(X, y)
print(f"sklearn : ŷ = {model.coef_[0]:.2f}·temp "
f"+ {model.coef_[1]:.2f}·weekend + ({model.intercept_:.2f})")
# --- Predict three cases ---
cases = pd.DataFrame({
"case": ["Wed 20°C", "Sat 20°C", "Sun 12°C"],
"temp_c": [20, 20, 12],
"is_weekend": [ 0, 1, 1],
})
cases["predicted"] = model.predict(cases[["temp_c", "is_weekend"]])
print()
print(cases.to_string(index=False))
# --- Fitted values and residuals on the training data ---
df["y_hat"] = model.predict(X)
df["residual"] = df["rentals"] - df["y_hat"]
print()
print(df.to_string(index=False))
print(f"\nRMSE = {np.sqrt((df['residual'] ** 2).mean()):.2f} rentals")
by hand : ŷ = 18.40·temp + 62.50·weekend + (-40.20)
sklearn : ŷ = 18.40·temp + 62.50·weekend + (-40.20)
case temp_c is_weekend predicted
Wed 20°C 20 0 327.80
Sat 20°C 20 1 390.30
Sun 12°C 12 1 243.10
temp_c is_weekend rentals y_hat residual
20 0 330 327.80 2.20
20 1 395 390.30 4.70
12 1 248 243.10 4.90
12 0 186 180.60 5.40
RMSE = 4.59 rentals
The RMSE of 4.59 rentals is far lower than the one-feature model's 10.2 on the eight-point dataset — but note that these are different datasets of different sizes, so the comparison is not meaningful. The point of this example is the interpretation of the coefficients, not the fit quality.
6 Interactive activity
Move the line, move the plane
Work through the following in the Tutorial 2 notebook. Each item asks you to predict what will happen before you run the code, then check.
- Slope and intercept, separately. Using the eight-point bike-share dataset from Tutorial 1, plot the data and draw the line ŷ = 20.65x − 62.60. Now hold b fixed and increase w to 25. What happens to the line? Now hold w fixed at 20.65 and increase b to 0. What happens? Describe the two effects in words.
- Add the weekend feature. Using the four-row two-feature dataset from the worked example, fit the model with and without the weekend indicator. How much does the temperature coefficient change? Why?
- Drop the bias. Refit the one-feature model with the intercept forced to zero. What is the new slope? Compute the residuals. Do they sum to zero? Why not?
- Change the units. Convert temperature from Celsius to Fahrenheit in the two-feature model and refit. Record the three coefficients. Verify that the predictions for a given physical temperature are unchanged.
- Add a polynomial term. Add x² to the one-feature model and refit. Is the model still linear in its parameters? Plot the fitted curve — is it a straight line? What happens to the training RMSE?
- Add an interaction. Add the product x₁ × x₂ (temperature times weekend) to the two-feature model. Interpret the new coefficient. What does a non-zero interaction mean in plain language?
Show the discussion
- Slope rotates, intercept translates. Increasing w from 20.65 to 25 makes the line steeper — it pivots about the point where it crosses the intercept, so the predictions at high temperature rise and the predictions at low temperature fall. Increasing b from −62.60 to 0 shifts the entire line upward by 62.6 rentals at every temperature, without changing its steepness. These two parameters control two independent aspects of the line: its angle and its height.
- The temperature coefficient falls. In the worked example it dropped from about 20.65 to 18.40. Some of the variation the one-feature model attributed to temperature was actually the weekend effect, because weekends may coincide with warmer days in the sample. The two-feature model can separate the two effects, and each coefficient becomes a purer measure of its own feature.
- The residuals do not sum to zero. Without an intercept, the line is forced through the origin. Since all the observed rentals are positive and all the temperatures are positive, the constrained line systematically under-predicts and the residuals are all positive. The property Σei = 0 comes from the first normal equation, which only exists when b is a free parameter. Remove it and the property disappears.
- All three coefficients change; predictions do not. The temperature coefficient divides by 1.8, becoming about 10.22. The intercept shifts to absorb the offset introduced by the transformation. The weekend coefficient is unchanged, because the weekend feature was not rescaled. Predictions for a given physical temperature are identical to those from the Celsius model to within floating-point precision.
- Still linear, but no longer straight. The model ŷ = w₀ + w₁x + w₂x² is linear in its parameters, so least squares applies unchanged. But plotted against x it is a parabola. The training RMSE necessarily falls — you have added a parameter — but whether that improvement is real or merely fitting noise is the question Tutorial 7 answers.
- The interaction coefficient measures non-additivity. If the coefficient on x₁x₂ is positive, the effect of temperature is larger on weekends than on weekdays. If it is negative, the effect is smaller. If it is near zero, the two effects are additive and the interaction is not earning its parameter. This is the standard way to test whether two features act independently.
The habit worth building
Every time you add, remove or transform a feature, ask three questions: what happened to the predictions, what happened to each coefficient, and does the change make sense given what I know about the problem? A model whose coefficients you cannot predict the behaviour of is a model you do not yet understand.
7 Self-check questions
Answer each question in your own words before revealing the answer.
Question 1
A model predicting delivery time has the form ŷ = 4.2 · distance − 1.8 · traffic_index + 12.0, where distance is in kilometres and the traffic index runs from 0 (clear) to 10 (gridlocked). Interpret all three numbers, with units.
Show answer
- 4.2 — each additional kilometre is associated with 4.2 more minutes of delivery time, holding the traffic index constant. Units: minutes per kilometre.
- −1.8 — each additional point on the traffic index is associated with 1.8 fewer minutes, holding distance constant. Units: minutes per index point. The negative sign is a red flag: heavier traffic should make deliveries slower, not faster. This coefficient contradicts domain knowledge and would need investigation — perhaps the traffic index is measured in a way that inverts its meaning, or there is a confounding variable.
- 12.0 — the predicted delivery time for a zero-kilometre trip in zero traffic. Units: minutes. Physically meaningless, and outside the range of the data. Do not interpret it.
Question 2
What is the purpose of the bias term, and what happens to the model if you remove it?
Show answer
Remove it and the model is forced to pass through the origin: if all features are zero, the prediction must be zero. This is occasionally the correct constraint — for example when predicting a distance from a known starting point — but it is usually wrong. The practical consequence is that the residuals will no longer sum to zero, and the fit will be systematically biased whenever the target's natural range does not include zero.