In multiple linear regression, what does each coefficient represent?
Think about how one feature affects the output when others do not change.
Each coefficient shows how much the predicted value changes when that feature increases by one unit, assuming other features stay the same.
Given a multiple linear regression model with coefficients [2, -1, 0.5] and intercept 3, what is the predicted value for input features [4, 2, 6]?
coefficients = [2, -1, 0.5] intercept = 3 features = [4, 2, 6] prediction = intercept + sum(c * f for c, f in zip(coefficients, features)) print(prediction)
Calculate each product, then add them all plus the intercept.
Prediction = 3 + (2*4) + (-1*2) + (0.5*6) = 3 + 8 - 2 + 3 = 12.
You want to reduce overfitting in a multiple linear regression model by adding a penalty on large coefficients. Which regularization method should you choose if you want some coefficients to become exactly zero?
Think about which method can shrink coefficients to zero, effectively selecting features.
L1 regularization (Lasso) can shrink some coefficients exactly to zero, performing feature selection and reducing model complexity.
What does an R-squared value of 0.85 indicate about a multiple linear regression model?
R-squared measures how well the model explains the data variance.
An R-squared of 0.85 means the model explains 85% of the variation in the target variable, showing good fit.
What error will this code raise when predicting with a multiple linear regression model?
import numpy as np coefficients = np.array([1.5, -2.0, 0.7]) intercept = 0.5 features = np.array([2, 3]) prediction = intercept + np.dot(coefficients, features) print(prediction)
Check if the number of features matches the number of coefficients.
The dot product requires vectors of the same length. Here, coefficients have length 3 but features have length 2, causing a ValueError.
