0
$\begingroup$

I am able to fit this autoencoder to my sequence in order to reconstruct it.

However, how would I be able to walk this forward 3 timesteps to get [[11.0], [12.0], [13.0]]?

import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Flatten, LSTM


# --- Data Prep ---
arr_train = [[[1.0], [2.0], [3.0], [4.0], [5.0], [6.0], [7.0], [8.0], [9.0], [10.0]]]
arr_train = np.array(arr)
# arr_train.shape == (1, 10, 1): [samples, timesteps, features]

arr_test = arr_train # test the reconstuction.


# --- Model Design ---
timesteps = arr_train.shape[1]
features = arr_train.shape[2]
outputs = arr_train.shape[1]#10

model = Sequential()
model.add(LSTM(60, input_shape=(timesteps, features)))
model.add(Dense(outputs))
model.compile(loss='mse', optimizer='adamax')

model.fit(
    arr_train
    , arr_test
    , epochs=200
    , batch_size=1
)
# loss == 0.01

If I try to set output=13 it says it must be 10.

$\endgroup$
1
  • $\begingroup$ Did you try this? Xnew = [[...], [...]] ynew = model.predict_classes(Xnew) $\endgroup$ Jun 18 at 8:28

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.