code: def _setup_ndcg(predicted_ranks, test_interactions, k=10):
      pos_inter = test_interactions > 0
      ror = sp.csr_matrix(predicted_ranks * pos_inter.A)
  
      relevance = sp.csr_matrix(test_interactions.A * pos_inter.A)
  
      k_mask = np.less(ror.data, k + 1)
      ror_at_k = np.maximum(np.multiply(ror.data, k_mask), 1)
  
      return relevance, k_mask, ror, ror_at_k
  
file_path: tensorrec/tensorrec/eval.py
imports: import numpy
  import scipy.sparse
  from .tensorrec import TensorRec
label_desc: Use image node_id 3 for calling a global function with example usage: _setup_ndcg(predicted_ranks, test_interactions, k) and returns: relevance,  k_mask,  ror,  ror_at_k