I've an ECG data spread over time. The duration for each data is around 3 minutes (approx 180 seconds).

Each second around 200 recordings were taken. So total length for each sample is approx 36000.

Now how to use this data for lstm. My purpose is to make an encoder-decoder network to encode this data into small size. I'm planning to use reconstruction error for loss function.


1 Answer 1


If you are going to use the ECG time series as the input for the LSTM-network you will need to reshape your data

data = data.reshape(signal length,time step pr sample, ECG channel)

So if your data is 36000 samples long and you only use 1 channel you will do like this:

data = data.reshape(36000,1,1)

Then you can make a simple LSTM model like this:

model = Sequential()
model.add(InputLayer(input_shape=(1, 1)))
model.add(LSTM(32,activation='tanh', return_sequences=True))
model.add(Dense(1, activation='sigmoid'))

I think the same principals will apply to your encoder/decoder


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.