-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
30 lines (23 loc) · 961 Bytes
/
model.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
import tensorflow as tf
BATCH_SIZE = 10
def create_model_for_training():
model = tf.keras.models.Sequential([
# The input layer expects an array of shape (batch_size, 10).
tf.keras.layers.Dense(units=64, input_shape=(None, 10), name='input_layer'),
tf.keras.layers.Activation('relu'),
# The first hidden layer has 64 units.
tf.keras.layers.Dense(units=64, name='hidden_layer1'),
tf.keras.layers.Activation('relu'),
# The second hidden layer has 64 units.
tf.keras.layers.Dense(units=64, name='hidden_layer2'),
tf.keras.layers.Activation('relu'),
# The output layer has 35 units.
tf.keras.layers.Dense(units=36, name='output_layer'),
])
model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])
return model
def load_model(model_fp):
model = tf.keras.models.load_model(model_fp)
return model
def get_batch_size():
return BATCH_SIZE