Linear regression is the simplest and most interpretable regression model: it fits a straight-line relationship between the features and a continuous target. It's the baseline every regression problem should start from.
Fitting a model
from sklearn.linear_model import LinearRegressionmodel = LinearRegression()model.fit(X_train, y_train)model.coef_ # the weight per featuremodel.intercept_ # the bias termmodel.predict(X_test)
Interpreting coefficients
Each coefficient is the predicted change in the target for a one-unit increase in that feature, holding the others constant — so linear models tell you not just what they predict but why.
Key takeaways
- 01Linear regression fits a linear relationship between features and a continuous target.
- 02coef_ gives the per-feature weights; intercept_ the bias.
- 03A coefficient is the target change per unit of that feature, holding others constant.
- 04It's interpretable and a strong baseline — but assumes linearity and dislikes outliers.
