This repository contains a research-style deep learning project comparing common regularization techniques in neural networks:
- L1 Regularization
- L2 Regularization
- Dropout
- Batch Normalization
- Elastic Net (L1 + L2)
The experiments use the MNIST handwritten digits dataset with a fixed dense neural network architecture to compare training behavior, validation performance, and final test accuracy.
Deep neural networks can easily overfit because they contain many trainable parameters. Regularization techniques help improve generalization, training stability, and robustness. This project compares the impact of different regularization methods under a unified experimental setup.
deep-learning-regularization-comparison/
├── assets/ # Extracted training/validation plots
├── notebooks/ # Main experiment notebook
├── paper/ # Research paper PDF
├── results/ # Summary CSV of reported results
├── src/ # Reusable model/training scripts
├── .gitignore
├── requirements.txt
└── README.md
The project uses the MNIST dataset from TensorFlow/Keras.
- Training samples: 60,000
- Test samples: 10,000
- Input shape after preprocessing: 784 features
- Classes: 10 handwritten digit classes
| Method | Main Idea |
|---|---|
| L1 Regularization | Adds absolute-weight penalty to encourage sparse weights |
| L2 Regularization | Adds squared-weight penalty to discourage large weights |
| Dropout | Randomly disables neurons during training to reduce co-adaptation |
| Batch Normalization | Normalizes intermediate activations to stabilize training |
| Elastic Net | Combines L1 and L2 penalties |
| Model | Test Accuracy |
|---|---|
| L1 Regularization | 97.89% |
| L2 Regularization | 97.90% |
| Dropout | 98.17% |
| Batch Normalization | 98.27% |
| Elastic Net (L1 + L2) | 98.22% |
In this experiment, Batch Normalization achieved the highest test accuracy, followed closely by Elastic Net and Dropout.
git clone https://github.com/Abdo-ateM/deep-learning-regularization-comparison.git
cd deep-learning-regularization-comparisonpython -m venv .venv
source .venv/bin/activateOn Windows:
.venv\Scripts\activatepip install -r requirements.txtjupyter notebook notebooks/Regularization_Techniques_MNIST_Comparison.ipynbpython src/train.py --model batch_norm --epochs 20Available model names:
l1
l2
dropout
batch_norm
elastic_net
- L1 regularization is useful when sparsity is desired.
- L2 regularization provides stable convergence and controls large weights.
- Dropout reduces overfitting by forcing the network to learn more robust representations.
- Batch Normalization improves training stability and produced the strongest result in this experiment.
- Combining methods can be useful, but no single technique is universally best.
- Abdelrahman Hatem
Research paper + implementation notebook + reusable training scripts.
Deep Learning, Neural Networks, Regularization, L1, L2, Dropout, Batch Normalization, Elastic Net, TensorFlow, MNIST