class_docstr: SAS Rec model
  Self-Attentive Sequential Recommendation Using Transformer
  
  :Citation:
  
      Wang-Cheng Kang, Julian McAuley (2018), Self-Attentive Sequential
      Recommendation. Proceedings of IEEE International Conference on
      Data Mining (ICDM'18)
  
      Original source code from nnkkmto/SASRec-tf2,
      https://github.com/nnkkmto/SASRec-tf2
docstr: Evaluation on the validation users
docstr_tok: ["Evaluation","on","the","validation","users"]
code: def evaluate_valid(self, dataset):
      """
      Evaluation on the validation users
      """
      usernum = dataset.usernum
      itemnum = dataset.itemnum
      train = dataset.user_train  # removing deepcopy
      valid = dataset.user_valid
  
      NDCG = 0.0
      valid_user = 0.0
      HT = 0.0
      if usernum > 10000:
          users = random.sample(range(1, usernum + 1), 10000)
      else:
          users = range(1, usernum + 1)
  
      for u in tqdm(users, ncols=70, leave=False, unit="b"):
          if len(train[u]) < 1 or len(valid[u]) < 1:
              continue
  
          seq = np.zeros([self.seq_max_len], dtype=np.int32)
          idx = self.seq_max_len - 1
          for i in reversed(train[u]):
              seq[idx] = i
              idx -= 1
              if idx == -1:
                  break
  
          rated = set(train[u])
          rated.add(0)
          item_idx = [valid[u][0]]
          for _ in range(self.num_neg_test):
              t = np.random.randint(1, itemnum + 1)
              while t in rated:
                  t = np.random.randint(1, itemnum + 1)
              item_idx.append(t)
  
          inputs = {}
          inputs["user"] = np.expand_dims(np.array([u]), axis=-1)
          inputs["input_seq"] = np.array([seq])
          inputs["candidate"] = np.array([item_idx])
  
          # predictions = -model.predict(sess, [u], [seq], item_idx)
          predictions = -1.0 * self.predict(inputs)
          predictions = np.array(predictions)
          predictions = predictions[0]
  
          rank = predictions.argsort().argsort()[0]
  
          valid_user += 1
  
          if rank < 10:
              NDCG += 1 / np.log2(rank + 2)
              HT += 1
  
      return NDCG / valid_user, HT / valid_user
  
imports: import random
  import numpy
  from tqdm import tqdm
  import tensorflow
  from recommenders.utils.timer import Timer
label_desc: Use image node_id 9 for calling the SASREC obj's underlying member method code with example usage: obj.evaluate_valid(dataset) and returns: unknown,  unknown