← Back to Resources

Regularization

Practical Resources - AI Engineering

Regularization is a family of techniques that deliberately constrain a model, trading a small amount of training accuracy for better generalisation to new data. It's one of the main tools for fighting the overfitting side of the bias-variance tradeoff.


Common techniques:

How much regularization is right? This is itself a hyperparameter to tune (see Hyperparameter Tuning), not a fixed rule. Too little and you're still overfitting; too much and you push the model back towards underfitting by constraining it more than the data actually calls for. Watch the gap between training and validation performance as you adjust the regularization strength — that gap narrowing (without both getting worse) is the sign you're moving in the right direction.

Why is this important? A model that performs beautifully on training data but poorly in the real world is arguably worse than a slightly less accurate model that generalises reliably — the whole point of building a model is for it to work on data it hasn't seen yet. Regularization is one of the most direct, well-understood levers for closing that gap.

Where to go deeper: scikit-learn's documentation on Ridge and Lasso regression gives concrete, code-backed examples of L1 vs. L2 regularization in practice.