How to use LSTM for time series data?

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.

Topic lstm rnn deep-learning neural-network

Category Data Science


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.