Module 8 · Capstone — Train a Network End-to-End
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:
- Dataset — increasing in difficulty from two well-separated blobs to a spiral. More complex distributions require greater model capacity (Module 6).
- Depth and width — together determining the complexity of the representable decision boundary (Modules 2, 6). Insufficient capacity underfits; excessive capacity overfits (Module 7).
- Learning rate — the step size of the gradient update (Module 4). Values that are too small produce slow convergence; values that are too large produce divergence.
- Regularization — weight decay, which biases the decision boundary toward smoothness (Module 7).
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.
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.
Capstone — synthesis across the course
A synthesis quiz integrating material from across the course.
This activity needs JavaScript.