I'm trying to train an LSTM network to do an unsupervised binary classification.
I have a matrix of integers as input, every row is a different trace ad every column is a feature.
This is the model I used:
time_steps = 4000
features = 25
model = Sequential()
model.add(LSTM(128, input_shape=(time_steps, features), name='lstm'))
model.add(Dense(1, activation='relu'))
model.summary()
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(x_train, x_train, batch_size=batch_size, epochs=epochs, verbose=2)
And this is the error I get:
Error when checking target: expected dense_1 to have 2 dimensions, but got array with shape (1, 4000, 25)
It is generated when it tries to run model.fit
The input is formed like the following:
x_train = np.array([input_array[:4000]])
Every trace of the input has 25 features.
I'm new in the field and I can't figure out how to solve the problem. I have checked similar tickets but none of them helped me.
Here some of the tickets I analyzed:
Error when checking target: expected dense_1 to have 3 dimensions, but got array with shape (118, 1)