<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Recurrent neural networks (RNN) by nvmoyar</title>
      <link>https://padlet.com/nvmoyar/72g3qqxc5xp6</link>
      <description>Neural networks to analyse time series data (notes from DeepLearning book)</description>
      <language>en-us</language>
      <pubDate>2018-02-07 10:12:33 UTC</pubDate>
      <lastBuildDate>2024-05-10 01:00:42 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url>https://padlet-assets.s3.amazonaws.com/icons/Watchclock.png</url>
      </image>
      <item>
         <title>What are RNN ? </title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229017929</link>
         <description><![CDATA[<ul><li>They are a family of neural networks for processing sequential data, thus order and structure matters. </li><li>To go from multilayer networks to recurrent networks, ideas found in machine learning and statistical models of the 1980s: sharing parameters across diﬀerent parts of a model</li><li>Why the need of parameter sharing? It allows us to extend the model and check how well generalises, since we are able to apply the model to different forms (different lengths in this case).&nbsp;</li><li>Can be a 1D convolution like text recognition. In practice RNN operates in minibatches t, and the time step of each minibatch doesn't have to be related to the real world.&nbsp;</li><li>Can be applied to 2D spatial data like images, when the time serial must be considered like in videos. </li></ul><div><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2018-02-07 10:14:49 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229017929</guid>
      </item>
      <item>
         <title>Recursivity</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229026437</link>
         <description><![CDATA[<ul><li>We could say that a RNN is composed by n computational graphs which are a set of structured computations. That computation implies mapping an input and parameters to outputs and loss.&nbsp;</li><li>We can see a computational graph in its folded or unfolded view: the unfolded view provides an explicit description of which computations to perform, and helps us to illustrate the information flow forward in time (computing outputs and losses) and backwards in time (computen gradients) since we know explicitly which path the information is following.&nbsp;</li><li>Regarding this graph:&nbsp;</li><li>This RNN has no outputs,</li><li>This RNN processes info from x (input node) and incorporates it to the state h, that is passed forward time.&nbsp;</li><li>The black square on the folded view is the delay of a single time step.</li><li>Unfolded computational graph --&gt; each node is associated to a 1 time instance</li><li>For a x(t) signal, the state h(t) is represented by a function dependent of the previous state h(t-1) and gradients. </li></ul><div><br><br></div><div><br><br><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/cb6c21da63f86c0969f9b386eed806a6/IMG_20180207_124818.jpg" />
         <pubDate>2018-02-07 10:37:50 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229026437</guid>
      </item>
      <item>
         <title>Examples of Design patterns for RNN</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229059301</link>
         <description><![CDATA[<ul><li>Left: One input produces<strong> an output </strong>each time step, existing <strong>connections btw hidden</strong> units. The graph maps:&nbsp;<ul><li>&nbsp;x, input sequence --&gt; o, outputs&nbsp;</li><li>&nbsp;L, loss measures how far each o is from training target y</li><li>&nbsp;when using softmax outputs, we assume o is the unnormalized log&nbsp; &nbsp; &nbsp; probabilities.</li><li>The RNN has input to hidden connections parametrised by a weight matrix U. Hidden-to-hidden recurrent connections parametrised by a weight matrix W. Hidden-to-output connections parametrised by a weight matrix V.</li><li>It's a powerful model: any possible information about the past, can be shared to the hidden representation and transmitted to the future.&nbsp;</li></ul></li></ul><div><br></div><ul><li>Center: One input produces <strong>an output</strong> each time step, existing <strong>connections only from output to hidden units each time step</strong>. The only recurrence is the feedback connection from the output to the hidden layer. This model is less powerful than the previous one: the figure is trained to put a specific output value into the output o, and o is the only information that is allowed to send to the future. No direct connections from h are going forward. <strong>Previous h is connected to the present only indirectly via the predictions it was used to produce. Unless o is high-dimensional and rich, it will usually lack important information from the past. </strong>Thus, less powerful but easier to train, because each time step is ISOLATED from the others (that allows greater parallelization). <strong>This models are trained with teacher forcing.&nbsp;</strong></li></ul><div><br></div><ul><li>Right: Recurrent connections btw hidden units, that read an entire sequence and produces a single output. It can be used to summarise a sequence producing a fixed-size representation (used as input for further processing like seq-2-seq model). There might be a target (right at the end) or the gradient on the output o(t) can be obtained by BPTT from further downstream modules.</li></ul><div><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/c9a343289b341d6d7e44e5e44d733182/Screen_Shot_2018_02_07_at_13_30_59.png" />
         <pubDate>2018-02-07 12:32:27 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229059301</guid>
      </item>
      <item>
         <title>Backpropagation or BPTT (backpropagation through  time)</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229143330</link>
         <description><![CDATA[<div>No specialised algorithms are necessary, the generalised backpropagation algorithm is applied to the unrolled computational graph. Gradients obtained by backpropagation then are used to train. <br><br>In feedforward networks moves backward from the final error through the outputs, weights and inputs of each hidden layer,<strong> assigning those weights responsibility for a portion of the error by calculating their partial derivatives – </strong><strong><em>∂E/∂w</em></strong><strong>, or the relationship between their rates of change</strong>. Those derivatives are then used by our learning rule, gradient descent, to adjust the weights up or down, whichever direction decreases error. Recurrent networks rely on an extension of backpropagation called <a href="https://www.cs.cmu.edu/~bhiksha/courses/deeplearning/Fall.2015/pdfs/Werbos.backprop.pdf">backpropagation through time</a>, or BPTT. Time, in this case, is simply expressed by a well-defined, ordered series of calculations linking one time step to the next, which is all backpropagation needs to work.<br><br></div><div>Neural networks, whether they are recurrent or not, are simply nested composite functions like f(g(h(x))). Adding a time element only extends the series of functions for which we calculate derivatives with the chain rule.<br><br></div><div><br><br></div>]]></description>
         <enclosure url="https://deeplearning4j.org/lstm.html" />
         <pubDate>2018-02-07 15:30:48 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229143330</guid>
      </item>
      <item>
         <title>Bidirectional RNN</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229177463</link>
         <description><![CDATA[<div>In many applications, however, we want to output a prediction of y(t) that</div><div>may depend on the whole input sequence x. Ex. In speech recognition if a sound might be interpreted in two ways, maybe we need information about the context in order to figure out what is the likely sound.&nbsp;<br>It combines an RNN that moves forward through time, beginning from the start of the sequence, with another RNN that moves backward through time, beginning from the end of the sequence.&nbsp;<br><br>As the name suggests, bidirectional RNNs combine an RNN that moves forward</div><div>through time, beginning from the start of the sequence, with another RNN that</div><div>moves backward through time, beginning from the end of the sequence. That means to learn to map the input sequences x to target sequences y with loss L(t) at each step t. The h recurrence propagates information forward in time (to the right) while g recurrence propagates information backward in time (to the left). At each point t the o(t) can benefit from the past on its h(t) and from the future through g(t). </div><div><br><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/15d00d987030e2e7a234fc1bd1465cf8/Screen_Shot_2018_02_07_at_17_29_16.png" />
         <pubDate>2018-02-07 16:22:42 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229177463</guid>
      </item>
      <item>
         <title>PROBLEM: Vanishing (and exploding) gradients</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229188769</link>
         <description><![CDATA[<div>The challenge of learning long-term dependencies is that gradients propagated over many stages tend to either to vanish (most of the time) or explode. If we assume that the parameters are stable, we will be comparing long-term dependencies (smaller weights resulting from the multiplication of many Jacobians -matrix of derivatives-) to the short-term ones (<sup>Hochreiter, 1991; Doya, 1993; Bengio et al., 1994; Pascanu et al., 2013</sup>).&nbsp; If we can’t know the gradient, we can’t adjust the weights in a direction that will decrease error, and our network ceases to learn.<br><br>Exploding gradients treat every weight as though it were the proverbial butterfly whose flapping wings cause a distant hurricane. Those weights’ gradients become saturated on the high end; i.e. they are presumed to be too powerful. But exploding gradients can be solved relatively easily, because they can be truncated or squashed. Vanishing gradients can become too small for computers to work with or for networks to learn – a harder problem to solve.<br><br>Below you see the effects of applying a sigmoid function over and over again. The data is flattened until, for large stretches, it has no detectable slope. This is analogous to a gradient vanishing as it passes through many layers.<br><br><a href="https://uwaterloo.ca/data-analytics/sites/ca.data-analytics/files/uploads/files/rnn1.pdf">https://uwaterloo.ca/data-analytics/sites/ca.data-analytics/files/uploads/files/rnn1.pdf</a><br><br></div><div><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/0943cf57828e102aef6136881aaf411f/sigmoid_vanishing_gradient.png" />
         <pubDate>2018-02-07 16:39:50 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229188769</guid>
      </item>
      <item>
         <title>LSTM</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229498352</link>
         <description><![CDATA[<div>In theory, RNNs are absolutely capable of handling such long-term dependencies, however in practice, RNNs don’t seem to be able to learn them.<br><br>The basic idea behind an LSTM is to control the how the information flow is formed, that means to control which information is going to be keep for long, which part of the recent information flow (or short-term memory) is going to be part of the history, etc. LSTMs have a repeating unit structure, same as RNN,  but the repeating module instead of a single neural network layer, there are four that interact btw each other, this four layers are seen like gates through which the information flow is moved forming a circuit. This gates are composed by a sigmoid nn and an element-wise multiplication operation. <br><br></div><div>LSTMs have a repeating unit structure usually called cells, same as RNN,  but the repeating module instead of a single neural network layer, there are four that interact btw each other. </div><div><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/3224d44e737780acbcba153fa0ea4d9b/Screen_Shot_2018_02_08_at_12_27_27.png" />
         <pubDate>2018-02-08 11:02:04 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229498352</guid>
      </item>
      <item>
         <title>GRU (Gated Recurrent Unit)</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229521288</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/4d5cab47cbdcf31ad99564ccb58292e3/IMG_20180212_191024.jpg" />
         <pubDate>2018-02-08 12:20:28 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229521288</guid>
      </item>
      <item>
         <title>Anatomy of a LSTM Cell</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229965669</link>
         <description><![CDATA[<ul><li><strong>Learn gate</strong> --&gt; combines short-term memory and event ignoring part the information by wise multiplying by a factor i(t). The combination is performed by putting them through a linear function which consists of joining the vectors by multiplying by a weight matrix adding a bias and finally squashing the result with a tanh activation function. This combination leads to a new pseudo state that can be called as ~C(t), which later use will lead to the new updated cell state from C(t-1) to C(t).&nbsp;</li><li>To calculate i(t) we take the previous short-term info and event as an input to a small nn, and pass them to a linear function with new weights and bias and squashing them with a sigmoid function. The output is i(t) which is element-wise multi plicated to ~C(t).&nbsp;</li><li><strong>Forget gate</strong> --&gt; through which its possible rid of irrelevant&nbsp; long-term memory information flow (history), that might be irrelevant for the outcome. After the cleanse, the remaining information will be added to the history. The info dropping is performed by element wise multiplication of the history -the cell state, C(t-1)- by a forget factor f(t).&nbsp;</li><li>To calculate f(t) it is used short-term memory and the event put them through a linear function multiplying by a new matrix and adding a bias, squashing with a sigmoid. This way new information is incorporated to the history.&nbsp;</li><li><strong>Remember gate</strong> --&gt;&nbsp; The output of this gate is new updated long-term memory, thus what we will remember for the future. It adds wisely the remaining info output by the forget gate and the new learnt info from the learn gate. After this gate we have a brand new C(t) state, a new updated info workflow. &nbsp;</li><li><strong>Use gate</strong> --&gt; this gate is responsible to decide which information to use from what we previously know + what we just learned to make a prediction. The prediction is based on a filtered version of the long-term info updated flow C(t). This filter o(t) is an element wise multiplication factor, which is built using the short-term info and the event info into a small nn,&nbsp; passing through a linear function with new weight matrix and bias, and squash the result with the sigmoid function. &nbsp;</li></ul><div><br></div><div>Despite this is a frequent architecture which offers very good results, there are so many others possible. <br><br></div><div><a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/">http://colah.github.io/posts/2015-08-Understanding-LSTMs/</a><br><a href="https://deeplearning4j.org/lstm.html">https://deeplearning4j.org/lstm.html</a></div><div><br></div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/234685987/d7fe0b82c9031741dc190c2b0f853487/IMG_20180212_170015.jpg" />
         <pubDate>2018-02-09 10:52:56 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229965669</guid>
      </item>
      <item>
         <title>Peephole connections</title>
         <author>nvmoyar</author>
         <link>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229967405</link>
         <description><![CDATA[<div>LSTM variant, introduced by <a href="ftp://ftp.idsia.ch/pub/juergen/TimeCount-IJCNN2000.pdf">Gers &amp; Schmidhuber (2000)</a>, is adding “peephole connections.” This variation also considers the cell state as an input for the forget, learn and use gates, which means that history and recent information are combined into the different nn that are run at each gate. <br><a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/#variants-on-long-short-term-memory">http://colah.github.io/posts/2015-08-Understanding-LSTMs/#variants-on-long-short-term-memory</a></div>]]></description>
         <enclosure url="" />
         <pubDate>2018-02-09 11:00:54 UTC</pubDate>
         <guid>https://padlet.com/nvmoyar/72g3qqxc5xp6/wish/229967405</guid>
      </item>
   </channel>
</rss>
