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_weights(self, file_name: Union[str, Path]):
      file_name = Path(file_name)
  
      weights = self._extract_weight_data(file_name)
  
      total = len(weights)
      columns = 2
      rows = max(2, int(math.ceil(total / columns)))
  
      figsize = (4 * columns, 3 * rows)
  
      fig = plt.figure()
      f, axarr = plt.subplots(rows, columns, figsize=figsize)
  
      c = 0
      r = 0
      for name, values in weights.items():
          # plot i
          axarr[r, c].set_title(name, fontsize=6)
          for _, v in values.items():
              axarr[r, c].plot(np.arange(0, len(v)), v, linewidth=0.35)
          axarr[r, c].set_yticks([])
          axarr[r, c].set_xticks([])
          c += 1
          if c == columns:
              c = 0
              r += 1
  
      while r != rows and c != columns:
          axarr[r, c].set_yticks([])
          axarr[r, c].set_xticks([])
          c += 1
          if c == columns:
              c = 0
              r += 1
  
      # save plots
      f.subplots_adjust(hspace=0.5)
      plt.tight_layout(pad=1.0)
      path = file_name.parent / "weights.png"
      plt.savefig(path, dpi=300)
      log.info(
          f"Weights plots are saved in {path}"
      )  # to let user know the path of the save plots
      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 4 for calling the Plotter obj's underlying member method code with example usage: obj.plot_weights(file_name) without return types