Search code examples
pythonlstmvalueerror

LSTM model is giving an ValueError while predicting based on X_test data


Hi need a help to solve value erorr wile running LSTM. It seems everything works fine on training data but prediction generates less then expected dimensions my x_train data shape is (846, 30, 3), my y_train data shape is (846,) my x_test 363, 30, 3), my y_test (363) while yhat = modell.predict(test_X) generates (363, 100) enter image description here


Solution

  • Your last dense layer outputs 100 values because you specified so. The output is coherent with your model you give 363 samples and it predicts 363 labels with dimension 100.

    If you only need one value just change the number of neurons in your last Dense layer to 1