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 _extract_learning_rate(file_name: Union[str, Path]):
      if isinstance(file_name, str):
          file_name = Path(file_name)
  
      lrs = []
      losses = []
  
      with open(file_name) as f:
          tsvin = csv.reader(f, delimiter="\t")
          row = next(tsvin)
          LEARNING_RATE = row.index("LEARNING_RATE")
          TRAIN_LOSS = row.index("TRAIN_LOSS")
  
          # then get all relevant values from the tsv
          for row in tsvin:
              if row[TRAIN_LOSS] != "_":
                  losses.append(float(row[TRAIN_LOSS]))
              if row[LEARNING_RATE] != "_":
                  lrs.append(float(row[LEARNING_RATE]))
  
      return lrs, losses
  
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 3 for calling the Plotter obj's underlying member method code with example usage: obj._extract_learning_rate(file_name) and returns: lrs,  losses