-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-ci.py
50 lines (37 loc) · 1.45 KB
/
test-ci.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
50
def test_distribute():
'''Test distributing a Talos experiment'''
from numpy import loadtxt
from jako import DistributedScan
url = 'https://raw.githubusercontent.com/'
url += 'jbrownlee/Datasets/master/pima-indians-diabetes.data.csv'
dataset = loadtxt(url, delimiter=',')
x = dataset[:, 0:8]
y = dataset[:, 8]
def diabetes(x_train, y_train, x_val, y_val, params):
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
model = Sequential()
model.add(Dense(params['first_neuron'],
input_dim=8,
activation=params['activation']))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
out = model.fit(x=x,
y=y,
validation_data=[x_val, y_val],
epochs=4,
batch_size=params['batch_size'],
verbose=0)
return out, model
p = {'first_neuron': [12, 24, 48],
'activation': ['relu', 'elu'],
'batch_size': [10, 20, 40]}
DistributedScan(x=x,
y=y,
params=p,
model=diabetes,
experiment_name='diabetes_test',
config='config.json')
test_distribute()