def write_predictions(raw_results_list, out_file):
  """Writing out the predictions to a file."""
  print("writing predictions to " + out_file)
  with tf.io.gfile.GFile(out_file, "w") as writer:
    writer.write("QueryID\tDocId\tModelScore\tLabel\tPriorScore\n")
    for raw_result in raw_results_list:
      writer.write(
          str(raw_result.q_id) + "\t" + str(raw_result.cand_num) + "\t" +
          str(raw_result.prob) + "\t" + str(raw_result.label_id) + "\t" +
          str(raw_result.prior_score) + "\n")
Writing out the predictions to a file.
language/multivec/models/metrics.py