-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.py
More file actions
35 lines (33 loc) · 790 Bytes
/
train.py
File metadata and controls
35 lines (33 loc) · 790 Bytes
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
from keras.layers import Dense, Conv2D, MaxPool2D
from keras.models import Sequential
from keras.activations import relu, tanh, sigmoid
layers = [
{
"name": "input",
"size": 10,
},
{
"name": "nn",
"size": 100,
"activation": "relu"
},
{
"name": "nn",
"size": 10,
"activation": "softmax"
}
]
info = {
"optimizer": "adam"
}
model = Sequential()
layer_num = 0
for layer in layers:
name = layer["name"]
if name == "input":
input_dim = layer["size"]
if name == "nn":
if layer_num == 1:
model.add(Dense(layer["size"], activation=layer["activation"], input_dim=input_dim))
model.add(Dense(layer["size"], activation=layer["activation"]))
layer_num += 1