Answers.Body: <p>This the the initial condition of the system, namely the first derivative of displacement.</p>
  <p>You need somehow to provide the initial internal state of RNN and this is the way this could be done with <a href="https://keras.io/api/" rel="nofollow noreferrer">Keras API</a>.</p>
  <p>You can find more in the video attached to the article you are referencing to at the <a href="https://youtu.be/av8csD_yrgw?t=2917" rel="nofollow noreferrer">48:37</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-24T10:54:07.367Z
Answers.Text: I edited my question. The reason is, I realized later, that I missed the most important question. If you could answer it... No worry. I'll not put other questions here
Answers.UserDisplayName: Dave
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-24T14:17:36.057Z
Answers.Text: Ok, now I got it. After seeing the video for the 4th time, I understood the concept.
Answers.UserDisplayName: Dave
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-23T15:09:09.430Z
Answers.LastActivityDate: 2024-06-23T15:09:09.430Z
Answers.UserDisplayName: Damir Tenishev
Body: <p>I'm trying to understand the concept of dynamical system with NN by studying this very well explanation <a href="https://aleksandarhaber.com/using-recurrent-neural-networks-and-keras-tensorflow-to-learn-input-output-behaviour-of-dynamical-systems/" rel="nofollow noreferrer">here</a>.</p>
  <p>But I stuck in the following problem:</p>
  <ol>
  <li>The author uses a RNN and/or a LSTM network as a NN for replicating the system (a spring mass system). And then he feed the RNN network with the following input:</li>
  </ol>
  <p><a href="https://i.sstatic.net/gT4KrOIz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gT4KrOIz.png" alt="enter image description here" /></a></p>
  <p>where <em>textX</em> is the in reality (as later explained) is just an example. <em>trainX</em> and <em>validationX</em> have the same shape.</p>
  <p>In this case I do not understand why the RNN network has been fed with a vector with 2 columns. The first column is the input (<span class="math-container">$u$</span> in the system) but the second column is filled by zeros. What's the meaning of zeros? Why to feed a RNN network with an input, which contains only zeros?</p>
  <p><strong>EDIT:</strong></p>
  <ol start="2">
  <li><p>Looking deeper into the code I realized, that the author uses the <code>fit</code> method of Keras for training the model.</p>
  <p>history=model.fit(trainX, output_train , epochs=2000, batch_size=1, callbacks=callbacks_list, validation_data=(validateX,output_validate), verbose=2)</p>
  </li>
  </ol>
  <p>Now there is one thing, that for me is not clear here. Passing the training data <code>trainX</code> with the label <code>output_train</code>, the <code>fit</code> method doesn't get sequence of data as excepted, since the author makes use of RNN or LSTM. In this way he is passing one input and the corresponding target. So I do not see here too much difference from a conventional NN. Shouldn't one pass a sequence of data and a sequence of outputs, since the model is a RNN one?</p>
  
Tags: <neural-networks><recurrent-neural-networks><models>
Title: Input size for a RNN layer by modeling a dynamical system
UserDisplayName: Dave
ThreadText: # Input size for a RNN layer by modeling a dynamical system
  
  (Asked by: username_0 on 2024-06-23)
  
  I'm trying to understand the concept of dynamical system with NN by studying this very well explanation [here](https://aleksandarhaber.com/using-recurrent-neural-networks-and-keras-tensorflow-to-learn-input-output-behaviour-of-dynamical-systems/).
  
  But I stuck in the following problem:
  
  1. The author uses a RNN and/or a LSTM network as a NN for replicating the system (a spring mass system). And then he feed the RNN network with the following input:
  
  [![enter image description here](https://i.sstatic.net/gT4KrOIz.png)](https://i.sstatic.net/gT4KrOIz.png)
  
  where *textX* is the in reality (as later explained) is just an example. *trainX* and *validationX* have the same shape.
  
  In this case I do not understand why the RNN network has been fed with a vector with 2 columns. The first column is the input ($u$ in the system) but the second column is filled by zeros. What's the meaning of zeros? Why to feed a RNN network with an input, which contains only zeros?
  
  **EDIT:**
  
  2. Looking deeper into the code I realized, that the author uses the `fit` method of Keras for training the model.
  
     history=model.fit(trainX, output\_train , epochs=2000, batch\_size=1, callbacks=callbacks\_list, validation\_data=(validateX,output\_validate), verbose=2)
  
  Now there is one thing, that for me is not clear here. Passing the training data `trainX` with the label `output_train`, the `fit` method doesn't get sequence of data as excepted, since the author makes use of RNN or LSTM. In this way he is passing one input and the corresponding target. So I do not see here too much difference from a conventional NN. Shouldn't one pass a sequence of data and a sequence of outputs, since the model is a RNN one?
  
  **Tags:** neural-networks, recurrent-neural-networks, models
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-06-23. Score: 1 | Accepted answer
  
  This the the initial condition of the system, namely the first derivative of displacement.
  
  You need somehow to provide the initial internal state of RNN and this is the way this could be done with [Keras API](https://keras.io/api/).
  
  You can find more in the video attached to the article you are referencing to at the [48:37](https://youtu.be/av8csD_yrgw?t=2917).
  
  > **Comments:**
  > **username_0**: I edited my question. The reason is, I realized later, that I missed the most important question. If you could answer it... No worry. I'll not put other questions here  
  > **username_0**: Ok, now I got it. After seeing the video for the 4th time, I understood the concept.  
  
  ---
  
  