Lecture: Lecture 10 - Classification
Neuron and network
A neuron receives an input vector, multiplies inputs by weights, adds an offset and applies an activation function. A feed-forward network sends the result from input layers through hidden layers to an output layer.
Training repeats this loop:
- Initialize weights and offsets.
- Propagate an example forward.
- Compare the output with the expected class.
- Propagate the error backward.
- Update weights and offsets.
- Repeat for many epochs or until the stopping condition is reached.
Activation functions
Sigmoid maps a value into a range between 0 and 1, which is useful for a binary likelihood. ReLU outputs zero for negative input and a linear value for positive input, making it common in deep networks. Softmax is applied across the output layer and turns class scores into a probability distribution.
CNN example
A convolutional neural network classifies an image by applying learned sliding filters. Early filters can detect edges and textures. Deeper filters combine them into parts such as eyes or ears and then into objects. Pooling downsamples nearby activations, retaining a summary such as the maximum value.
For an image, the data is represented as a tensor. A colour image is commonly a rank-3 tensor with depth, height and width. A layer with many filters produces a new depth dimension containing one feature map per filter.
RNN and LSTM example
An RNN processes a sequence while carrying a state from one time step to the next. In a sentence, earlier words influence later predictions. In a time series, earlier measurements influence a later estimate. Training uses backpropagation through time.
Long sequences can cause vanishing gradients, so early information has little effect on updates. LSTMs add gates that help important state information flow across many time steps.
Other representations
Autoencoders learn compact representations and reconstruct the input. The compact representation can support feature extraction or denoising. Word embeddings represent words as vectors, so words used in similar contexts occupy similar regions of the vector space.
Common confusion
Neural networks are not a single algorithm with one fixed architecture. CNNs are suited to spatial image patterns, RNNs to sequential information, and feed-forward networks to fixed-size vectors. Higher accuracy also does not automatically make a network interpretable.
Retrieval questions
Why does a CNN use many filters? Different filters can learn different local patterns, such as edges, textures or object parts.
What does backpropagation change? It updates weights and offsets in the direction that reduces prediction error.
Why are LSTMs useful for long sequences? Their gates help preserve or discard state information over longer time intervals.