name = 'frenzy_vs_betting.p' start = time.time() ALPHA = 0.001 LAMBS = [0.75] n_train = [] callBot = calling_station.Calling_station() bsbot = betting_station.Betting_station() for LAMB in LAMBS: net = UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, alpha=ALPHA, lamb=LAMB, randomInit=True) auto = fw.AnotherAutoPlayer(net, name="superbot") distance = 10 i = 0 while distance > 0.0002: oldnet = auto.net.deepcopy() auto.net.alpha /= 1.01 auto.train(1000, bsbot, debug=0, frenzy=1) distance = UnbiasedNet.diff(auto.net, oldnet) i = i + 1000 pickle.dump(auto, open(str(LAMB) + name, "wb")) print "number of training:", i n_train.append(i) print "the training used", time.time() - start opp_name = str(LAMB) + name
csBot = calling_station.Calling_station() bsBot = betting_station.Betting_station() for LAMB in LAMBS: net = BiasedPerceptron(fw.n_in, fw.n_hidden, fw.n_out, alpha=ALPHA, lamb=LAMB, randomInit=True) net2 = BiasedPerceptron(fw.n_in, fw.n_hidden, fw.n_out, alpha=ALPHA, lamb=LAMB, randomInit=True) auto = fw.AnotherAutoPlayer(net, name="superbot") ai = fw.AnotherAutoPlayer(net2, name='cpu', frenzy=1) auto.train(n_train, bsBot, debug=0, frenzy=1) pickle.dump(auto, open(str(LAMB) + name, "wb")) print "the training used time", time.time() - start j = 0 for LAMB in LAMBS: auto = pickle.load(open(str(LAMB) + name, 'rb')) result = [] for i in range(5): result.append(auto.compete(bsBot, 2000, debug=0)) print 'Lambda:', LAMB
for LAMB in [0.6, 0.65, 0.7]: name = ('specified_training_vs_Q' + str(num) + '_.005_' + str(LAMB) + '_' + str(check_prob) + '_' + str(call_prob) + '_' + str(raise_prob) + '_' + str(checkfold_prob) + '.p') print n_cards net1 = UnbiasedNet.NeuralNet(fw.n_in, n_cards, fw.n_out, randomInit=True, alpha=ALPHA, lamb=LAMB, subdiv=[(0, 0), (n_cards, n_cards), (fw.n_in, n_cards)]) auto = fw.AnotherAutoPlayer(net1, name="auto1", check_prob=check_prob, call_prob=call_prob, raise_prob=raise_prob, checkfold_prob=checkfold_prob) ai = specified_prob.Specified_prob( prob_list={ 'Check': list_of_bots[num + 2][0], 'Call': list_of_bots[num + 2][1], 'Raise': list_of_bots[num + 2][2], 'CheckFold': list_of_bots[num + 2][3] }) auto.train(n_train, ai, debug=0, frenzy=1) pickle.dump(auto, open(name, "wb")) result = [] for i in range(10): result.append(auto.compete(ai, 5000, debug=0))
ALPHA = 0.005 n_train = 100000 list_of_bots= pickle.load(open("list_of_opponents.p", "rb")) stat_obj = AnotherStatus() n_cards = sum( len(stat_obj.vec_cards[key]) for key in stat_obj.vec_cards ) for LAMB in [0.6, 0.65]: name = 'specified_trainning_vs_Q1_.005_' + str(LAMB) + '_1e5.p' print n_cards net1 = UnbiasedNet.NeuralNet(fw.n_in, n_cards, fw.n_out, randomInit=True, alpha=ALPHA, lamb=LAMB, subdiv=[(0,0), (n_cards,n_cards), (fw.n_in,n_cards)]) auto = fw.AnotherAutoPlayer(net1, name="auto1", check_prob=0.3, call_prob=0.3, raise_prob=0.1, checkfold_prob=0.1) ai = specified_prob.Specified_prob(prob_list={ 'Check':list_of_bots[3][0], 'Call':list_of_bots[3][1], 'Raise':list_of_bots[3][2], 'CheckFold':list_of_bots[3][3]}) auto.train(n_train, ai, debug=0, frenzy=1) pickle.dump(auto, open(name, "wb")) result = [] for i in range(10): result.append( auto.compete(ai, 5000, debug=0) ) data = '\n Learning rate: ' + str(ALPHA) data += '\n Lambda: ' + str(LAMB) data += '\n Number of training: ' + str(n_train) data += '\n Results: ' + str(result) print data
from tight_aggressive import Tight_aggressive name = 'frenzy_vs_TA.p' start = time.time() ALPHA = 0.001 LAMBS = [0.9] n_train = [] for LAMB in LAMBS: net = UnbiasedNet.NeuralNet(another.n_in, another.n_hidden, another.n_out, alpha=ALPHA, lamb=LAMB, randomInit=True) auto = another.AnotherAutoPlayer(net, name="against_TA") auto2 = Tight_aggressive() distance = 10 i = 0 while distance > 0.0002: oldnet = auto.net.deepcopy() auto.net.alpha /= 1.01 auto.train(1000, auto2, debug=0, frenzy=1) distance = UnbiasedNet.diff(auto.net, oldnet) i = i + 1000 print "number of training:", i pickle.dump(auto, open(str(LAMB) + name, "wb")) n_train.append(i) print "the training used time", time.time() - start bsbot = betting_station.Betting_station()
next = self.status.check_first() action = "Check" self.status = next.copy() #update the other guy's status vector resulting from your act player2.status.vec_act[stage][1] = self.status.vec_act[stage][0] player2.status.vec_act[stage][2] = self.status.vec_act[stage][2] player2.status.stage = self.status.stage return action if __name__ == "__main__": import pickle # auto= pickle.load(open("player.p", "rb")) # net= UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, # alpha=0.001, # lamb=0.5, randomInit=False) auto = Tight_aggressive() net = UnbiasedNet.NeuralNet(anotherStatus.n_in, anotherStatus.n_hidden, anotherStatus.n_out, alpha=0.001, lamb=0.9, randomInit=True) auto2 = anotherStatus.AnotherAutoPlayer(net, name="against_TA") win = [] for i in range(10): win.append(auto2.compete(auto, 2, debug=1)) print win print np.mean(win) print np.std(win)
<<<<<<< HEAD for LAMB in [0.7, 0.65]: ======= for LAMB in [0.6, 0.65]: >>>>>>> a bunch of new bots. Try to get the new holdem file. name = 'coarser_blind_vs_betting_.005_' + str(LAMB) + '_1e5.p' print n_cards net1 = UnbiasedNet.NeuralNet(fw.n_in, n_cards, fw.n_out, randomInit=True, alpha=ALPHA, lamb=LAMB, subdiv=[(0,0), (n_cards,n_cards), (fw.n_in,n_cards)]) auto = fw.AnotherAutoPlayer(net1, name="auto1", check_prob=0.3, <<<<<<< HEAD call_prob=0.3, raise_prob=0.3, checkfold_prob=0.1) ======= call_prob=0.3, raise_prob=0.1, checkfold_prob=0.03) >>>>>>> a bunch of new bots. Try to get the new holdem file. ai = Betting_station() auto.train(n_train, ai, debug=0, frenzy=1) pickle.dump(auto, open(name, "wb")) result = [] for i in range(10): result.append( auto.compete(ai, 5000, debug=0) ) data = '\n Learning rate: ' + str(ALPHA) data += '\n Lambda: ' + str(LAMB) data += '\n Number of training: ' + str(n_train)