I recently started learning about neural networks at my university. From another project I have sensor data that is very noisy and I thought NNs and especially LSTMs should be able to do some signal post processing.
I got it working and it is doing a better job in comparison to a simple avg-sliding-window. But it has a similar problem as the sliding window, that in sudden changes it takes some time to normalize.
For example: green: ground-truth, blue: measured-signal, orange: NN output
My model looks like:
model = tf.keras.models.Sequential()
model.add(LSTM(32, return_sequences=True,
input_shape=(TIMESTEPS, 1),
batch_size=BATCH_SIZE,
stateful=True))
model.add(LSTM(32, return_sequences=True, stateful=True))
model.add(LSTM(32, stateful=True))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam',
metrics=['mean_absolute_error', 'mean_squared_error'])
Edit: In my current approach TIMESTEPS is 1 so I can incrementally feed data to it. Basically put a raw value in and get a smoothed value out.
From my understanding stateful=True
should make it remember previous values.
Is there a way to encourage the LSTM to react to those changes?
Also any tips where I can learn more about signal processing with NNs?