Best Practices, Debugging and Your Learning Roadmap

Deep Learning with Keras and TensorFlow 10 min min read Updated: Nov 16, 2026 Intermediate
Best Practices, Debugging and Your Learning Roadmap
Intermediate Topic 7 of 7

A Debugging Checklist

When a model does not learn, do not randomly change things. Work through this list from the top.

  1. Check the data. Plot a few samples. Are labels correct? Are the shapes what you expect?
  2. Check the preprocessing. Did you scale inputs? Is the test set processed exactly like the training set?
  3. Start simple. Use a tiny model and a known good setup.
  4. Overfit a tiny batch. Train on 20 samples. The loss should go close to zero. If not, there is a bug.
  5. Check output and loss pairing. Softmax with sparse categorical crossentropy, sigmoid with binary crossentropy.
  6. Tune the learning rate. Try 1e-2, 1e-3 and 1e-4.
  7. 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

SymptomLikely causeFix
Loss is NaNLearning rate too high, bad data (NaN or inf)Lower the learning rate, check data, use clipnorm
Accuracy stuck at chance levelUnscaled inputs, wrong labels, wrong lossNormalize, verify labels and loss
Training great, validation poorOverfittingDropout, augmentation, early stopping, more data
Both poorUnderfittingBigger model, more epochs, better features
Shape errorsMissing batch or channel dimensionPrint .shape, use expand_dims
Out of memoryBatch or images too largeSmaller 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

LevelTopics to explore next
Strengthen the basicsLinear algebra, probability, more Kaggle practice
Computer visionObject detection, segmentation, vision Transformers
NLPFine-tuning language models, retrieval, text generation
Generative AIDiffusion 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.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators