challenging-america-geo-pre.../mean_from_train/mean_from_train.py

21 lines
457 B
Python
Raw Normal View History

2021-06-09 10:12:51 +02:00
import numpy as np
train_exp_f = open('../train/expected2.tsv')
train_mean = np.mean([float(a.rstrip()) for a in train_exp_f])
train_mean_line = str(train_mean) + '\n'
def pred(in_f_path, out_f_path):
f_in = open(in_f_path, 'r')
f_out = open(out_f_path, 'w')
for l in f_in:
f_out.write(train_mean_line)
f_in.close()
f_out.close()
pred('../dev-0/in.tsv', '../dev-0/out2.tsv')
pred('../test-A/in.tsv', '../test-A/out2.tsv')