code: def generate_learning_curve_plots(
      experiment_name: str,
      output_dir: PathOrStr,
      learning_curve_tsv_file: PathOrStr,
  ) -> None:
      """
      Generate learning curves using the TSV output file from a learning curve experiment.
  
      This function generates both the score plots as well as the fit time plots.
  
      Parameters
      ----------
      experiment_name : str
          The name of the experiment.
      output_dir : :class:`skll.types.PathOrStr`
          Path to the output directory for the plots.
      learning_curve_tsv_file : :class:`skll.types.PathOrStr`
          The path to the learning curve TSV file.
      """
      # convert output_dir to Path object
      output_dir = Path(output_dir)
  
      # use pandas to read in the TSV file into a data frame
      # and massage it from wide to long format for plotting
      df = pd.read_csv(learning_curve_tsv_file, sep="\t")
      num_learners = len(df["learner_name"].unique())
      num_metrics = len(df["metric"].unique())
  
      # if there are any training sizes greater than 1000,
      # then we should probably rotate the tick labels
      # since otherwise the labels are not clearly rendered
      rotate_labels = df["training_set_size"].unique().max() >= 1000
  
      # get the columns relevant to the two types of plots
      score_columns = [
          column
          for column in df.columns
          if column
          not in [
              "train_set_name",
              "fit_time_mean",
              "fit_time_std",
              "scikit_learn_version",
              "version",
          ]
      ]
      time_columns = [
          column
          for column in df.columns
          if column
          not in [
              "train_set_name",
              "train_score_mean",
              "train_score_std",
              "test_score_mean",
              "test_score_std",
              "scikit_learn_version",
              "version",
          ]
      ]
  
      # create the score-specific data frame
      df_score = df[score_columns].copy()
      df_score_melted = pd.melt(
          df_score,
          id_vars=[
              c
              for c in df_score.columns
              if c not in ["train_score_mean", "test_score_mean"]
          ],
      )
      # make sure the "variable" column is categorical since it will be
      # mapped to hue levels in the learning curve below
      df_score_melted["variable"] = df_score_melted["variable"].astype(
          "category"
      )
  
      # also make sure that the "learner_name" column is categorical so that
      # it's sorted correctly
      df_score_melted["learner_name"] = df_score_melted[
          "learner_name"
      ].astype("category")
  
      # now compute the time-specific data frame
      df_time = df[time_columns].copy()
  
      # note that although we have already averaged the fit times over
      # the various training, we still have multiple fit times for each
      # of the metrics so we can further average those out
      df_time_indexed = df_time.set_index(
          [
              "featureset_name",
              "learner_name",
              "training_set_size",
              "metric",
          ]
      )
      df_time = (
          df_time_indexed.groupby(
              level=[
                  "featureset_name",
                  "learner_name",
                  "training_set_size",
              ]
          )
          .mean()
          .reset_index()
      )
  
      # now let's melt the time data frame the same way that we did the score one
      df_time_melted = pd.melt(
          df_time,
          id_vars=[c for c in df_time.columns if c != "fit_time_mean"],
      )
  
      # also make sure that the "learner_name" column is categorical so that
      # it's sorted correctly
      df_time_melted["learner_name"] = df_time_melted[
          "learner_name"
      ].astype("category")
  
      # call the function to generate the score plots first
      _generate_learning_curve_score_plots(
          df_score_melted,
          num_metrics,
          num_learners,
          experiment_name,
          output_dir,
          rotate_labels=rotate_labels,
      )
  
      # now call the function to generate the time plots
      _generate_learning_curve_time_plots(
          df_time_melted,
          num_learners,
          experiment_name,
          output_dir,
          rotate_labels=rotate_labels,
      )
  
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 4 for calling a global function with example usage: generate_learning_curve_plots(experiment_name, output_dir, learning_curve_tsv_file) without return types