actually I am trying to build a LSTM-Model in Keras and Tensorflow. My dataset has about 3200 items with 4 features and 3 labels.
X Shape: (3200, 4)
Y Shape: (3200, 3)
If I want about 5 times steps, so do i have to reshape like that:
n_time_steps= 5
n_features = 4
X_train = X_train.reshape((-1, n_time_steps, n_features))
so I get these shapes:
X Shape: (640, 5, 4)
Y Shape: (3200, 3)
I am kinda confused, because 640 =! 3200 data points... but the model compiles and fits without any error. But the acc and loss are insane.
When I try to reshape Y_train too Y Shape: (640, 5, 3)
throws
Incompatible shapes: [10,3] vs. [10,5,3] [[node sub (defined at :12) ]] [Op:__inference_train_function_74818 Function call stack: train_function
Here is my model
opt = 'adam'
model = keras.Sequential()
model.add(layers.LSTM(128, input_shape=(n_time_steps,4)))
model.add(layers.Dropout(0.2))
model.add(layers.Dense(3 ,activation="sigmoid"))
model.compile(optimizer=opt,loss=hn_multilabel_loss,metrics=['accuracy','mae'])
model.summary()
history = model.fit(X_train, Y_train,batch_size = 10, epochs=10, validation_split = 0.1)
Anyone has an idea how to create a LSTM with 5 time steps and 4 features ? What is the right input and output shape?
Thanks guys!