Skip to content

Commit e90d68c

Browse files
committed
Fix PEP8
Create INSTALL section on README.md to use requirements.txt on python requirements.txt file added
1 parent 19086bc commit e90d68c

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ What is missing right now:
1818
* The full proc that starts from a random state and incorporates a MCTS/update-NN to obtain better policies
1919

2020
*Feel free to make pull-requests :)*
21+
22+
23+
## INSTALL
24+
25+
```
26+
pip install -r requirements.txt
27+
```

alphago-zero.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#!/usr/bin/python
22

33
import keras
4-
5-
from keras.models import Model
6-
from keras.layers import Input, Dense
7-
from keras.layers import Conv2D
8-
from keras.layers import BatchNormalization
94
from keras.layers import Activation
5+
from keras.layers import BatchNormalization
6+
from keras.layers import Conv2D
7+
from keras.layers import Input, Dense
8+
from keras.models import Model
109

1110
input_data = Input(shape=(19, 19, 17))
1211

12+
1313
def conv_block(x):
1414
y = Conv2D(256, (3, 3), padding='same')(x)
1515
y = BatchNormalization()(y)
1616
y = Activation('relu')(y)
1717
return y
1818

19+
1920
def residual_block(x):
2021
y = Conv2D(256, (3, 3), padding='same')(x)
2122
y = BatchNormalization()(y)
@@ -26,13 +27,15 @@ def residual_block(x):
2627
y = Activation('relu')(y)
2728
return y
2829

30+
2931
def policy_head(x):
3032
y = Conv2D(2, (1, 1), padding='same')(x)
3133
y = BatchNormalization()(y)
3234
y = Activation('relu')(y)
33-
y = Dense(19**2+1, activation='sigmoid')(y)
35+
y = Dense(19 ** 2 + 1, activation='sigmoid')(y)
3436
return y
3537

38+
3639
def value_head(x):
3740
y = Conv2D(1, (1, 1), padding='same')(x)
3841
y = BatchNormalization()(y)
@@ -43,13 +46,14 @@ def value_head(x):
4346
y = Activation('tanh')(y)
4447
return y
4548

49+
4650
# in the paper there were either 39 or 19 residual blocks
4751
def alphago_zero_nn(residual_blocks=39):
4852
x = conv_block(input_data)
4953

5054
for i in range(residual_blocks):
5155
x = residual_block(x)
52-
56+
5357
policy_out = policy_head(x)
5458
value_out = value_head(x)
5559

@@ -60,6 +64,3 @@ def alphago_zero_nn(residual_blocks=39):
6064

6165
model_alphago_zero = alphago_zero_nn()
6266
print(model_alphago_zero.summary())
63-
64-
65-

requirements.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
bleach==1.5.0
2+
enum34==1.1.6
3+
html5lib==0.9999999
4+
Keras==2.0.9
5+
Markdown==2.6.9
6+
numpy==1.13.3
7+
protobuf==3.4.0
8+
PyYAML==3.12
9+
scipy==1.0.0
10+
six==1.11.0
11+
tensorflow==1.4.0
12+
tensorflow-tensorboard==0.4.0rc2
13+
Werkzeug==0.12.2

0 commit comments

Comments
 (0)