class_docstr: Callback function used to calculate the NDCG@k metric of validation set at the end of each epoch.
  Weights of the model with the highest NDCG@k value is saved.
docstr: Returns the top-k items ordered by a relevancy score.
  Obtained probabilities are used as recommendation score.
  
  Args:
      x (numpy.ndarray, int32): input click matrix.
      k (scalar, int32): the number of items to recommend.
  
  Returns:
      numpy.ndarray: A sparse matrix containing the top_k elements ordered by their score.
code: def recommend_k_items(self, x, k, remove_seen=True):
      """Returns the top-k items ordered by a relevancy score.
      Obtained probabilities are used as recommendation score.
  
      Args:
          x (numpy.ndarray, int32): input click matrix.
          k (scalar, int32): the number of items to recommend.
  
      Returns:
          numpy.ndarray: A sparse matrix containing the top_k elements ordered by their score.
  
      """
      # obtain scores
      score = self.model.predict(x)
  
      if remove_seen:
          # if true, it removes items from the train set by setting them to zero
          seen_mask = np.not_equal(x, 0)
          score[seen_mask] = 0
  
      # get the top k items
      top_items = np.argpartition(-score, range(k), axis=1)[:, :k]
  
      # get a copy of the score matrix
      score_c = score.copy()
  
      # set to zero the k elements
      score_c[np.arange(score_c.shape[0])[:, None], top_items] = 0
  
      # set to zeros all elements other then the k
      top_scores = score - score_c
  
      return top_scores
  
imports: import numpy
  import matplotlib.pyplot
  import seaborn
  import tensorflow
  from tensorflow.keras.layers import *
  from tensorflow.keras.models import Model
  from tensorflow.keras.losses import binary_crossentropy
  from tensorflow.keras import backend
  from tensorflow.keras.callbacks import ReduceLROnPlateau, Callback
  from recommenders.evaluation.python_evaluation import ndcg_at_k
label_desc: Use image node_id 3 for calling the Metrics obj's underlying member method code with example usage: obj.recommend_k_items(x, k, remove_seen) and returns: top_scores