code: def save_scores_to_file(
      intermediate_scores, intermediate_best_scores, out_file
  ):
      """
      Save statistics of every trial to a log file for generating reports.
      """
      with open(out_file, "w") as f:
          f.write("ntrials,trial_score,best_score\n")
          for i, (trial_score, best_score) in enumerate(
              zip(intermediate_scores, intermediate_best_scores)
          ):
              f.write(
                  "{},{},{}\n".format(i + 1, trial_score, best_score)
              )
  
file_path: nni/examples/trials/benchmarking/automlbenchmark/nni/extensions/NNI/exec.py
imports: import logging
  from .tuners import NNITuner
  from .run_experiment import *
  from amlb.benchmark import TaskConfig
  from amlb.data import Dataset
  from amlb.results import save_predictions_to_file
  from amlb.utils import Timer
label_desc: Use image node_id 2 for calling a global function with example usage: save_scores_to_file(intermediate_scores, intermediate_best_scores, out_file) without return types