I create my own class which create a Keras model inside one of its methods.
self.model = Sequential()
self.model.add(LSTM(32))
self.model.add(Dense(2, activation
It seems the first Keras LSTM layer still requires an input_shape when using fit_generator which seems to be missing in the Keras documentation and results in the "You must compile your model before using it" error.
To solve make sure you have an input_shape parameter in your first LSTM layer as shown by the example below:
model.add(LSTM(100, input_shape=(n_timesteps, n_dimensions), return_sequences=True))
model.add(Dropout(0.2))
model.add(LSTM(100, return_sequences=False))
model.add(Dropout(0.2))
model.add(Dense(10, activation='tanh'))
model.compile(loss='mse', optimizer='adam')