Replies: 1 comment
-
Hi @AI-Isaiah, i hope my answer will be helpful. print(X_train.shape) The above code will output the form of an X_train array. This allows you to see the input_shape. Check the shape and try again! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to use something else than Dense and Dropout as the layers, e.g. conv1D, or LSTM.
But when doing so, it tells me that my input shape is incorrect.
This is my code:
model_2 = tf.keras.Sequential([
tf.keras.layers.LSTM(256, input_shape = (404,11), return_sequences=True),
tf.keras.layers.Dropout(0.3),
tf.keras.layers.LSTM(64, return_sequences=True),
tf.keras.layers.Dense(1)]
)
model_2.compile(loss = tf.keras.losses.mae,
optimizer = tf.keras.optimizers.Adam(),
metrics = ["mse"])
history = model_2.fit(X_train, y_train, epochs = 100, verbose = 1)
pd.DataFrame(history.history).plot()
plt.ylabel("loss")
plt.xlabel("epochs")
model_2.evaluate(X_test, y_test)
print("predict-mean-error", np.mean(model_2.predict(X_test)-y_test))
print("test", y_test)
Beta Was this translation helpful? Give feedback.
All reactions