code: def catalog_coverage(
      predicted: List[list], catalog: list, k: int
  ) -> float:
      """
      Computes the catalog coverage for k lists of recommendations
      Parameters
      ----------
      predicted : a list of lists
          Ordered predictions
          example: [['X', 'Y', 'Z'], ['X', 'Y', 'Z']]
      catalog: list
          A list of all unique items in the training data
          example: ['A', 'B', 'C', 'X', 'Y', Z]
      k: integer
          The number of observed recommendation lists
          which randomly choosed in our offline setup
      Returns
      ----------
      catalog_coverage:
          The catalog coverage of the recommendations as a percent
          rounded to 2 decimal places
      ----------
      Metric Defintion:
      Ge, M., Delgado-Battenfeld, C., & Jannach, D. (2010, September).
      Beyond accuracy: evaluating recommender systems by coverage and serendipity.
      In Proceedings of the fourth ACM conference on Recommender systems (pp. 257-260). ACM.
      """
      sampling = random.choices(predicted, k=k)
      predicted_flattened = [p for sublist in sampling for p in sublist]
      L_predictions = len(set(predicted_flattened))
      catalog_coverage = round(
          L_predictions / (len(catalog) * 1.0) * 100, 2
      )
      return catalog_coverage
  
imports: import random
  from itertools import product
  from math import sqrt
  from typing import List
  import matplotlib.pyplot
  import numpy
  import pandas
  import scipy.sparse
  from sklearn.metrics import confusion_matrix, mean_squared_error
  from sklearn.metrics.pairwise import cosine_similarity
  import warnings
label_desc: Use image node_id 3 for calling a global function with example usage: catalog_coverage(predicted, catalog, k) and returns: catalog_coverage