O'Reilly logo

Python Reinforcement Learning Projects by Rajalingappaa Shanmugamani, Yang Wenzhuo, Sean Saito

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

Training the data

The scripts that were written previously were combined with training the dataset. Let's start the training by importing all the modules that are developed in the previous sections as shown here:

from data_reader import Data_Readerimport data_parserfrom gensim.models import KeyedVectorsimport helper as hfrom seq_model import Chatbotimport tensorflow as tfimport numpy as np

Next, let's create a set of generic responses observed in the original seq2seq model which the policy gradients are trained to avoid:

generic_responses = [    "I don't know what you're talking about.",     "I don't know.",     "You don't know.",    "You know what I mean.",     "I know what you mean.",     "You know what I'm saying.",    "You don't know anything."]

Next, we ...

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