O'Reilly logo

Hands-On Natural Language Processing with Python by Rajalingappaa Shanmugamani, Rajesh Arumugam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Evaluating the chatbot on the testing set

We can then write a method to predict the responses for each of the dialogs in our testing dataset and obtain accuracy scores:

    def test(self):        # Compute accuracy over test set        test_facts, test_questions, test_answers = vectorize_data(            self.test_data, self.word_idx, self.sentence_size,             self.batch_size, self.memory_size)        test_preds = self.predict_for_batch(test_facts, test_questions)        test_acc = metrics.accuracy_score(test_preds, test_answers)        print("Testing Accuracy: ", test_acc)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required