File size: 614 Bytes
7f50cd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
from pathlib import Path
import sys
import numpy as np

sys.path.insert(0, str(Path(os.environ['CORE_DIR']) / 'interface'))
from data import records, matrix, write_predictions
from network import predict_record

root, output = sys.argv[1:]
with np.load(Path(__file__).with_name('model.npz'), allow_pickle=False) as model:
    params = [model['p' + str(i)] for i in range(6)]
    mean, scale = model['mean'], model['scale']
rows = records(root, 'queries.tsv')
labels = [predict_record(matrix(root, row), params, mean, scale) for row in rows]
write_predictions(output, [row['id'] for row in rows], labels)