I am training a simple model in keras for NLP task with following code. Variable names are self explanatory for train, test and validation set. This dataset has 19 classes s
I have found the problem. metrics=['accuracy']
calculates accuracy automatically from cost function. So using binary_crossentropy
shows binary accuracy, not categorical accuracy. Using categorical_crossentropy
automatically switches to categorical accuracy and now it is the same as calculated manually using model1.predict()
. Yu-Yang was right to point out the cost function and activation function for multi-class problem.
P.S: One can get both categorical and binary accuracy by using metrics=['binary_accuracy', 'categorical_accuracy']