code: def points_since_improvement(points, cmp):
      num_not_improved = []
      best = None
      since_improvement = 0
      for point in points:
          if (
              best is None
              or (cmp is min and point < best)
              or (cmp is max and point > best)
          ):
              best = point
              since_improvement = 0
          num_not_improved.append(since_improvement)
          since_improvement += 1
      return num_not_improved
  
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 4 for calling a global function with example usage: points_since_improvement(points, cmp) and returns: num_not_improved