Skip to content

Chapter 9: Deep Learning Fundamentals

Build neural networks from scratch, then master PyTorch—CNNs for images, RNNs for sequences, and regularization for production.


Metadata

Field Value
Track Practitioner
Time 12 hours
Prerequisites Chapters 1, 3, 6

Learning Objectives

  • Implement a neural network from scratch with NumPy (forward pass, backpropagation)
  • Understand activation functions, loss functions, and gradient descent
  • Build and train models with PyTorch (nn.Module, DataLoader, optimizers)
  • Apply regularization: dropout, weight decay, early stopping, batch normalization
  • Build CNNs for image classification
  • Build RNNs and LSTMs for sequence prediction
  • Diagnose underfitting/overfitting and tune hyperparameters

What's Included

Notebooks

Notebook Description
01_introduction.ipynb Neurons, activations, forward pass, backpropagation from scratch
02_intermediate.ipynb PyTorch basics, training loops, regularization techniques
03_advanced.ipynb CNNs, RNNs/LSTMs, transfer learning, image classification capstone

Scripts

  • deep_learning_toolkit.py — NeuralNetScratch class, activation functions, plotting utilities

Exercises

  • 5 exercises with solutions (in solutions/ branch)

SVG Diagrams

  • 3 visual diagrams for network architecture, backpropagation, and CNN structure


Read Online

You can read the full chapter content right here on the website:

  • 09.1 Introduction -- Neural networks from scratch, backpropagation, gradient descent
  • 09.2 Intermediate -- PyTorch tensors, autograd, training loops, regularization
  • 09.3 Advanced -- CNNs, RNNs, transfer learning, image classification capstone

Or try the code in the Playground.

How to Use This Chapter

Quick Start

Follow these steps to get coding in minutes.

1. Clone and install dependencies

git clone https://github.com/luigipascal/berta-chapters.git
cd berta-chapters
pip install -r requirements.txt

2. Navigate to the chapter

cd chapters/chapter-09-deep-learning-fundamentals

3. Launch Jupyter

jupyter notebook notebooks/01_introduction.ipynb

GitHub Folder

All chapter materials live in: chapters/chapter-09-deep-learning-fundamentals/

PyTorch

This chapter uses PyTorch for deep learning. Install it: pip install torch torchvision


Created by Luigi Pascal Rondanini | Generated by Berta AI