I have an X_train = [(4096, 18464),(4097, 43045),(4098, 38948),(4099, 2095),(4100, 59432),(4101, 55338),(4102, 51245),(4103, 26658),(4104, 30755),....] with a shape (3283, 2) and
y_train = [19189, 19189, 19189, ..., 1155085434105692417, 1155120620365152513,...] with a shape (3283, 1)
I reshaped the X_train using the code:
X_train = np.reshape(X_train, (X_train.shape[0], 1, X_train.shape[1]))
X_test = np.reshape(X_test, (X_test.shape[0], 1, X_test.shape[1]))
and got shape (3283, 1, 2)
now I build a lstm model:
data_dim= 2
timesteps=1
num_classes=2
model_pass = Sequential()
model_pass.add(LSTM(units=64, return_sequences=True,
input_shape=(timesteps, data_dim)))
model_pass.add(Dense(2, activation='sigmoid'))
model_pass.compile(loss='binary_crossentropy', optimizer='adam',metrics=['accuracy'])
model_pass.summary()
model_pass.fit(X_train, y_train,batch_size=1, epochs = 1, verbose = 1)
But it's giving me an error: ValueError: Error when checking target: expected dense_24 to have 3 dimensions, but got array with shape (3283, 1)
Can anybody tell me what should I do?