Why not use a standard network

The issues with using a standard network are as follows :

  • Inputs and outputs can be of different lengths in different examples.
  • Does not share features learned across different positions of text.

Recurrent Neural Network

We have a initial activation which be either a zero vector or a randomly initialized vector. This activation is fed in a network which take as input and gives as output. The next network which takes as input and gives as output also takes in activation as input so that it has input of its previous network.

There are several parameters in such a network. which is a parameter used in the input, for the output and for the activation of the previous layers. So a RNN uses information of the previous words of the input sequence to give output of the current word of the input sequence.

This is also a limitation of RNNs as they use information of words they have gone through only. It would be more useful to know not just information of the previous sequence but also of the later words in the sequence to make a good prediction.

Now for a general network we take . So for the first network the following calculation take place.

The activation function usually used to compute is tanh or ReLU. Depending on what our output y is we use the activation function which fits it.

  • For binary classification we use sigmoid activation.
  • For k-way classification we use softmax activation.

For the last network we have,

Now let us simplify the notation a bit.

We can write the equation

as

where we define . Here the matrices are stacked together horizontally. Now let us see now Backpropagation through time occurs.