Regularization

 

馃Why Do We Need Regularization?

In machine learning, especially with complex models:

  • The model may fit training data extremely well
  • But perform poorly on new data → overfitting

馃憠 Regularization is a strategy to control model complexity and improve generalization.


馃摌What is Regularization?

馃敼 Definition

Regularization adds a penalty term to the learning objective to discourage overly complex models.


馃搻 Standard Learning Objective

Without regularization:

Minimize: Loss Function\text{Minimize: Loss Function}

With regularization:

Minimize: Loss + Penalty\text{Minimize: Loss + Penalty}

馃敡 General Form

L(w)=Error(w)+(w)\mathcal{L}(w) = \text{Error}(w) + \lambda \cdot \Omega(w)

Where:

  • w → model parameters
  •  → regularization strength
  • (w)→ penalty function

馃幆 Role of 位 (Lambda)

  • =0 → no regularization
  • Small \lambda → slight penalty
  • Large \lambda → strong constraint

馃憠 Controls bias–variance tradeoff


⚖️ Effect of Regularization

EffectOutcome
Reduces variance    Less overfitting
Increases bias    Slight underfitting possible
Shrinks coefficients    Simpler model

⚖️Regularization and Generalization

Regularization helps:

  • Reduce variance
  • Improve generalization
  • Control model complexity

馃攣 Bias–Variance Tradeoff

EffectOutcome
Increase regularization    ↑ Bias, ↓ Variance
Decrease regularization    ↓ Bias, ↑ Variance

馃憠 Goal: optimal balance


馃搻 Mathematical Framework

馃敼 Standard Objective

Without regularization:

minw  L(w)\min_{w} \; \mathcal{L}(w)

馃敼 With Regularization

minw  L(w)+(w)\min_{w} \; \mathcal{L}(w) + \lambda \cdot \Omega(w)

Where:

  • L(w)\mathcal{L}(w)→ loss function
  • (w)\Omega(w)→ regularization term
  • 位 → regularization strength

馃幆 Interpretation of 位

位 ValueEffect
0        No regularization
Small        Mild constraint
Large        Strong constraint (may underfit)

馃ЗTypes of Regularization


馃敹L1 Regularization (LASSO)

馃搻 Penalty:

wi\sum |w_i|

馃敼 Characteristics:

  • Produces sparse models
  • Some coefficients become exactly zero
  • Performs feature selection

✅ Advantages:

  • Interpretable models
  • Useful for high-dimensional data

⚠️ Limitations:

  • Unstable with correlated features

馃敺 L2 Regularization (Ridge)

馃搻 Penalty:

wi2\sum w_i^2

馃敼 Characteristics:

  • Shrinks coefficients smoothly
  • No exact zeros

✅ Advantages:

  • Stable
  • Handles multicollinearity well

馃煟  Elastic Net

馃搻 Combination:

1wi+2wi2\lambda_1 \sum |w_i| + \lambda_2 \sum w_i^2

馃敼 Characteristics:

  • Combines L1 + L2
  • Balances sparsity and stability

✅ Use case:

  • When features are correlated
  • When LASSO alone is unstable

馃尦  Regularization in Tree-Based Models


馃敼 Techniques:

  • Max depth restriction
  • Minimum samples per leaf
  • Pruning

馃幆 Effect:

  • Prevents overly complex trees
  • Controls variance

馃 Regularization in Neural Networks


馃敼 1. Weight Decay

  • Equivalent to L2 regularization

馃敼 2. Dropout

  • Randomly deactivate neurons during training

Effect:

  • Prevents co-adaptation
  • Improves generalization

馃敼 3. Early Stopping

  • Stop training when validation error increases

馃敼 4. Batch Normalization (Indirect)

  • Stabilizes training
  • Acts as mild regularizer

馃И  Data-Based Regularization


馃敼 Data Augmentation

  • Generate new training samples
  • Common in image/text tasks

馃敼 Noise Injection

  • Add noise to inputs or weights

馃搳 Geometric Interpretation

MethodShapeEffect
L1Diamond        Sparsity
L2Circle        Smooth shrinkage

馃攳 Practical Workflow

  1. Split data (train/validation/test)
  2. Normalize features
  3. Choose regularization type
  4. Tune 位 using validation or cross-validation
  5. Evaluate on test set

馃摎 Theoretical Insight (Advanced Note)

From a probabilistic perspective:

Regularization    Equivalent Prior
L1    Laplace prior
L2    Gaussian prior

馃憠 Connects to Bayesian learning (important from Bishop)


馃幆 Role of Regularization in ML Systems

Regularization is critical for:

  • High-dimensional datasets
  • Deep learning models
  • Noisy real-world data
  • Preventing model instability

馃搳Summary Table

MethodKey IdeaEffect
L1 (LASSO)    Absolute penalty    Sparse models
L2 (Ridge)    Squared penalty    Smooth shrinkage
Elastic Net    Combination    Balanced approach
Dropout    Random neuron removal    Robust NN
Early stopping    Stop training early    Avoid overfit
Tree pruning    Limit tree growth    Reduce variance

馃幆Key Takeaways for Students

  • Regularization controls model complexity
  • Essential for good generalization
  • L1 → feature selection
  • L2 → stability
  • 位 must be carefully tuned

Comments

Popular posts from this blog

Machine Learning PCCST503 Semester5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Machine Learning (ML)

Distinguishing Machine Learning from Traditional Programming