Open In App

Regularization by Early Stopping

Last Updated : 21 Sep, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Regularization is a kind of regression where the learning algorithms are modified, to reduce overfitting. This may incur a higher bias but will lead to lower variance when compared to non-regularized models i.e. increases generalization of the training algorithm.

Why Regularisation is needed?

In a general learning algorithm, the dataset is divided into a training set and a test set. After each epoch of the algorithm, the parameters are updated accordingly after understanding the dataset. Finally, this trained model is applied to the test set.

Generally, the training set error will be less compared to the test set error. This is because of overfitting whereby the algorithm memorizes the training data and produces the right results on the training set. So, the model becomes highly exclusive to the training set and fails to produce accurate results for other datasets including the test set.

Regularization techniques are used in such situations to reduce overfitting and increase the model’s performance on any general dataset.

To understand about underfitting and overfitting in machine learning in detail follow the link below-

ML| Underfitting and Overfitting.

What is Early Stopping?

In Regularization by Early Stopping, we stop training the model when the performance on the validation set is getting worse- increasing loss decreasing accuracy, or poorer scores of the scoring metric. By plotting the error on the training dataset and the validation dataset together, both the errors decrease with a number of iterations until the point where the model starts to overfit. After this point, the training error still decreases but the validation error increases.

So, even if training is continued after this point, early stopping essentially returns the set of parameters that were used at this point and so is equivalent to stopping training at that point. So, the final parameters returned will enable the model to have low variance and better generalization. The model at the time the training is stopped will have a better generalization performance than the model with the least training error.

early-stoppingon the validation set is getting worse- increasing loss or decreasing accuracy or poorer scores

Early stopping can be thought of as implicit regularization, contrary to regularization via weight decay. This method is also efficient since it requires less amount of training data, which is not always available. Due to this fact, early stopping requires lesser time for training compared to other regularization methods. Repeating the early stopping process many times may result in the model overfitting the validation dataset, just as similar as overfitting occurs in the case of training data.

The number of iterations(i.e. epoch) taken to train the model can be considered a hyperparameter. Then the model has to find an optimum value for this hyperparameter (by hyperparameter tuning) for the best performance of the learning model.

Tip: The downside of early stopping are as follows: 

By stopping early , we can’t able to optimize Cost function(J) much for the training set. So, we use a different concept Known as Orthogonalisation is used.

Benefits of Early Stopping:

  • Helps in reducing overfitting
  • It improves generalisation
  • It requires less amount of training data
  • Takes less time compared to other regularisation models
  • It is simple to implement

Limitations of Early Stopping:

  • If the model stops too early, there might be risk of underfitting
  • It may not be beneficial for all types of models
  • If validation set is not chosen properly, it may not lead to the most optimal stopping

To summarize, early stopping can be best used to prevent overfitting of the model, and saving resources. It would give best results if taken care of few things like – parameter tuning, preventing the model from overfitting, and ensuring that the model learns enough from the data.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads