-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalpha_win_coarser_dealer_vs_betting.py~
40 lines (32 loc) · 1.34 KB
/
alpha_win_coarser_dealer_vs_betting.py~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pickle
import UnbiasedNet
import coarserStatus as fw
from calling_station import Calling_station
from betting_station import Betting_station
result_name = 'result_coarser_dealer_vs_betting.txt'
ALPHA = 0.0005
n_train = 100000
stat_obj = fw.AnotherStatus()
n_cards = sum( len(stat_obj.vec_cards[key]) for key in stat_obj.vec_cards )
n_cards += 1 # This includes dealer info
for LAMB in [0.55,0.6, 0.65, 0.7, 0.75, 0.8]:
name = 'coarser_dealer_vs_betting_.005_' + str(LAMB) + '_1e6.p'
print n_cards
net = UnbiasedNet.NeuralNet(fw.n_in, n_cards, fw.n_out, randomInit=True,
alpha=ALPHA, alpha_win=50*ALPHA, lamb=LAMB,
subdiv=[(0,0), (n_cards,n_cards),
(fw.n_in,n_cards)])
auto = fw.AnotherAutoPlayer(net, name="superbot")
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)
data += '\n Results: ' + str(result)
print data
with open(result_name, 'a') as f:
f.write(data)