I am trying to make a model using Keras with LSTM autoencoder. Here what I have tried
data = df.values
timesteps = 10
dim = data.shape[1]
samples = data.shape[0]
data.shape = (int(samples/timesteps),timesteps,dim)
and then
model = Sequential()
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.add(LSTM(50,input_shape=(timesteps,dim),return_sequences=True))
model.compile(loss='mae', optimizer='adam')
this is my model fit
model.fit(data, data, epochs=50, batch_size=72, validation_data=(data, data), verbose=0, shuffle=False)
This is the error message I am getting
ValueError: Error when checking target: expected lstm_33 to have shape (None, 10, 50) but got array with shape (711, 10, 1)
How can I fix this ?
I have only I data set
input data shape I have = (7110, 1)
This is an Univariate time series data
The error is caused by specifying input_shape=(timesteps,dim)
for all the layers. You only need to do this for the first layer and the rest will be inferred by the previous layer. What is happening is you are overriding the input shape which is causing the error.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加