Linear regression
Linear Regression
Definition
A model that predicts a continuous numeric value as a weighted sum of the features: ŷ = w₀ + w₁x₁ + … + wₙxₙ.
Core idea
We look for the line (or plane) that makes the sum of squared differences between the true and predicted values as small as possible (Least Squares).
How it works
- We choose the numeric features and encode the categorical ones
- We compute the weights that minimize the sum of squared errors
- Each weight is how much the target changes when the feature increases by one unit, holding the others fixed
- We evaluate on test data with regression metrics
Data type and problem type
| Data type | Numeric tabular data (categorical after encoding) |
|---|---|
| Problem type | Regression |
Strengths
- Fast, simple and interpretable
- An excellent baseline
- Does not need much data
Limitations
- Assumes a linear relationship
- Sensitive to outliers
- Affected by high correlation between features (Multicollinearity)
Key parameters
- Regularization: Ridge (L2) or Lasso (L1) and its strength
- Adding a constant term (Intercept)
Evaluation metrics
- MAE (mean absolute error)
- RMSE (root mean squared error)
- R² (coefficient of determination)
Supporting tools
| Orange | Linear Regression |
|---|---|
| KNIME | Linear Regression Learner + Regression Predictor |
| WEKA | functions.LinearRegression |
Applied examples
- Estimating a student's grade from study hours
- Estimating the price of a house from its area and location
- Estimating a penguin's body mass from its measurements
