Regularization in machine learning is used to prevent overfitting in models, particularly in cases where the model is complex and has a large number of parameters.
Overfitting occurs when a model becomes too closely aligned with its training data, resulting in poor performance on unseen data. Regularization techniques can reduce overfitting by adding the constraint/penalty to the loss function.
https://www.statology.org/5-regularization-techniques/