Skip to main content
Albero Academy

Linear Regression

Predict a continuous value by fitting a line (or hyperplane).

Regression9 min

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

fit, predict, inspect
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X_train, y_train)
model.coef_ # the weight per feature
model.intercept_ # the bias term
model.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

  1. 01Linear regression fits a linear relationship between features and a continuous target.
  2. 02coef_ gives the per-feature weights; intercept_ the bias.
  3. 03A coefficient is the target change per unit of that feature, holding others constant.
  4. 04It's interpretable and a strong baseline — but assumes linearity and dislikes outliers.

Finished this chapter?

Mark it complete to track your progress through Scikit-learn.