Evaluating the model
We have trained the model on the train test and now we can evaluate the performance of the network on the test set. This can be done using the evaluation()
function. This function returns the loss value and the metrics values for the model in test mode:
test_file = 'sem_eval2103.test' test_tweets, y_test = read_data(test_file) X_test = transfer(test_tweets, word2idx) del test_twee X_test = pad_sequences(X_test, maxlen=max_len, truncating='post') y_test = to_categorical(y_test) test_loss, test_acc = model.evaluate(X_test, y_test) print("Testing loss: {:.5}; Testing Accuracy: {:.2%}" .format(test_loss, test_acc))