Regression Isn’t Regularization: A Simple Guide to Understanding Both

작성자

카테고리:

← 피드로
DEV Community · NelimaL · 2026-07-27 개발(SW)
Cover image for Regression Isn’t Regularization: A Simple Guide to Understanding Both

NelimaL

Regression and regularization are both important concepts in machine learning and statistics, but they solve different problems.

  • Regression is primarily used to model relationships and make predictions.
  • Regularization is used to improve a model’s ability to generalize by controlling its complexity.

Regression

This is a statistical and machine learning technique used to predict a continuous numerical outcome based on one or more input variables.
For example, we might want to predict:

  • A house’s price based on its size and location
  • A student’s exam score based on study hours
  • A company’s sales based on advertising spending

Simple Linear Regression

In simple linear regression, we model the relationship between an input variable (x) and an output (y):
$$
y = \beta_0 + \beta_1x + \epsilon
$$

Where:

  • (y) is the predicted outcome
  • (\beta_0) is the intercept
  • (\beta_1) is the coefficient or slope
  • (x) is the input variable
  • (\epsilon) represents the error The model learns values for (\beta_0) and (\beta_1) that make its predictions as close as possible to the actual values.

Multiple Linear Regression

In multiple linear regression, several predictors are used:
$$
y = \beta_0 + \beta_1x_1 + \beta_2x_2 + \cdots + \beta_px_p + \epsilon
$$

The goal is typically to minimize the sum of squared errors (SSE):
$$
\text{SSE} = \sum_{i=1}^{n}(y_i – \hat{y}_i)^2
$$
This approach is known as Ordinary Least Squares (OLS).

Regularization

Regularization is a technique used to prevent a machine learning model from becoming too complex.
A model can perform extremely well on training data but poorly on new, unseen data. This problem is called overfitting.
Regularization addresses overfitting by adding a penalty for large model coefficients to the model’s objective function.

Instead of minimizing only the prediction error, the model minimizes:
$$

\text{Prediction Error} + \text{Complexity Penalty}
$$
The penalty discourages the model from relying too heavily on individual features.

The Main Types of Regularization

1. Ridge Regression: L2 Regularization

Ridge regression adds a penalty based on the squared values of the coefficients:
$$

\text{Loss}

\sum_{i=1}^{n}(y_i – \hat{y}i)^2
+
\lambda\sum
{j=1}^{p}\beta_j^2
$$
Here, (\lambda) controls the strength of the regularization.

  • If (\lambda = 0), the model is equivalent to ordinary linear regression.
  • A larger (\lambda) creates a stronger penalty.
  • Coefficients become smaller, but generally do not become exactly zero. Ridge regression is particularly useful when predictors are highly correlated.

2. Lasso Regression: L1 Regularization

Lasso regression uses the absolute values of the coefficients:
$$

\text{Loss}

\sum_{i=1}^{n}(y_i – \hat{y}i)^2
+
\lambda\sum
{j=1}^{p}|\beta_j|
$$
Unlike Ridge regression, Lasso can shrink some coefficients exactly to zero.

This means Lasso can perform a type of feature selection by effectively removing less important variables from the model.

3. Elastic Net

Elastic Net combines both L1 and L2 regularization:
$$

\text{Loss}

\text{SSE}
+
\lambda_1\sum_j|\beta_j|
+
\lambda_2\sum_j\beta_j^2
$$

It combines:

  • Lasso’s ability to perform feature selection
  • Ridge’s ability to handle correlated features

Key Difference Between Regression and Regularization

The simplest way to understand the difference is:

Regression builds a model to explain or predict an outcome. Regularization modifies the learning process to control the model’s complexity.

For example, ordinary linear regression might optimize the following objective:
$$
\min_{\beta} \text{SSE}
$$
Ridge regression changes it to:
$$
\min_{\beta}
\left(
\text{SSE}
+
\lambda\sum_j\beta_j^2
\right)
$$
The underlying task is still regression. Regularization simply adds a constraint or penalty to make the model less likely to overfit.

A Practical Example

Imagine you are predicting house prices using 100 features, including:

  • Square footage
  • Number of bedrooms
  • Location
  • Age of the house
  • Distance to schools
  • Various highly correlated measurements

An ordinary regression model may fit the training data very closely. However, if there are too many features or strong correlations between them, the model may overfit.
Regularization can help:

  • Ridge regression shrinks the coefficients of correlated variables.
  • Lasso regression may reduce some coefficients to zero.
  • Elastic Net combines both strategies. As a result, the model may perform better on new, unseen houses.

Comparison Table

Here is the corrected and clearly formatted Markdown table:

Feature Ordinary Regression Regularized Regression Main purpose Model relationships and make predictions Reduce overfitting and control complexity Objective Minimize prediction error Minimize prediction error plus a penalty Coefficients Can become very large Penalized and typically smaller Feature selection Usually no Lasso can select features Handles multicollinearity Can be sensitive Ridge handles it well Generalization May overfit Often improves performance on unseen data

The Bias-Variance Tradeoff

Regularization works by introducing a small amount of bias in exchange for reducing variance.

An Unregularized Model May Have:

  • Low training error
  • High variance
  • Poor performance on new data

A Strongly Regularized Model May Have:

  • Higher training error
  • Lower variance
  • Better generalization

The goal is to find the right balance.
The regularization parameter (\lambda) is commonly selected using cross-validation.

Important Practical Note: Feature Scaling

Regularization is sensitive to the scale of features.
For example:

  • Age might range from 0 to 100.
  • Income might range from $20,000 to $200,000.

Because regularization penalizes coefficient sizes, variables with different scales can be treated unfairly. Therefore, features are often standardized before applying Ridge, Lasso, or Elastic Net.

Takeaway

Regression and regularization are not competing concepts.
Regression answers:

How can we model the relationship between inputs and a numerical outcome?
Regularization answers:
How can we prevent that model from becoming unnecessarily complex and overfitting the training data?

Ordinary linear regression focuses on minimizing prediction error. Regularized regression adds a penalty that discourages overly large coefficients. Ridge, Lasso, and Elastic Net are common examples of regularized regression techniques.

A useful way to remember the distinction is:

Regression learns the relationship. Regularization controls the complexity of what is learned.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다