ValueError: Shapes (None, 1) and (None, 3) are incompatible
The first problem is with the LSTM input_shape.
input_shape = (20,85,1).
From the doc: https://keras.io/layers/recurrent/
LSTM layer expects 3D tensor with shape (batch_size, timesteps, input_dim).
model.add(tf.keras.layers.Dense(nb_classes, activation='softmax')) - this suggets you're doing a multi-class classification.
So, you need your
y_test have to be one-hot-encoded. That means they must have dimension
(number_of_samples, 3), where
3 denotes number of classes.
You need to apply
tensorflow.keras.utils.to_categorical to them.
y_train = to_categorical(y_train, 3) y_test = to_categorical(y_test, 3)
tf.keras.callbacks.History() - this callback is automatically applied to every Keras model. The History object gets returned by the fit method of models.
Check if the last Dense Layer(output) has same number of classes as the number of target classes in the training dataset. I made similar mistake while training the dataset and correcting it helped me.