Overfitting
Overfitting occurs when a machine learning model learns the training data too closely,
capturing not only the underlying patterns but also noise or random fluctuations. As a result,
the model becomes highly accurate on the training set but performs poorly when predicting
on new, unseen data.
Characteristics of Overfitting:
● Excellent performance on training data.
● Poor generalization to new data.
● The model captures irrelevant details, such as random noise or anomalies.
Causes of Overfitting:
● Excessively complex model architecture (too many parameters or layers).
● Insufficient training data relative to the complexity of the model.
● Training for too many epochs without proper regularization.
● Limited diversity in the training dataset.
Techniques to Prevent Overfitting:
● Regularization: Penalize overly complex models (e.g., L1/L2 regularization).
● Dropout: Randomly disable neurons during training, forcing the model to generalize
better.
● Early Stopping: Halt training when performance on a validation set stops improving.
● Data Augmentation: Increase dataset diversity by artificially generating additional
training examples.
● Pruning or Model Simplification: Reducing model complexity by eliminating
unnecessary parameters or layers.
Underfitting
Underfitting occurs when a machine learning model is too simple to capture the underlying
patterns of the data. The model fails to adequately learn from the training data, resulting in
poor performance both on the training set and unseen data.
Characteristics of Underfitting:
● Poor performance on training data.
● Poor performance on unseen or test data.
● Model predictions tend to oversimplify relationships between variables.
Causes of Underfitting:
● Excessively simple model (insufficient parameters or layers).
● Insufficient training epochs or inadequate training process.
● Overly strong regularization, preventing the model from capturing essential patterns.
● Low-quality or limited training data.
Techniques to Prevent Underfitting:
● Increase Model Complexity: Add more layers or parameters to allow the model to
learn more complex patterns.
● Reduce Regularization Strength: Adjust regularization to enable the model to learn
meaningful relationships.
● Extend Training Duration: Train the model for more epochs or iterations to fully
explore the learning potential.
● Feature Engineering: Introduce more informative or relevant features to help the
model better understand patterns in data.