← All Neural Networks & Deep Learning modules

Module 8 · Capstone — Train a Network End-to-End

Capstone · synthesis · about 30 minutes.

Focus questions

Keep these questions in mind as you work through the module. Answer them in your guided notes, and use them to decide what belongs on your reference card.

  1. How does each capstone design parameter (the dataset, depth and width, the learning rate, and regularization) correspond to a concept developed in an earlier module?
  2. Moving from the two-blob dataset to the spiral, how would you adjust depth, width, the learning rate \( \eta \), and weight decay to maximize validation accuracy?
  3. When validation accuracy is poor, how would you decide from the loss curve and the decision boundary whether the cause is insufficient capacity, excessive capacity, or a poorly chosen learning rate?

This module consolidates the preceding seven. The artificial neuron, activation functions, the network architecture, the training loop, backpropagation, depth, and the regularization techniques have all been introduced. This capstone integrates them. You will select a dataset, define the architecture, set the learning rate, click Train, and train a network from a random initialization to a working classifier — selecting every design parameter yourself.

The complete model under your control

Each design parameter corresponds to a concept introduced in an earlier module:

The Train button executes the training loop introduced in Module 4 — forward pass, loss, backpropagation, update — for many epochs, displaying the loss curve and the evolving decision boundary. The objective is to maximize validation accuracy on each dataset. The spiral is the most challenging case and requires the full set of techniques introduced in the course.

This activity needs JavaScript. The lesson below still covers everything.

The complete model in Keras
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.regularizers import l2

model = Sequential([
    Dense(16, 'relu', input_shape=(2,), kernel_regularizer=l2(1e-3)),
    Dense(16, 'relu', kernel_regularizer=l2(1e-3)),   # depth + width
    Dense(1,  'sigmoid')                              # output
])
model.compile(optimizer=SGD(0.3), loss='binary_crossentropy',  # η + loss
              metrics=['accuracy'])
model.fit(X, y, validation_split=0.3, epochs=300)         # the loop

This is a complete production training script — the same network just trained in the activity, expressed in the form a practitioner would write. Every line corresponds to a concept developed in the course.

AI anchor — you have trained a neural network The network just trained from random initialization to a working classifier is, structurally, the same class of object as the production models underlying image recognition, recommendation systems, and natural language processing. Those models are larger — billions of parameters, hundreds of layers, training sets of substantial scale — but their training loop is identical to the one executed here: forward pass, loss, backpropagation, update. You have not observed deep learning in the abstract; you have implemented it.

Capstone — synthesis across the course

A synthesis quiz integrating material from across the course.

This activity needs JavaScript.

Subsequent course You now understand the principles by which neural networks learn — from a single neuron to a deep, regularized classifier trained from random initialization. Course 5 — Inside Large Language Models applies the same machinery, scales it to billions of parameters composed in transformer blocks, and develops how this architecture produces models capable of processing and generating natural language. The material developed here is the foundation on which Course 5 is built.
Summary: a neural network learns by iterating a single loop — forward pass, loss, backpropagation, weight update — across many epochs. The practitioner selects the dataset, the depth and width, the learning rate, and the regularization configuration; these design decisions constitute the practical methodology of training the deep models underlying contemporary AI.

← Back to all modules