Module 6: Feedforward Neural Networks

This module introduces neural networks as a way to learn non-linear decision boundaries. Starting with the XOR problem to motivate hidden layers, you will explore activation functions, network architecture, forward propagation, backpropagation, and practical training with TensorFlow/Keras.

Learning Objectives

  • Explain why hidden layers are necessary for learning non-linear patterns.
  • Describe the architecture of feedforward neural networks (layers, units, activations).
  • Compare activation functions: ReLU, sigmoid, and tanh.
  • Trace forward propagation through a network to compute predictions.
  • Explain the purpose of backpropagation for computing gradients.
  • Build and train neural networks using TensorFlow/Keras.
0 of 8 stages complete
1 · Watch

The module in two minutes

An animated overview of the module’s through-line. Watch it before the lecture — it is the map, not the territory.

Lecture shorts

Short lectures and code walkthroughs from the instructor that reinforce this module. Some open partway into a longer video — that chapter is the part matched to this module.

Optimization, part 1 — nonlinearity: why networks need it (to 1:52)
Code walkthrough: Andrew Trask's neural net in pure numpy
Code walkthrough: Trask's neural network in 11 lines
Intro talk: a basic TensorFlow example
2 · Listen

Orientation audio

Why networks need to bend, and how the from-scratch build connects to Keras.

3 · Read & play

The through-line

Everything so far draws straight lines through feature space. XOR — output 1 when exactly one input is 1 — is the classic four-point dataset no straight line can split, and it opens this module because it forces the conclusion: to go further, models need to bend.

The bend comes from stacking. A hidden layer computes several linear functions of the input, passes each through a nonlinearity, and hands the results to the next layer as learned features. Without the nonlinearity the stack collapses back into one linear map — this is why activation functions exist, not decoration. ReLU's blunt max(0, x) has largely won over the smoother sigmoid and tanh because its gradient doesn't die as networks deepen.

Forward propagation is just those layers evaluated in order, and the lecture builds it from scratch in NumPy so the "network" demystifies into a handful of matrix multiplies. Backpropagation answers the training question: the chain rule, applied layer by layer from the loss backwards, gives every weight its gradient — and then the update is the same descent step you have run since module 2.

The module closes by rebuilding the same network in Keras, where the from-scratch version becomes three lines. Frameworks buy convenience, not understanding — which is why the scratch version comes first. Watch a network learn XOR, the problem a line could not touch, and module 1's vocabulary — model, parameters, loss, generalization — now covers deep learning too.

Figure · Bend a line out of ReLUs

Three hidden units with fixed kinks at 0, 1, and 2; you set their output weights. The dashed target is a bump — something no straight line makes. Build it: y = v₁·ReLU(x) + v₂·ReLU(x−1) + v₃·ReLU(x−2).

Each unit is a straight line clipped at zero; the sum bends where the units switch on. That is the whole trick: hidden units are learned features, and depth is learned features of learned features. Drop the nonlinearity and the three lines collapse into one line — which is why activation functions exist, not decoration. (The bump wants v = 1, −2, 1.)

Key concepts

  • Hidden Layers: Enable learning non-linear patterns
  • Activation Functions: ReLU, sigmoid, tanh introduce non-linearity
  • Forward Propagation: Computing outputs from inputs
  • Backpropagation: Computing gradients for all parameters
  • Optimizers: SGD, Adam for updating weights
4 · Code

The lecture notebook

Six parts, from scratch before any framework. Run every cell; change things and rerun — the notebook is the lecture.

In Colab: File → Save a copy in Drive keeps your work.

5 · Practice

Exercise

Attempt the exercise before opening the solution — the attempt is where the learning happens.

6 · Check

Knowledge check

The quiz is self-graded and open-book. If a question surprises you, the corresponding lecture part is the fastest fix.

7 · Go deeper

Reference and discussion

8 · Done

Finish the module

Complete the stages above, then claim the finish here.