Kkk
Kkk
▪ Overfitting Problem
Overfitting Examples
Consider a use case where a machine learning model has to analyze photos and identify the ones that contain dogs in
them. If the machine learning model was trained on a data set that contained majority photos showing dogs outside in
parks , it may may learn to use grass as a feature for classification and may not recognize a dog inside a room.
Early stopping
Early stopping pauses the training phase before the machine learning model learns the noise in the data. However,
getting the timing right is important; else the model will still not give accurate results.
Pruning
You might identify several features or parameters that impact the final prediction when you build a model. Feature
selection—or pruning—identifies the most important features within the training set and eliminates irrelevant ones. For
example, to predict if an image is an animal or human, you can look at various input parameters like face shape, ear
position, body structure, etc. You may prioritize face shape and ignore the shape of the eyes.
Regularization (Ridge/Lasso/Elastic/Dropout)
Regularization is a collection of training/optimization techniques that seek to reduce overfitting. These methods try to
eliminate those factors that do not impact the prediction outcomes by grading features based on importance. For
example, mathematical calculations apply a penalty value to features with minimal impact.
Ensembling
Ensembling combines predictions from several separate machine learning algorithms. Some models are called weak
learners because their results are often inaccurate. Ensemble methods combine all the weak learners to get more
accurate results. The two main ensemble methods are bagging and boosting. Boosting trains different machine learning
models one after another to get the final result, while bagging trains them in parallel.
So, our L1 regularization technique would assign the less signification feature with a zero weight, if it doesn’t
have a significant effect on the prediction of our target column.
➢ In L1 regularization, the norm used is the L1 norm, which is the sum of the absolute values of the
elements.
➢ In L2 regularization, the norm used is the L2 norm, which is the square root of the sum of the squared
➢ These norms are commonly used in mathematics, and they determine the type of regularization
We can typically choose and calculate the penalty term for L1 and L2 regularization:
L1 Regularization (Lasso):
Regularization is a set of techniques used in machine learning and statistical modeling to prevent overfitting and improve the
generalization performance of a model.
Regularization methods introduce a penalty term into the model's objective function, encouraging it to have simpler and more
stable patterns that generalize better to new data.
There are several common types of regularization techniques used in machine learning, including:
L1 Regularization (Lasso): L1 regularization adds a penalty term to the model's objective function that is proportional to the
absolute values of the model's coefficients. It encourages the model to have sparse feature weights, effectively selecting a subset
of the most important features while setting others to zero. L1 regularization is useful for feature selection.
L2 Regularization (Ridge): L2 regularization adds a penalty term to the objective function that is proportional to the squared
values of the model's coefficients. It encourages the model to have small, evenly distributed feature weights. L2 regularization
helps prevent large coefficients that might lead to overfitting.
Elastic Net Regularization: Elastic Net is a combination of L1 and L2 regularization. It adds both L1 and L2 penalty terms to
the objective function, allowing for feature selection and coefficient shrinkage. Elastic Net is useful when there are many
features, and some of them are highly correlated.
https://www.mygreatlearning.com/blog/what-is-ridge-regression/
https://neptune.ai/blog/fighting-overfitting-with-l1-or-l2-regularization