code: def generate_speed_graph(
      data,
      filename="als_speed.png",
      labels=None,
      colours=None,
  ):
      labels = labels or {}
      colours = colours or {}
  
      seaborn.set()
      _, ax = plt.subplots()
  
      factors = data["factors"]
      for key in data.keys():
          ax.plot(
              factors,
              data[key],
              color=colours.get(key, COLOURS.get(key)),
              marker="o",
              markersize=6,
          )
  
          ax.text(
              factors[-1] + 5,
              data[key][-1],
              labels.get(key, LABELS[key]),
              fontsize=10,
          )
  
      ax.set_ylabel("Seconds per Iteration")
      ax.set_xlabel("Factors")
      plt.savefig(filename, bbox_inches="tight", dpi=300)
  
file_path: implicit/benchmarks/benchmark_als.py
imports: import argparse
  import json
  import logging
  from collections import defaultdict
  import matplotlib.pyplot
  import scipy.io
  import seaborn
  from implicit.als import AlternatingLeastSquares
  from implicit.gpu import HAS_CUDA
  from implicit.nearest_neighbours import bm25_weight
label_desc: Use image node_id 3 for calling a global function with example usage: generate_speed_graph(data, filename, labels, colours) without return types