Question

I am trying to implement https://dl.acm.org/doi/pdf/10.1145/3269206.3271794 .

Structure: enter image description here

As it said:

In particular, we integrate the embedding vectors learned from each individual recurrent encoder into a new conclusive embedding vector to jointly consider various time series patterns with different ⟨α, β⟩ configurations

For my understanding, it use multiple individual rnn cell to process different timeseries, then concat all hidden states together to form a 3D input which can use 2d conv extract features .

But I didn't see there is a way to create multiple rnn cells in same layer , do I misunderstand?? If not , could you please give me a guide or an example ?

Was it helpful?

Solution 2

Use funcational api solve the problem .

Structure likes this :


import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers

data = pd.DataFrame(np.random.uniform(size=(1000,3)), columns=['Sales', 'SalesDiff7', 'SalesAggMean7'])

multi_inputs = []
multi_outputs = []
window_size = my_window.input_width

for i in range(data.shape[1]):
    ti = keras.Input(shape=(window_size, 1), name=f't{i}')
    tlstm = layers.LSTM(32)(ti)
    multi_inputs.append(ti)
    multi_outputs.append(tlstm)
    
r = tf.stack(multi_outputs, axis=-2) 
.....
result = keras.layers.Dense(units=1)(fc)

model = Model(
    inputs=multi_inputs,
    outputs=result,
)

OTHER TIPS

Not exactly familiar with this model architecture but, I don't think it works the way you described it.

From a quick skim, a simplified overview of the model may be

  1. data input: $X$ multiple time series
  2. RNN: pass each time series $x$ through a recurrent neural network and grab its hidden state
  3. Joint embedding: Concat hidden states from each $x$ series into an embedding with $X$ channels
  4. Convnet

But I didn't see there is a way to create multiple rnn cells in same layer , do I misunderstand?? If not , could you please give me a guide or an example ?

Essentially, any rnn will have a number of cells equal to the number of time steps. As an example, in NLP that number of cells would be equal to the number of words in a sentence, where each sentence in your trainset must have the same length.

I suggest you familiarise yourself with sequence models to better understand the concept of this paper.

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top