-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgridsearch.py
39 lines (37 loc) · 1.3 KB
/
gridsearch.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
import subprocess
import numpy as np
settings = []
for p_io in [0.5,0.45,0.4,0.35,0.3,0.25,0.2]:
# for p_io in [0.4,0.35,0.3,0.25,0.2]:
for p_s in [0.5,0.45,0.4,0.35,0.3,0.25,0.2]:
# for p_s in [0.4,0.35,0.3,0.25,0.2]:
#for p_e in [0.5,0.45,0.4,0.35,0.3,0.25,0.2]:
for p_e in [0.4,0.35,0.3,0.25,0.2,0.15,0.1,0.5,0.0]:
for embed_size in [100]:
for state_size in [embed_size, embed_size/2]:
for n_layers in [2]:
settings.append([
'python',
'tf_classify.py',
'embed_trainable', str(True),
# '--embed_path', 'data/twitter_davidson/embeddings.word2vec.{}d.dat',
# '--embed_path', 'random',
# '--vocab_path', 'data/twitter_davidson/vocab.stemmed.dat',
'--input_dropout', str(p_io),
'--output_dropout', str(p_io),
'--state_dropout', str(p_s),
'--embedding_dropout', str(p_e),
'--embedding_size', str(embed_size),
'--state_size', str(state_size),
'--num_layers', str(n_layers),
'--max_gradient_norm', str(10.0),
'--epochs', str(30),
'--log_dir', 'randsearch_E',
'--scoring', 'f1_macro',
'--output_size', '3'
# '--model_type', 'hb_append'
])
tryset = np.random.choice(len(settings), 100, replace=False)
for i in tryset:
print settings[i]
subprocess.call(settings[i])