It's exactly the same code as Simple Regression! The matrix math (`X * w`) handles any number of columns automatically.
from sklearn.linear_model import LinearRegression
# 1. Data with 2 Features (Size, #Rooms)
X = [
[1500, 3], # House 1
[2000, 4], # House 2
[800, 1] # House 3
]
y = [300000, 500000, 150000] # Prices
# 2. Train Model
model = LinearRegression()
model.fit(X, y)
# 3. Predict new house
# Size: 1200, Rooms: 2
prediction = model.predict([[1200, 2]])
print(f"Coefficients: {model.coef_}")
# Output: [150.5, 4000.2] (Weight per sqft, Weight per room)