Body: <p>I want to get some encodings for temporal data (with a highly varying number of timesteps).</p>
  <p>The dataset is of the format: <code>array&lt;TemporalSample = list, SAMPLE_COUNT&gt;</code> (where <code>array</code> is fixed size and <code>list</code> is variable).</p>
  <p>The <code>TemporalSample</code>s are simply <code>list</code>s of size <code>TemporalSample::timesteps</code></p>
  <hr />
  <p>Currently, I use a standard RNN network of the form:</p>
  <pre><code>model = keras.Sequential()
  model.add(layers.GRU(256, dropout=0.1, input_shape=[None, 1], return_sequences=False))
  model.add(layers.Dense(len(output_names), activation=&quot;softmax&quot;))
  model.compile(optimizer='adam',
                loss='categorical_crossentropy',
                metrics=['accuracy'])
  model.summary()
  </code></pre>
  <p>The problem is my inputs have variable lengths, if I want an auto-encoder, my output needs to be variable-length (just like my input), and I need an inverse RNN layer (something like <code>layers.InverseGRU(output_shape=[None, 1])</code>) but from my reading this seems like not something that has been considered/done before.</p>
  <p>Is this at all possible?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T01:48:04.870Z
Comments.Text: As I wrote for the other post, it's not clear to me whether this is a programming issue. Can you clarify this?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:03:24.153Z
Comments.Text: @nbro I'm asking if I can build a RNN auto encoder - using python examples for context
Comments.UserDisplayName: Tobi Akinyemi
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:05:02.003Z
Comments.Text: For some reason, it wasn't clear to me after the first reading that you just want to build an AE with recurrent layers.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:06:10.863Z
Comments.Text: @nbro the main problem is i have variable length timesteps
Comments.UserDisplayName: Tobi Akinyemi
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:13:06.127Z
Comments.Text: Ok, I will leave this post open, although you also asked the same question [here](https://stackoverflow.com/q/67028618/3924118), so that maybe someone tries to give you an answer ;)
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:13:39.457Z
Comments.Text: @nbro I asked here as this is a more AI focused community (the answer on SO is wrong)
Comments.UserDisplayName: Tobi Akinyemi
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:14:46.897Z
Comments.Text: What about this: https://machinelearningmastery.com/lstm-autoencoders/?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:17:22.343Z
Comments.Text: @nbro doesn't account for variable timesteps
Comments.UserDisplayName: Tobi Akinyemi
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:19:14.593Z
Comments.Text: Ok. I didn't read that article, but it seemed to go in the direction of what you were asking (although, to be honest, I didn't carefully read your post).
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-04-11T02:27:15.120Z
Comments.Text: @nbro I actually have a working encoder now (at the time of writing this post I didn't); however, I'm still interested to see if anyone has any differing techniques
Comments.UserDisplayName: Tobi Akinyemi
Tags: <machine-learning><tensorflow><python><keras><recurrent-neural-networks>
Title: Is a true RNN auto encoder possible with Keras/TF
UserDisplayName: Tobi Akinyemi
ThreadText: # Is a true RNN auto encoder possible with Keras/TF
  
  (Asked by: username_0 on 2021-04-09)
  
  I want to get some encodings for temporal data (with a highly varying number of timesteps).
  The dataset is of the format: array (where array is fixed size and list is variable).
  The TemporalSamples are simply lists of size TemporalSample::timesteps
  
  Currently, I use a standard RNN network of the form:
  model = keras.Sequential()
  model.add(layers.GRU(256, dropout=0.1, input_shape=[None, 1], return_sequences=False))
  model.add(layers.Dense(len(output_names), activation="softmax"))
  model.compile(optimizer='adam',
                loss='categorical_crossentropy',
                metrics=['accuracy'])
  model.summary()
  
  The problem is my inputs have variable lengths, if I want an auto-encoder, my output needs to be variable-length (just like my input), and I need an inverse RNN layer (something like layers.InverseGRU(output_shape=[None, 1])) but from my reading this seems like not something that has been considered/done before.
  Is this at all possible?
  
  **Tags:** machine-learning, tensorflow, python, keras, recurrent-neural-networks
  > **Comments:**
  > **username_1**: As I wrote for the other post, it's not clear to me whether this is a programming issue. Can you clarify this?  
  > **username_0**: @nbro I'm asking if I can build a RNN auto encoder - using python examples for context  
  > **username_1**: For some reason, it wasn't clear to me after the first reading that you just want to build an AE with recurrent layers.  
  > **username_0**: @nbro the main problem is i have variable length timesteps  
  > **username_1**: Ok, I will leave this post open, although you also asked the same question [here](https://stackoverflow.com/q/67028618/3924118), so that maybe someone tries to give you an answer ;)  
  > **username_0**: @nbro I asked here as this is a more AI focused community (the answer on SO is wrong)  
  > **username_1**: What about this: https://machinelearningmastery.com/lstm-autoencoders/?  
  > **username_0**: @nbro doesn't account for variable timesteps  
  > **username_1**: Ok. I didn't read that article, but it seemed to go in the direction of what you were asking (although, to be honest, I didn't carefully read your post).  
  > **username_0**: @nbro I actually have a working encoder now (at the time of writing this post I didn't); however, I'm still interested to see if anyone has any differing techniques  
  
  ---
  
  ## 0 answers
  
  