I am attempting to forecast a time series using tensorflow with the following code:

X = mytimeseries
scaler = MinMaxScaler()
scaled = scaler.fit_transform(X)

length = len(X)-1
generator = TimeseriesGenerator(scaled,scaled,

model = Sequential()


Then I just run a loop to forecast, but it's giving me nothing more than a straight line after a few points, as observed below.

Obviously there is a trend for the data to go down, and I would expect to see that.

Is this because my architecture is not sophisticated enough / not the right one to pick up on the general decline of the known data? Have I inappropriately chosen any parameters?

I have tried increasing the number of neurons in the dense layer, units in the LSTM cell, etc. At the moment, the thing that looks like to most effect the resultant curve is to change the length parameter in my code above. But all this does is make the predictions more sinusoidal.

enter image description here

Thanks for your help!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.