Esempio n. 1
0
 def generate_data_rl(self, ngames=50, fname=''):
     """
     generate a new batch of data with the latest prediction model
     self.model_predict
     rl vs. smithy bot
     """
     vbuy = lambda x: self.model_predict.predict(x)
     #vact = lambda x: self.model_act.predict(x)
     # p1 = BuyActRLplayer(vbuy, vact)
     p1 = RLPlayer(vbuy)
     p1.epsilon = self.epsilon
     p1.record_history = 1
     p1.include_action = 1
     p2 = RLPlayer(vbuy)
     p2.epsilon = self.epsilon
     p2.record_history = 1
     p2.include_action = 1
     d_this, _ = self.record_game(ngames, [p1, p2], fname, verbose=1)
     self.add_data(d_this)
     return d_this
Esempio n. 2
0
 def generate_data_rl(self, ngames=50, fname=''):
     """
     generate a new batch of data with the latest prediction model self.model_predict
     by playing against self.
     """
     vf = lambda x: self.model.predict(x)
     p2 = RLPlayer(vf)
     p2.epsilon = self.epsilon
     p2.record_history = 1
     p2.include_action = 1
     return self.generate_data_bot(p2, ngames, fname)
Esempio n. 3
0
 def generate_data_bot(self, bot, ngames=50, fname=''):
     """
     generate a new batch of data with the latest prediction model self.model
     rl vs. specified bot
     """
     vf = lambda x: self.model.predict(x)
     p1 = RLPlayer(vf)
     p1.epsilon = self.epsilon
     p1.record_history = 1
     p1.include_action = 1
     bot.record_history = 0
     d_this = self.record_game(ngames, [p1, bot], fname)
     self.add_data(d_this)
     return d_this
Esempio n. 4
0
 def generate_data_smithy(self, ngames=50, fname=''):
     """
     generate a new batch of data with the latest prediction model
     self.model_predict
     rl vs. smithy bot
     """
     vbuy = lambda x: self.model_predict.predict(x)
     # vact = lambda x: self.model_act.predict(x)
     # p1 = BuyActRLplayer(vbuy, vact)
     p1 = RLPlayer(vbuy)
     p1.epsilon = self.epsilon
     p1.record_history = 1
     p1.include_action = 1
     p2 = SmithyBot()
     # try including smithy bot's data in the training.
     p2.record_history = 0
     d_this, _ = self.record_game(ngames, [p1, p2], fname)
     self.add_data(d_this)
     return d_this