Neural networks are the technology behind face unlock, voice assistants, language translation and chatbots like ChatGPT and Claude. They're built from simple pieces, loosely inspired by the brain. This module explains what they are and how they work, in plain English.
- Level: Beginner
- Time: about 30 minutes
- Needs: basic Python; our Machine Learning track helps
By the end of this module you will be able to
- Explain what a neural network is in one simple sentence
- Describe how an artificial neuron works: inputs, weights, bias and activation
- Name the layers of a network and explain what makes it "deep"
- Describe the training loop in simple terms
- Explain why neural networks took off when they did
- Name the main types of network and what each is good at
- Know when to use a neural network, and when not to
- Train your first neural network in Python
1.1What is a neural network?
Your brain contains around 86 billion tiny cells called neurons. Each one is very simple: it receives signals from other neurons and decides whether to pass a signal on. But connected together in huge numbers, they let you recognise faces, understand speech and learn new skills.
A neural network borrows that idea. It's made of lots of simple "artificial neurons", each doing a small calculation, connected together in layers. On its own, one artificial neuron can't do much. Thousands or millions of them working together can learn to recognise images, understand language and much more.
A neural network in one sentence
A neural network is a machine learning model made of layers of connected artificial neurons that learns patterns from examples by adjusting the strength of its connections.
An important reality check
Neural networks are inspired by the brain, but they are not artificial brains. A real neuron is enormously complicated; an artificial one is a few lines of maths. It's a bit like how aeroplanes were inspired by birds, but don't flap their wings.
1.2Where neural networks fit
If you've taken our Machine Learning track, you'll remember this picture. Neural networks sit at the heart of deep learning, which is a branch of machine learning.
| You already know (Machine Learning track) | What's the same with neural networks |
|---|---|
| Features, labels, training and test data | Exactly the same |
| Supervised learning: regression and classification | Neural networks do both |
| Linear and logistic regression | A single neuron is almost identical to them |
| Gradient descent: small steps downhill to reduce the error | This is how neural networks learn |
| Overfitting, cross-validation and evaluation measures | Just as important, maybe more so |
1.3The artificial neuron
An artificial neuron does four simple things:
| Step | What happens | In plain English |
|---|---|---|
| 1. Take inputs | Receives some numbers (x₁, x₂, x₃…) | The information it's given |
| 2. Weight them | Multiplies each input by its own weight (w₁, w₂, w₃…) | How much each piece of information matters. A negative weight means "this counts against" |
| 3. Add up, plus a bias | Adds everything together, plus a number called the bias | The bias is its starting mood: how easy or hard it is to convince |
| 4. Activate | Passes the total through an activation function | Turns the total into the final output, such as a score between 0 and 1 |
If that looks familiar, it should. With the sigmoid activation, a single neuron is exactly the logistic regression model from Module 4 of the Machine Learning track. A neural network is, in a sense, lots of small logistic regressions stacked together.
Let's make it real. Imagine one neuron deciding: "Should I go to the park?"
Try it: build a neuron
Switch the inputs on and off, then change the weights and bias to see how the neuron's decision changes.
Here's the key question: who chooses the weights and bias? In the lab, you did. In a real neural network, the network learns them from examples. That's what training means. You'll see how in lesson 1.5.
1.4From one neuron to a network
One neuron can only draw a straight-line boundary, just like logistic regression. The power comes from connecting many neurons in layers, where each layer's outputs become the next layer's inputs.
| Layer | What it does |
|---|---|
| Input layer | Receives the features: one neuron per feature (for an image, one per pixel). It doesn't calculate anything; it just passes the numbers in |
| Hidden layers | Where the learning happens. Each layer combines the patterns found by the layer before into more complex patterns. They're "hidden" because we never see their outputs directly |
| Output layer | Gives the final answer: one neuron for a yes/no or a number, or one per class (such as 10 for the digits 0 to 9) |
What makes a network "deep"?
A network with several hidden layers is called a deep neural network, and training one is called deep learning. Modern networks can have dozens or even hundreds of layers and billions of weights.
Why layers help: recognising a face
In a network that recognises faces, the first hidden layers learn to spot simple things like edges and colours. The next layers combine edges into shapes: curves, corners and circles. Deeper layers combine shapes into parts: eyes, noses and mouths. The last layers combine parts into whole faces. Nobody programs these steps; the network discovers them during training.
1.5How a neural network learns
A new network starts with random weights, so its first predictions are pure guesses. Training improves them step by step, using a loop you'll recognise from the Machine Learning track:
| Step | Name | What it means |
|---|---|---|
| 1 | Forward pass | Feed an example in; the numbers flow through the layers to produce a prediction |
| 2 | Loss | A single number measuring how wrong the prediction was (like log loss from the ML track) |
| 3 | Backpropagation | Works backwards through the network to find how much each weight contributed to the error |
| 4 | Gradient descent | Nudges every weight a little in the direction that reduces the loss |
One pass through the whole training dataset is called an epoch. Training usually takes many epochs. You'll learn exactly how backpropagation and gradient descent work in Modules 4 and 5.
Like tuning a huge mixing desk
Imagine a sound engineer with a mixing desk of 10,000 sliders, trying to make a song sound right. After each play, a listener says how far off it sounds (the loss). Backpropagation tells the engineer which sliders caused the problem, and gradient descent moves each of those sliders a tiny amount. After thousands of plays, the song sounds right. The sliders are the weights.
1.6A short history: why now?
Neural networks aren't new. The first ideas date from the 1940s. So why did they only change the world in the last 15 years?
Three things finally came together:
| Ingredient | What changed |
|---|---|
| Data | The internet, smartphones and digital records created huge collections of labelled images, text and audio to learn from |
| Computing power | Graphics cards (GPUs), built for video games, turned out to be brilliant at the maths neural networks need, making training many times faster |
| Better methods | Improvements such as better activation functions, dropout and new designs like the Transformer made deep networks much easier to train |
1.7The main types of neural network
Different kinds of data need different network designs, called architectures. You'll learn each of these later in this track.
| Type | Best for | How it works, in one line | Example |
|---|---|---|---|
| Feedforward network (MLP) | Tables of numbers | Layers of fully connected neurons, information flows one way | Predicting house prices or churn |
| Convolutional network (CNN) | Images and video | Scans small patches of an image to spot local patterns like edges | Face unlock, reading medical scans |
| Recurrent network (RNN, LSTM) | Sequences | Has a "memory" that carries information from one step to the next | Speech, sensor readings, older translation systems |
| Transformer | Language, and increasingly everything | Uses "attention" to decide which parts of the input matter most to each other | ChatGPT, Claude, Google Translate |
1.8When to use a neural network (and when not to)
Neural networks are powerful, but they're not always the best tool. As you saw in the Machine Learning track, for data in rows and columns, gradient boosting often wins.
| Use a neural network | Use traditional ML (e.g. gradient boosting) | |
|---|---|---|
| Type of data | Images, audio, text, video ("unstructured" data) | Spreadsheets and database tables ("structured" data) |
| Amount of data | Lots: thousands to millions of examples | Works well with hundreds to thousands |
| Computing power | Often needs GPUs and longer training | A normal laptop is usually fine |
| Need to explain decisions? | Harder: often called a "black box" | Easier, especially for simpler models |
| Feature engineering | Learns useful features by itself from raw data | Usually needs you to design good features |
The biggest advantage
Traditional models need people to decide which features matter. For an image, what would you even give them? A neural network can take in raw pixels, raw sound or raw words and learn useful features by itself. That's why it transformed computer vision and language.
1.9Neural networks in your everyday life
| Where you see it | What the network does | Type |
|---|---|---|
| Face unlock | Checks that the face in front of the camera is yours | CNN |
| Voice assistants | Turns your speech into text, then works out what you mean | Transformer |
| Google Translate | Translates whole sentences between languages | Transformer |
| ChatGPT and Claude | Understands and writes text by predicting the next word | Transformer |
| Photo apps | Finds all your photos of dogs, beaches or a particular person | CNN |
| Hospitals | Helps doctors spot signs of disease on X-rays and scans | CNN |
| Self-driving research | Recognises cars, people and road signs from cameras | CNN and Transformer |
1.10Your first neural network in Python
Later in this track you'll use dedicated deep learning libraries. To start, scikit-learn has a simple neural network called MLPClassifier (MLP stands for "multi-layer perceptron", another name for a feedforward network). Let's teach it to read the handwritten digits you may remember from the Machine Learning track.
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.neural_network import MLPClassifier
# 1. The data: 1,797 handwritten digits, each 8x8 = 64 pixels
X, y = load_digits(return_X_y=True)
X = MinMaxScaler().fit_transform(X) # pixel values from 0 to 1
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.25, random_state=42, stratify=y)
# 2. Build a network: 64 inputs -> 32 neurons -> 16 neurons -> 10 outputs
net = MLPClassifier(hidden_layer_sizes=(32, 16),
max_iter=1000, random_state=42)
# 3. Train it: guess, measure the error, adjust the weights, repeat
net.fit(X_train, y_train)
for epoch in [1, 5, 20, 50, 100]:
print(f"Epoch {epoch:3}: loss = {net.loss_curve_[epoch - 1]:.3f}")
# 4. Test it on digits it has never seen
print("Test accuracy:", round(net.score(X_test, y_test), 3))
# 5. How many weights did it learn?
n_weights = sum(w.size for w in net.coefs_) + sum(b.size for b in net.intercepts_)
print("Weights and biases learned:", n_weights)
print("Prediction for the first test digit:", net.predict(X_test[:1])[0],
"| Real answer:", y_test[0])
Epoch 1: loss = 2.338 Epoch 5: loss = 2.105 Epoch 20: loss = 0.925 Epoch 50: loss = 0.186 Epoch 100: loss = 0.069 Test accuracy: 0.973 Weights and biases learned: 2778 Prediction for the first test digit: 1 | Real answer: 1
What the output tells us
- The network has 4 layers: 64 inputs (one per pixel), two hidden layers of 32 and 16 neurons, and 10 outputs (one per digit).
- The loss falls from 2.34 (random guessing) to 0.07 as the weights are adjusted epoch after epoch.
- 97.3% test accuracy on digits it has never seen, from a network that started out knowing nothing.
- It learned 2,778 weights and biases by itself. Nobody told it what a "7" looks like.
Where to run this
You can run this code in any Python environment with scikit-learn installed, such as Jupyter Notebook or Google Colab. It trains in a few seconds on a normal laptop.
SummaryKey takeaways
- A neural network is made of layers of simple, connected artificial neurons, loosely inspired by the brain.
- Each neuron multiplies its inputs by weights, adds a bias, and applies an activation function.
- A single sigmoid neuron is the same as logistic regression.
- Networks have an input layer, hidden layers and an output layer. Several hidden layers make it deep.
- Training repeats: forward pass → loss → backpropagation → gradient descent, over many epochs.
- Deep learning took off thanks to big data, GPUs and better methods.
- Main types: feedforward (tables), CNNs (images), RNNs (sequences) and Transformers (language).
- Use neural networks for images, audio and text with lots of data; for tables, gradient boosting is often better.
Check your understanding
Your neural networks roadmap
- 01Introduction to Neural NetworksYou are here
- 02The Perceptron and the Artificial NeuronBuild a single neuron from scratch
- 03Activation FunctionsSigmoid, tanh, ReLU and softmax
- 04Loss Functions and Gradient DescentHow networks measure and reduce error
- 05BackpropagationHow every weight learns its share of the blame
- 06Building Networks with KerasYour first deep learning library
- 07Training Better NetworksOverfitting, dropout, batch normalisation, early stopping
- 08Convolutional Neural NetworksTeaching computers to see
- 09Recurrent Neural Networks and LSTMsWorking with sequences
- 10Transformers and AttentionThe architecture behind ChatGPT and Claude
- 11Transfer Learning and Pretrained ModelsStanding on the shoulders of giants
- 12Capstone ProjectBuild and present a deep learning project
Next module
The Perceptron and the Artificial Neuron