-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_bash.py
49 lines (44 loc) · 1.66 KB
/
create_bash.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
41
42
43
44
45
46
47
48
49
import numpy as np
def get_sample(size, low, high, discrete=False):
if discrete:
return np.random.randint(low, high + 1, size)
else:
return np.random.uniform(low, high, size)
num_experiments = 5
# word_emb = get_sample(num_experiments,)
# word_emb = np.random.choice([100, 200, 300], size=num_experiments)
word_emb = np.random.choice([100], size=num_experiments)
emb_type = np.random.choice(['glove', 'sskip'], size=num_experiments)
use_unk = np.random.choice([True, False], size=num_experiments)
use_lemma = np.random.choice([True, False], size=num_experiments)
learning_rate = get_sample(num_experiments, low=-3.04, high=-3) #from 0.0001 to 0.002
clip = get_sample(num_experiments, low=15, high=40, discrete=True)
prefix = 'python3.5 ./trainer.py --train-corpus ${TRAIN_ORACLE} --save-to ${SAVE_TO} --dev-corpus ${DEV_ORACLE} --emb-path ${WORD_EMBEM} --test-corpus ${TEST_ORACLE} --new-corpus --cuda '
for i in range(num_experiments):
suffix = ('--emb-type {} --learning-rate {} --clip {} --word-embedding-size {}'.format(
emb_type[i],
10**learning_rate[i],
clip[i],
word_emb[i],
i
))
if use_lemma[i]:
suffix += ' --lemma'
if use_unk[i]:
suffix += ' --use-unk'
hper = 'unk={};new={};emb_type={};lemma={};lr={:.4f};word={};clip={}'.format(
# small_corpus,
use_unk[i],
True,
emb_type[i],
use_lemma[i],
10**learning_rate[i],
word_emb[i],
# pos_embedding_size,
# action_embedding_size,
# dropout,
# hidden_size,
clip[i],
)
suffix += ' > "./logs/' + hper + '"'
print (prefix + suffix + ' &')