Recurrent neural network is a type of neural network used to deal specifically with sequential data. Actually what makes RNN so powerful is the fact that it doesn’t take into consideration just the actual input but also the previous input which allows it to memorize what happens previously. To get a better intuition on RNN let’s take the example of text classification, for this task we can use the classic machine learning algorithms like naive bayes but the problem with this algorithm, it takes a sentence as a set of independent words and precisely the frequency of each word without worrying about the composition of words or the order of words in a sentence which makes a huge difference to form the meaning of a sentence. RNN unlike those classic algorithms, works well on sequence data because it takes the word i as input and combine with the output of word_ i-1_, the same thing would be applied for word i+1 and this is the reason it’s called recurrent neural network because clearly the neural network apply the same operations on each word _i _of the sentence.

Image for post

Recurrent neural network

As you might be thinking enough bla bla show us how they work, and that’s exactly what I’d do in the next part :

How RNN works :

In order to understand how RNN works under the hood, let’s take an example of NLP application Named entity recognition, this technique is used to detect names in a sentence :

Image for post

Image for post

In the examples above, for each instance of training (sentence) we map each word with an output, if the word is name(john, Ellen …) we map it to 1. Otherwise, we map it to 0. So to train RNN on sentences to recognize names within, the RNN architecture would be something like that :

Image for post

#data-science #naturallanguageprocessing #artificial-intelligence #machine-learning #deep-learning

Simple Explanation of Recurrent Neural Network (RNN)
30.45 GEEK