code: def generate_loss_graph(data, filename="als_loss.png"):
      seaborn.set()
  
      _, ax = plt.subplots()
  
      iterations = range(1, len(data["cholesky"]) + 1)
      for key in data.keys():
          ax.plot(
              iterations,
              data[key],
              color=COLOURS[key],
              marker="o",
              markersize=6,
          )
          ax.text(
              iterations[-1] + 1,
              data[key][-1],
              LABELS[key],
              fontsize=10,
          )
  
      ax.set_ylabel("Mean Squared Error")
      ax.set_xlabel("Iteration")
      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 4 for calling a global function with example usage: generate_loss_graph(data, filename) without return types