I am trying to fit an lstm model to my data read as csv file. (320,6) is the shape of x_train, and the model is given as
def build_modelLSTMlite(input_shape):
model = keras.Sequential()
model.add(keras.layers.LSTM(64, input_shape=input_shape))
model.add(keras.layers.Dense(64, activation='relu'))
model.add(keras.layers.Dropout(0.3))
model.add(keras.layers.Dense(10, activation='softmax'))
return model
model = build_modelLSTMlite(input_shape)
optimiser = keras.optimizers.Adam(learning_rate=0.001)
model.compile(optimizer=optimiser,
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.summary()
history = model.fit(x_train, y_train, batch_size=32, epochs=100)
This model.fit() is showing value error
ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 320, 6), found shape=(32, 6)
You have to create a sliding version of your x_train data. Something like: