code: def mapk(
      actual: List[list], predicted: List[list], k: int = 10
  ) -> float:
      """
      Computes the mean average precision at k.
      Parameters
      ----------
      actual : a list of lists
          Actual items to be predicted
          example: [['A', 'B', 'X'], ['A', 'B', 'Y']]
      predicted : a list of lists
          Ordered predictions
          example: [['X', 'Y', 'Z'], ['X', 'Y', 'Z']]
      Returns:
      -------
          mark: float
              The mean average precision at k (map@k)
      """
      if len(actual) != len(predicted):
          raise AssertionError("Length mismatched")
  
      return np.mean([_apk(a, p, k) for a, p in zip(actual, predicted)])
  
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 7 for calling a global function with example usage: mapk(actual, predicted, k) and returns: np