class_docstr: Global Personalized Top Frequent Items.
  
  Parameters
  ----------
  name: string, default: 'GPTop'
      The name of the recommender model.
  
  use_global_popularity: boolean, optional, default: True
      When False, no item frequency from all users' baskets are being used.
  
  use_personalized_popularity: boolean, optional, default: True
      When False, no item frequency from history baskets are being used.
  
  use_quantity: boolean, optional, default: False
      When True, constructing item frequency based on its quantity (getting from extra_data).
      The data must be in fmt 'UBITJson'.
  
  References
  ----------
  Ming Li, Sami Jullien, Mozhdeh Ariannezhad, and Maarten de Rijke. 2023.
  A Next Basket Recommendation Reality Check.
  ACM Trans. Inf. Syst. 41, 4, Article 116 (October 2023), 29 pages. https://doi.org/10.1145/3587153
code: def score(self, user_idx, history_baskets, **kwargs):
      item_scores = np.zeros(self.total_items, dtype=np.float32)
      if self.use_global_popularity:
          max_item_freq = (
              max(self.item_freq.values())
              if len(self.item_freq) > 0
              else 1
          )
          for iid, freq in self.item_freq.items():
              item_scores[iid] = freq / max_item_freq
  
      if self.use_personalized_popularity:
          if self.use_quantity:
              history_bids = kwargs.get("history_bids")
              baskets = kwargs.get("baskets")
              p_item_freq = Counter()
              extra_data = kwargs.get("extra_data")
              for bid, iids in zip(history_bids, history_baskets):
                  for idx, iid in zip(baskets[bid], iids):
                      p_item_freq[iid] += extra_data[idx].get(
                          "quantity", 0
                      )
          else:
              p_item_freq = Counter(
                  [iid for iids in history_baskets for iid in iids]
              )
          for iid, cnt in p_item_freq.most_common():
              item_scores[iid] += cnt
      return item_scores
  
file_path: cornac/cornac/models/gp_top/recom_gp_top.py
imports: import numpy
  from collections import Counter
  from ..recommender import NextBasketRecommender
label_desc: Use image node_id 3 for calling the GPTop obj's underlying member method code with example usage: obj.score(user_idx, history_baskets) and returns: item_scores