code: def window_improvement(points, num_points, cmp):
      window_improvement_at_point = []
      best_at_point = []
      for point in points:
          if not best_at_point:
              best_at_point.append(point)
          elif (cmp is min and point < best_at_point[-1]) or (
              cmp is max and point > best_at_point[-1]
          ):
              best_at_point.append(point)
          else:
              best_at_point.append(best_at_point[-1])
          if len(best_at_point) > num_points:
              best_at_point = best_at_point[-num_points:]
          window_improvement_at_point.append(
              abs(best_at_point[-1] - best_at_point[0])
          )
      return window_improvement_at_point
  
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 5 for calling a global function with example usage: window_improvement(points, num_points, cmp) and returns: window_improvement_at_point