-
Notifications
You must be signed in to change notification settings - Fork 1
/
eval.py
41 lines (26 loc) · 951 Bytes
/
eval.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
import os
import argparse
import tensorflow as tf
from build_dataset import load_data
def evaluate(args):
"""
Evaluate the model
"""
_, _, X_test, y_test = load_data(args.datapath)
model = tf.keras.models.load_model(args.model)
model.evaluate(X_test, y_test, verbose=1)
test_predictions = model.predict(X_test).flatten()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--model',
type=str,
default='./trained_models/model/',
help="Saved model location")
parser.add_argument('--datapath',
type=str,
default='./data/',
help='Path to directory containing test and training data')
args = parser.parse_args()
assert(os.path.exists(args.datapath))
assert(os.path.exists(args.model))
evaluate(args)