class_docstr: Plots training parameters (loss, f-score, and accuracy) and training weights over time.
  
  Input files are the output files 'loss.tsv' and 'weights.txt' from
  training either a sequence tagger or text classification model.
class_docstr_tok: ["Plots","training","parameters","(","loss",",","f-score",",","and","accuracy",")","and","training","weights","over","time",".","Input","files","are","the","output","files","'loss.tsv","'","and","'weights.txt","'","from","training","either","a","sequence","tagger","or","text","classification","model","."]
code: def plot_training_curves(
      self,
      file_name: Union[str, Path],
      plot_values: List[str] = ["loss", "F1"],
  ):
      file_name = Path(file_name)
  
      fig = plt.figure(figsize=(15, 10))
  
      for plot_no, plot_value in enumerate(plot_values):
          training_curves = self._extract_evaluation_data(
              file_name, plot_value
          )
  
          plt.subplot(len(plot_values), 1, plot_no + 1)
          if training_curves["train"]["score"]:
              x = np.arange(0, len(training_curves["train"]["score"]))
              plt.plot(
                  x,
                  training_curves["train"]["score"],
                  label=f"training {plot_value}",
              )
          if training_curves["dev"]["score"]:
              x = np.arange(0, len(training_curves["dev"]["score"]))
              plt.plot(
                  x,
                  training_curves["dev"]["score"],
                  label=f"validation {plot_value}",
              )
          if training_curves["test"]["score"]:
              x = np.arange(0, len(training_curves["test"]["score"]))
              plt.plot(
                  x,
                  training_curves["test"]["score"],
                  label=f"test {plot_value}",
              )
          plt.legend(
              bbox_to_anchor=(1.04, 0),
              loc="lower left",
              borderaxespad=0,
          )
          plt.ylabel(plot_value)
          plt.xlabel("epochs")
  
      # save plots
      plt.tight_layout(pad=1.0)
      path = file_name.parent / "training.png"
      plt.savefig(path, dpi=300)
      log.info(
          f"Loss and F1 plots are saved in {path}"
      )  # to let user know the path of the save plots
      plt.show(
          block=False
      )  # to have the plots displayed when user run this module
      plt.close(fig)
  
file_path: flair/flair/visual/training_curves.py
imports: import csv
  import logging
  import math
  from collections import defaultdict
  from pathlib import Path
  from typing import Dict, List, Union
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 5 for calling the Plotter obj's underlying member method code with example usage: obj.plot_training_curves(file_name, plot_values) without return types