def write_results_to_file(species, ids, probs):
print(probs.shape)
# Make a path for our results to be saved to
if not os.path.exists('results'):
os.makedirs('results')
print('Writing results to file')
with open('results/results.csv', 'w') as f1:
writer = csv.writer(f1, delimiter=' ', escapechar=' ', quoting=csv.QUOTE_NONE)
header = 'id,' + ','.join(species)
writer.writerow([header])
for i in range(ids.shape[0]):
row = probs[i]
row = convert_list_of_ints_to_string(row)
row = '{}'.format(str(int(ids[i]))) + row
writer.writerow([row])
print('Successfully wrote results to file')
评论列表
文章目录