Convnets are widely known as the go-to neural network architectures when it comes to processing images, but they can also be used in other data such as texts and time series.
Image: A typical Convnets architecture
Convnets inputs are of 3 dimensions. The most popular one is Conv2D that is used in images and videos (divided into frames).
Conv1D is used in sequential data such as texts, time series, and sounds. A popular sound architecture called WaveNet is made of 10 stacked 1D Convnets.
The variant of RNNs that is able to handle long sequences is called Long Short Term Memory(LSTM).
LSTM has also the ability to handle the sequences of variable lengths.
Image: LSTM, source: Intro to Deep learning MIT
A special design difference about the LSTM cell is that it has a gate which is the basis of why it can control the flow of information over many time steps.
In short, LSTM uses gates to control the flow of information from the current time step to the next time step in the following 4 steps:
◆The input gate recognizes the input sequence.
◆Forget gate gets rid of all irrelevant information contained in the input sequence and store relevant information in long-term memory.
◆LTSM cell updates update cell's state values.
◆Output gate controls the information that has to be sent to the next time step.
The ability of LSTMs to handle long-term sequences made it a suitable neural network architecture for various sequential tasks such as
Another recurrent neural network that you will see is Gate Recurrent Unit(GRU). GRU is a simplified version of LSTMs, and it's cheaper to train.
RNNs were one of the states of the art networks until the transformers came.
4. Transformers
Although RNNs are still used for sequential modeling, they have short-term memory problems when used for long sequences, and they are computationally expensive.
The RNN's inability to handle long sequences and expensiveness are the two most motivations of transformers.
Transformers are one of the latest groundbreaking researches in the natural language community.
They are sorely based on the attention mechanisms that learn the relationships between words of the sentence and pays attention to the relevant words.
Image: Transformer
One of the most notable things about transformers is that they don't use any recurrent or convolutional layers.
It's just only attention mechanisms and other standard layers like embedding layer, dense layer, and normalization layers.
They are commonly used in language tasks such as text classification, question answering, and machine translation.
There have been researches that show that they can also be used for computer vision tasks, such as image classification, object detection, image segmentation, and image captioning with visual attention.
The invention of transformers also motivated @OpenAI GPT series (Generative Pretrained Transformer) such as GPT, GPT-2, and GPT-3 which is the recent one.
This is the end of the thread. The rests are summary and additional notes
We can summarize the neural networks architectures we discussed by their suites of data:
◆Texts: Recurrent Neural Networks(RNNs), transformers, or 1D Convnets.
◆Time-series: RNNs or 1D Convnets
◆Videos and volumetric images: 3D Convnets, or 2D Convnets (with video divided into frames)
◆Sound: 1D Convnets or RNNS.
The machine learning research community is so vibrant.
It doesn't take long for a promised technique to fade away, or overlooked techniques to emerge unknowingly.
Just take an example of recent research that used Multi-Layer Perceptions(MLP-Mixer: An all-MLP Architecture for Vision) for computer vision claiming that Convnets and transformers are not necessary.
Neural networks are hard to train. The more they go deeper, the more they are likely to suffer from unstable gradients.
Gradients can either explode or vanish, and either of those can cause the network to give poor results.
A short thread on the neuralnets training issues
The vanishing gradients problem results in the network taking too long to train(learning will be very slow), and the exploding gradients cause the gradients to be very large.
Although those problems are nearly inevitable, the choice of activation function can reduce their effects.
Using ReLU activation in the first layers can help avoid vanishing gradients.
Careful weight initialization can also help, but ReLU is by far the good fix.
Machine learning is the science of teaching the computer to do certain tasks, where instead of hardcoding it, we give it the data that contains what we want to achieve, and its job is to learn from such data to find the patterns that map what we want to achieve and provided data.
These patterns or (learned) rules can be used to make predictions on unseen data.
A machine learning model is nothing other than a mathematical function whose coefficient and intercept hold the best (or learned) values representing the provided data & what we want to achieve.
In ML terms, coefficients are weights, intercepts are biases.
Getting started with machine learning can be hard.
We are fortunate to have many & freely available learning resources, but most of them won't help because they skip the fundamentals or start with moonshots.
This is a thread on learning machine learning & structured resources.
1. Get excited first
The first step to learning a hard topic is to get excited.
Machine learning is a demanding field and it will take time to start understanding concepts & connecting things.
If you find it hard to understand what ML really is,
@lmoroney I/O 19 talk will get you excited. He introduces what machine learning really is from a programming perspective.