Someone pls help me, I’ve been stuck with this problem in 2 days, I got not solution anywhere, I have to done this work quick because due is 2 days next
Incompatible shapes: [100,1] vs. [100,1,4,1] when I try to train my data
I don’t know what cause it, I did try to change anything on the layer but not solved
My model was like this
train_set = windowed_dataset(x_train, window_size=60, batch_size=100, shuffle_buffer=1000) model = tf.keras.models.Sequential([ tf.keras.layers.Input(shape=(100, 4,)), tf.keras.layers.Normalization(axis=None), # tf.keras.layers.LSTM(64, return_sequences=True), # tf.keras.layers.LSTM(64), tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(60, return_sequences=True)), tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(60)), tf.keras.layers.Flatten(), tf.keras.layers.Dense(120, activation="relu"), tf.keras.layers.Dense(100, activation="relu"), tf.keras.layers.Dense(60, activation="relu"), tf.keras.layers.Dropout(.5), tf.keras.layers.Dense(30, activation="relu"), tf.keras.layers.Dense(10, activation="relu"), tf.keras.layers.Dense(1, input_shape=[None, 1, 1]), ]) model.summary()
And here is the compiling code
optimizer = tf.keras.optimizers.SGD(learning_rate=.01, momentum=.9, decay=.01) model.compile( loss=tf.keras.losses.Huber(), optimizer=optimizer, metrics=["mae"]) print('Samples : %d' % len(x_train)) history = model.fit(train_set, epochs=50, steps_per_epoch=5, callbacks=[under_mae()])
I’d appreciate the help and explanation from anyone, thank you (I’m sorry if my english bad).
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.