Training an LSTM on a sine wave is simple enough. The LSTM easily understands how to predict the wave hundreds of timesteps into the future.
However, the LSTM becomes grossly incompetent once I try to have it predict a sine wave of a different frequency. Even if I try to train it on many waves of different frequencies, it forgets the first wave to learn the next one. An example of how my LSTM fails when I changed the frequency of the test data:
How do I train my LSTM to recognize the concept of frequency and work on any sinusoid?
Edit:
The model that I am using:
inputs = Input(shape=(self.timesteps, self.features))
bd_seq = Bidirectional(LSTM(128, return_sequences=True,
kernel_regularizer='l2'),
merge_mode='sum')(inputs)
bd_sin = Bidirectional(LSTM(32, return_sequences=True,
kernel_regularizer='l2'),
merge_mode='sum')(bd_seq)
bd_1 = Bidirectional(LSTM(self.features, activation='linear'),
merge_mode='sum')(bd_seq)
bd_2 = Bidirectional(LSTM(self.features, activation='tanh'),
merge_mode='sum')(bd_sin)
output = Add()([bd_1, bd_2])
self.model = Model(inputs=inputs, outputs=output)