code: def main():
      params = ArgumentParser(
          description="Plot data from 'metrics' files written during training."
      )
      params.add_argument(
          "-i",
          "--input",
          required=True,
          nargs="+",
          help="One or more 'metrics' files to plot.",
      )
      params.add_argument(
          "-o",
          "--output",
          required=True,
          help="Output file to write (ex: plot.pdf).",
      )
      params.add_argument(
          "-x", default="time-elapsed", help="X axis metric."
      )
      params.add_argument(
          "-y", default="perplexity-train", help="Y axis metric."
      )
      params.add_argument("-y2", help="Second Y axis metric.")
      params.add_argument(
          "-yi",
          "--y-invert",
          action="store_true",
          help="Invert Y metric (multiply values by -1).",
      )
      params.add_argument(
          "-y2i",
          "--y2-invert",
          action="store_true",
          help="Invert second Y metric (multiply values by -1).",
      )
      params.add_argument(
          "-ya",
          "--y-average",
          type=int,
          help="Average the N best points so far for each Y value.",
      )
      params.add_argument(
          "-ysb",
          "--y-since-best",
          action="store_true",
          help="Use number of points since improvement for each Y value.",
      )
      params.add_argument(
          "-ywi",
          "--y-window-improvement",
          type=int,
          help="Improvement in best over the last N points for each Y value.",
      )
      params.add_argument(
          "-ysl",
          "--y-slope",
          type=int,
          help="Compute current slope for each Y value.",
      )
      params.add_argument(
          "-yli",
          "--y-line",
          type=float,
          help="Draw a horizontal line at specified Y value.",
      )
      params.add_argument(
          "-l",
          "--legend",
          nargs="+",
          help="Labels in legend (one per input file).",
      )
      params.add_argument("-t", "--title", help="Plot title.")
      params.add_argument(
          "-b",
          "--best",
          action="store_true",
          help="Draw horizontal line at best Y value.",
      )
      params.add_argument(
          "-s",
          "--skip",
          type=int,
          nargs="+",
          default=(0,),
          help="Skip the first N points for better readability.  Single value or value per input.",
      )
      params.add_argument(
          "-ev",
          "--every",
          type=int,
          nargs="+",
          default=(1,),
          help="Only plot one point every N points.",
      )
      params.add_argument(
          "-p",
          "--paper",
          action="store_true",
          help="Scale plot elements for inclusion in papers.",
      )
      args = params.parse_args()
      plot_metrics(args)
  
file_path: sockeye/sockeye_contrib/plot_metrics.py
imports: from argparse import ArgumentParser
  from bisect import insort
  from collections import defaultdict
  from os import path
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types