What are Recurrent Neural Networks.docx
What are Recurrent Neural Networks.docx
RNN
Types of RNN
● CNN is applicable for sparse data like images. RNN is applicable for
time series and sequential data.
● While training the model, CNN uses a simple backpropagation and
RNN uses backpropagation through time to calculate the loss.
● RNN can have no restriction in length of inputs and outputs, but CNN
has finite inputs and finite outputs.
● CNN has a feedforward network and RNN works on loops to handle
sequential data.
● CNN can also be used for video and image processing. RNN is
primarily used for speech and text analysis.
Limitations of RNN
Simple RNN models usually run into two major issues. These issues are related to
gradient, which is the slope of the loss function along with the error function.
The Long Short Term Memory (LSTM) is the advanced type of RNN, which was
designed to prevent both decaying and exploding gradient problems. Just like RNN,
LSTM has repeating modules, but the structure is different. Instead of having a
single layer of tanh, LSTM has four interacting layers that communicate with each
other. This four-layered structure helps LSTM retain long-term memory and can be
used in several sequential problems including machine translation, speech
synthesis, speech recognition, and handwriting recognition. You can gain hands-on
experience in LSTM by following the guide: Python LSTM for Stock Predictions.
LSTM Cell
The gated recurrent unit (GRU) is a variation of LSTM as both have design
similarities, and in some cases, they produce similar results. GRU uses an update
gate and reset gate to solve the vanishing gradient problem. These gates decide
what information is important and pass it to the output. The gates can be trained to
store information from long ago, without vanishing over time or removing irrelevant
information.
Unlike LSTM, GRU does not have cell state Ct. It only has a hidden state ht, and
due to the simple architecture, GRU has a lower training time compared to LSTM
models. The GRU architecture is easy to understand as it takes input xt and the
hidden state from the previous timestamp ht-1 and outputs the new hidden state ht.
You can get in-depth knowledge about GRU at Understanding GRU Networks.
GRU Cell