Recurrent Neural Networks: Index
Recurrent Neural Networks: Index
Recurrent Neural Networks: Index
Each of the 3
types of neural
networks (artificial,
convolutional, and recurrent) are used to solve
supervised machine learning problems.
Index
• The types of problems solved by recurrent neural networks
• The relationships between the different parts of the brain and the
different neural networks
Arguably the most important part of the brain is the cerebrum. It contains four lobes:
• The frontal lobe
• The parietal lobe
• The temporal lobe
• The occipital lobe
The temporal lobe is the part of the brain that is associated with long-term memory. Since the artificial neural network has the
property of long-term memory. Many researchers have compared artificial neural networks with the temporal lobe of the
human brain.
Similarly, the occipital lobe is the component of the brain that powers our vision. Since convolutional neural networks are
typically used to solve computer vision problems, you could say that they are equivalent to the occipital lobe in the brain. The
recurrent neural networks are used to solve time series problems. They can learn from events that have happened in recent
previous iterations of their training stage. In this way, they are often compared to the frontal lobe of the brain – which powers
our short-term memory.
To summarize, researchers often pair each of the three neural nets with the following parts of the brain:
• Artificial neural networks -> the temporal lobe
• Convolutional neural networks -> the occipital lobe
• Recurrent neural networks -> the frontal lobe
The Composition of a Recurrent Neural Network
Let’s now discuss the composition of a recurrent neural network. First,
recall that the composition of a basic neural network has the following
appearance:
The first modification that needs to be made to this neural network is that
each layer of the network should be squashed together, like this:
Then, three more modifications need to be made:
• The neural network’s neuron synapses need to be simplified to a single line •
The entire neural network needs to be rotated 90 degrees
• A loop needs to be generated around the hidden layer of the neural net
The neural network will now have the following appearance:
That line that circles the hidden layer of the recurrent neural
network is called the temporal loop. It is used to indicate
that the hidden layer not only generates an output, but that
output is fed back as the input into the same layer.
A visualization is helpful in understanding this. As you can see in
the following image, the hidden layer used on a specific
observation of a data set is not only used to generate an
output for that observation, but it is also used to train the
hidden layer of the next observation.
This
property of one observation helping to train the next
observation is why recurrent neural networks are so useful in
solving time series analysis problems.
What is Recurrent Neural Network (RNN)?
Recurrent Neural Network(RNN) is a type of Neural Network where the output from the previous step is fed as
input to the current step. In traditional neural networks, all the inputs and outputs are independent of
each other. Still, in cases when it is required to predict the next word of a sentence, the previous words are
required and hence there is a need to remember the previous words. Thus RNN came into existence,
which solved this issue with the help of a Hidden Layer. The main and most important feature of RNN is its
Hidden state, which remembers some information about a sequence. The state is also referred to as
Memory State since it remembers the previous input to the network. It uses the same parameters for
each input as it performs the same task on all the inputs or hidden layers to produce the output. This
reduces the complexity of parameters, unlike other neural networks.
Artificial neural networksthat do not have looping nodes are called feed forward neural networks. Because all
information is only passed forward, this kind of neural network is also referred to as a multi-layer neural
network.
• Information moves from the input layer to the output layer – if any hidden layers are present –
unidirectionally in a feedforward neural network. These networks are appropriate for image classification
tasks, for example, where input and output are independent. Nevertheless, their inability to retain
previous inputs automatically renders them less useful for sequential data analysis.
• Recurrent Vs Feedforward networks
The fundamental processing unit in a Recurrent Neural Network (RNN) is a Recurrent Unit, which is not
explicitly called a “Recurrent Neuron.” This unit has the unique ability to maintain a hidden state, allowing
the network to capture sequential dependencies by remembering previous inputs while processing. Long
Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) versions improve the RNN’s ability to handle
long-term dependencies.
Types Of RNN
There are four types of RNNs based on the number of inputs and outputs in the
network. • One to One
This type of RNN behaves the same as any simple Neural network it is also known as Vanilla
Neural Network. In this Neural network, there is only one input and one output.
• One To Many
In this type of RNN, there is one input and many outputs associated with it. One of the most used
examples of this network is Image captioning where given an image we predict a sentence
having Multiple words.
• Many to One
In this type of network, Many inputs are fed to the network at several states of the network
generating only one output. This type of network is used in the problems like sentimental
analysis. Where we give multiple words as input and predict only the sentiment of the sentence
as output.
• Many to Many
In this type of neural network, there are multiple inputs and multiple outputs corresponding to a
problem. One Example of this Problem will be language translation. In language translation, we
provide multiple words from one language as input and predict multiple words from the
second language as output.
Recurrent Neural Network Architecture
RNNs have the same input and output architecture as any other deep neural architecture.
However, differences arise in the way information flows from input to output.
Unlike Deep neural networks where we have different weight matrices for each Dense network in RNN, the weight across the
network remains the same.
It calculates state hidden state Hifor every input Xi .
How does RNN work?
The Recurrent Neural Network consists of multiple fixed activation function units, one for each time step. Each unit has an
internal state which is called the hidden state of the unit. This hidden state signifies the past knowledge that the network
currently holds at a given time step. This hidden state is updated at every time step to signify the change in the knowledge of
the network about the past. The hidden state is updated using the following recurrence relation:-