code: def _write_learning_curve_file(
      result_json_paths: List[str], output_file: IO[str]
  ) -> None:
      """
      Combine individual learning curve results JSON files into single TSV.
  
      Take a list of paths to individual learning curve results json files and
      write out a single TSV file with the learning curve data.
  
      Parameters
      ----------
      result_json_paths : List[str]
          list of paths to the individual result JSON files.
      output_file : IO[str]
          The file buffer to write to.
      """
      learner_result_dicts = []
  
      # Map from feature set names to all features in them
      logger = get_skll_logger("experiment")
      for json_path_str in result_json_paths:
          json_path = Path(json_path_str)
          if not json_path.exists():
              logger.error(
                  f"JSON results file {json_path} not found. Skipping "
                  "summary creation. You can manually create the "
                  "summary file after the fact by using the "
                  "summarize_results script."
              )
              return
          else:
              with open(json_path) as json_file:
                  obj = json.load(json_file)
                  learner_result_dicts.extend(obj)
  
      # Build and write header
      header = [
          "featureset_name",
          "learner_name",
          "metric",
          "train_set_name",
          "training_set_size",
          "train_score_mean",
          "test_score_mean",
          "fit_time_mean",
          "train_score_std",
          "test_score_std",
          "fit_time_std",
          "scikit_learn_version",
          "version",
      ]
      writer = csv.DictWriter(
          output_file,
          header,
          extrasaction="ignore",
          dialect=csv.excel_tab,
      )
      writer.writeheader()
  
      # write out the fields we need for the learning curve file
      # specifically, we need to separate out the curve sizes
      # and scores into individual entries.
      for lrd in learner_result_dicts:
          training_set_sizes = lrd["computed_curve_train_sizes"]
          train_scores_means_by_size = lrd[
              "learning_curve_train_scores_means"
          ]
          test_scores_means_by_size = lrd[
              "learning_curve_test_scores_means"
          ]
          fit_times_means_by_size = lrd[
              "learning_curve_fit_times_means"
          ]
          train_scores_stds_by_size = lrd[
              "learning_curve_train_scores_stds"
          ]
          test_scores_stds_by_size = lrd[
              "learning_curve_test_scores_stds"
          ]
          fit_times_stds_by_size = lrd["learning_curve_fit_times_stds"]
  
          # rename `grid_objective` to `metric` since the latter name can be confusing
          lrd["metric"] = lrd["grid_objective"]
  
          for (
              size,
              train_score_mean,
              test_score_mean,
              fit_time_mean,
              train_score_std,
              test_score_std,
              fit_time_std,
          ) in zip(
              training_set_sizes,
              train_scores_means_by_size,
              test_scores_means_by_size,
              fit_times_means_by_size,
              train_scores_stds_by_size,
              test_scores_stds_by_size,
              fit_times_stds_by_size,
          ):
              lrd["training_set_size"] = size
              lrd["train_score_mean"] = train_score_mean
              lrd["test_score_mean"] = test_score_mean
              lrd["fit_time_mean"] = fit_time_mean
              lrd["train_score_std"] = train_score_std
              lrd["test_score_std"] = test_score_std
              lrd["fit_time_std"] = fit_time_std
  
              writer.writerow(lrd)
  
      output_file.flush()
  
imports: from __future__ import annotations
  import csv
  import json
  import math
  import sys
  from collections import defaultdict
  from pathlib import Path
  from typing import IO, Any, Dict, List, Tuple
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import pandas
  import seaborn
  from ruamel.yaml import YAML
  from skll.types import FoldMapping, PathOrStr
  from skll.utils.logging import get_skll_logger
label_desc: Use image node_id 6 for calling a global function with example usage: _write_learning_curve_file(result_json_paths, output_file) without return types