0

When I Run this code:

model = Sequential([
    LSTM(300, activation='tanh', input_shape=data.shape, recurrent_activation='sigmoid'),
    Dropout(0.2),
    Dense(4, activation='linear')
])
model.compile(optimizer='adam', loss='mse')
history = model.fit_generator(training, epochs=22, steps_per_epoch=1)

This error pops up: ValueError: cannot copy sequence with size 7 to array axis with dimension 5 I don't know how to handle that. Yesterday, the code worked perfectly. In other threads I've found; the error might be related to np.vstack. This is the thread I'm writing about.

I've tried to change the data to a np.array but it did not work. Can anyone help?

This might be useful: training = TimeseriesGenerator(data, data, length=7, batch_size=6)

TimeseriesGenerator is from keras.preprocessing.sequence

1 Answer 1

0

You need input numpy arrays into Keras' TimeSeries generator, not directly DataFrames, you can do data.values for pass numpy only.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.