code: def _ark(actual: list, predicted: list, k=10) -> float:
      """
      Computes the average recall at k.
      Parameters
      ----------
      actual : list
          A list of actual items to be predicted
      predicted : list
          An ordered list of predicted items
      k : int, default = 10
          Number of predictions to consider
      Returns:
      -------
      score : float
          The average recall at k.
      """
      if len(predicted) > k:
          predicted = predicted[:k]
  
      score = 0.0
      num_hits = 0.0
  
      for i, p in enumerate(predicted):
          if p in actual and p not in predicted[:i]:
              num_hits += 1.0
              score += num_hits / (i + 1.0)
  
      if not actual:
          return 0.0
  
      return score / len(actual)
  
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 4 for calling a global function with example usage: _ark(actual, predicted, k) and returns: unknown, int