Module 8 — Train a Network End-to-End
This is the payoff. Across seven modules you built every piece: a neuron, activations to bend the line, a network that wires neurons together, the training loop, backpropagation, depth, and the tools that keep a network honest. Now you put them all in one place. You will pick a dataset, design the architecture, set the learning rate, press Train, and watch a network go from random noise to a working classifier — making every decision yourself.
The whole engine, in your hands
Everything you choose below maps to something you learned:
- Dataset — easy (two blobs) to hard (a spiral). Harder shapes demand more capacity (Module 6).
- Depth & width — how much the boundary can bend (Modules 2, 6). Too little and it can't fit; too much and it can overfit (Module 7).
- Learning rate — the step size (Module 4). Too low crawls; too high diverges.
- Regularization — weight decay to keep the boundary smooth (Module 7).
Then the Train button runs the exact loop from Module 4 — forward, loss, backprop, update — for many epochs, while you watch the loss fall and the boundary form. Your goal: get the validation accuracy as high as you can on each dataset. Try the spiral last; it's the one that needs everything you learned.
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
That is a complete, real training script — the same network you just trained on the canvas, written the way a practitioner would. You now understand every line of it.
Check your understanding
A synthesis quiz spanning the whole course. You will get a score.
This activity needs JavaScript.