I am getting the below value due to dimension issue. My input features are ColA and ColB and I want to predict the ColC. When i try to fit the model i am getting the below issue.
ValueError: Input 0 of layer sequential_6 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 2]
import pandas as pd
from numpy import array
from numpy import hstack
from tensorflow.keras.layers import *
from tensorflow.keras import Sequential
from sklearn.model_selection import train_test_split
df = pd.read_csv('input_file.csv')
df.head()
ColA ColB ColC
0 10 15 25
1 20 25 45
2 30 35 65
3 40 45 85
4 50 55 105
X = df.drop(columns =['ColC'])
y = df['ColC']
n_features = X.shape[1]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=2)
# define model
n_steps = 5
model = Sequential()
model.add(LSTM(50, activation='relu', input_shape=(3, 2)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')
# fit model
model.fit(X, y, epochs=20)
Error message: C:\Users\Amy\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\keras\engine\input_spec.py:180 assert_input_compatibility str(x.shape.as_list()))
ValueError: Input 0 of layer sequential_6 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 2]