Best Practices, Debugging and Your Learning Roadmap
A Debugging Checklist
When a model does not learn, do not randomly change things. Work through this list from the top.
- Check the data. Plot a few samples. Are labels correct? Are the shapes what you expect?
- Check the preprocessing. Did you scale inputs? Is the test set processed exactly like the training set?
- Start simple. Use a tiny model and a known good setup.
- Overfit a tiny batch. Train on 20 samples. The loss should go close to zero. If not, there is a bug.
- Check output and loss pairing. Softmax with sparse categorical crossentropy, sigmoid with binary crossentropy.
- Tune the learning rate. Try 1e-2, 1e-3 and 1e-4.
- Only then add complexity, regularization and more data.
The Tiny Batch Test
python
model.fit(x_train[:32], y_train[:32], epochs=100, verbose=0)
print(model.evaluate(x_train[:32], y_train[:32], verbose=0)) # should be near-perfect
Common Symptoms and Fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Loss is NaN | Learning rate too high, bad data (NaN or inf) | Lower the learning rate, check data, use clipnorm |
| Accuracy stuck at chance level | Unscaled inputs, wrong labels, wrong loss | Normalize, verify labels and loss |
| Training great, validation poor | Overfitting | Dropout, augmentation, early stopping, more data |
| Both poor | Underfitting | Bigger model, more epochs, better features |
| Shape errors | Missing batch or channel dimension | Print .shape, use expand_dims |
| Out of memory | Batch or images too large | Smaller batch size, smaller images, mixed precision |
Data Leakage Warnings
- Fit scalers and vectorizers on the training data only
- Never use test data to choose hyperparameters. Use validation data
- For time series, split by time
- Remove duplicate samples that appear in both train and test
Reproducibility
python
import keras
keras.utils.set_random_seed(42) # seeds Python, NumPy and the backend
- Record the library versions in
requirements.txt - Save the model and the configuration of every experiment
- Use TensorBoard or a logging tool to compare runs
Your Learning Roadmap
| Level | Topics to explore next |
|---|---|
| Strengthen the basics | Linear algebra, probability, more Kaggle practice |
| Computer vision | Object detection, segmentation, vision Transformers |
| NLP | Fine-tuning language models, retrieval, text generation |
| Generative AI | Diffusion models, large language model APIs |
| Production (MLOps) | Data versioning, monitoring, CI/CD for models |
Keep practicing: Join a Kaggle competition, rebuild the projects from this course with your own dataset and write about what you learn. Practice is what turns knowledge into skill.
Conclusion
Good deep learning engineers are not those who never see errors. They debug in a systematic way. Use the checklist and keep building projects.
Quick Summary: Check data, start simple, overfit a tiny batch, match loss and output, then tune. Prevent leakage and keep experiments reproducible.

