Regularization

Tiya Vaj
2 min readApr 30, 2024

Regularization techniques are indeed used to penalize the complexity of a model by adding a penalty term to the loss function. This penalty encourages the model to prioritize simpler explanations or solutions, thus helping to prevent overfitting.

Two common types of regularization techniques are L1 regularization (Lasso regularization) and L2 regularization (Ridge regularization):

1. L1 Regularization (Lasso): In L1 regularization, the penalty term added to the loss function is proportional to the absolute values of the model’s parameters. Mathematically, this penalty term is represented as the L1 norm of the parameter vector. L1 regularization tends to encourage sparsity in the parameter values, effectively setting some of them to zero, which can lead to feature selection. L1 regularization is useful when the problem has many irrelevant features that can be removed.

2. L2 Regularization (Ridge): In L2 regularization, the penalty term added to the loss function is proportional to the square of the magnitudes of the model’s parameters. Mathematically, this penalty term is represented as the square of the L2 norm of the parameter vector. L2 regularization penalizes large parameter values more strongly than small ones, leading to more evenly distributed parameter values and often smoother models. L2 regularization is effective at preventing the model from becoming overly complex and tends to work well when all features are relevant to the problem.

These regularization techniques can be applied independently or combined to control the complexity of the model and prevent overfitting. By penalizing large parameter values, regularization encourages the model to generalize better to unseen data and reduces the risk of overfitting to the training data.

--

--

Tiya Vaj

Ph.D. Research Scholar in NLP and my passionate towards data-driven for social good.Let's connect here https://www.linkedin.com/in/tiya-v-076648128/