Many Features at Once
Multiple linear regression.
Your boss drops by. The line through rooms is lovely, the boss says, but a house is more than its rooms. What about income in the area? Location? Age? The answer is a simple upgrade. Instead of one slope, we give the model one slope for every feature.

- A house is more than rooms
- One slope per feature
- The same idea, more numbers
From a line to many weights
With one feature, price equals slope times rooms, plus a start. With eight features, it is just longer. Price equals weight one times income, plus weight two times age, and so on, plus a start. Each weight says how much that feature pushes the price up or down. With two features, the line becomes a flat plane. With eight, we cannot draw it, but the maths is exactly the same, and gradient descent still works.
Training on all eight features
Let's train on the whole dataset. Fit takes all the columns at once. Then we print each feature with its learned weight. Look at the output. Med inc has a positive weight, so higher income means a higher price. Latitude and longitude are negative, which means prices fall as you move north and east, away from the rich coast. The model worked out California's geography, from numbers alone.
from sklearn.datasets import fetch_california_housing
from sklearn.linear_model import LinearRegression
data = fetch_california_housing(as_frame=True)
X = data.data
y = data.target
model = LinearRegression().fit(X, y)
for name, weight in zip(X.columns, model.coef_):
print(f"{name:<11} {weight:8.4f}")
print(f"{'start':<11} {model.intercept_:8.2f}")MedInc 0.4367 HouseAge 0.0094 AveRooms -0.1073 AveBedrms 0.6451 Population -0.0000 AveOccup -0.0038 Latitude -0.4213 Longitude -0.4345 start -36.94
Summary
Eight features, eight weights, one start. And each weight tells a story about the data. But is the model any good? How close are its prices, in real dollars? Next, the numbers that answer that question.
Key takeaways- One weight per feature
- Weights can be read and explained
- Same training, more dimensions