Recurrent neural networks
RNNs get their name because they recurrently apply the same function over a sequence. An RNN can be written as a recurrence relation defined by this function:
St = f(St-1, Xt)
Here St —the state at step t—is computed by the function f from the state in the previous step, that is t-1, and an input Xt at the current step. This recurrence relation defines how the state evolves step by step over the sequence via a feedback loop over previous states, as illustrated in the following figure:
![](https://static.packt-cdn.com/products/9781786464453/graphics/B05394_06_01.jpg)
Figure from [3]
Left: Visual illustration of the RNN recurrence relation: S t = S t-1 * W + X t * U. The final output will be o t = V*S t
Right: RNN states recurrently unfolded over the sequence t- 1, t, t+1. Note that the parameters U, V, and W are shared between all the steps.
Here f can be any differentiable function. For example, a basic RNN is defined by the following recurrence relation:
St = tanh(St-1 * W + Xt * U)
Here W defines a linear transformation from state to state...