I have a dataset with 10 input categorical features and one output categorical feature with class 0 and 1. X_train follows a 3D array so I have done label encoding beforehand on the dataset.
I have applied categorical_crossentropy but I am getting 26% accuracy with activation function sigmoid. When I apply binary_crossentropy, the accuracy drastically increased to 98%.
model = Sequential()
model.add(LSTM(256, input_shape=(n_timesteps,n_features),recurrent_activation='hard_sigmoid'))
model.add(Dense(16))
model.add(Dense(n_outputs, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
and dataset is divided as:
X_train: (430000, 5, 10)
y_train: (430000, 1)
n_outputs? Note that there are circumstances when the two losses are equivalent, but it's not clear that those circumstances exist in your code; see https://stats.stackexchange.com/q/260505/22311 – Sycorax Feb 27 '22 at 14:19