class_docstr: HGN sets feature gating and instance gating to get the important feature and item for predicting the next item
code: def __init__(self, config, dataset):
      super(HGN, self).__init__(config, dataset)
  
      # load the dataset information
      self.n_user = dataset.num(self.USER_ID)
      self.device = config["device"]
  
      # load the parameter information
      self.embedding_size = config["embedding_size"]
      self.reg_weight = config["reg_weight"]
      self.pool_type = config["pooling_type"]
  
      if self.pool_type not in ["max", "average"]:
          raise NotImplementedError(
              "Make sure 'loss_type' in ['max', 'average']!"
          )
  
      # define the layers and loss function
      self.item_embedding = nn.Embedding(
          self.n_items, self.embedding_size, padding_idx=0
      )
      self.user_embedding = nn.Embedding(
          self.n_user, self.embedding_size
      )
  
      # define the module feature gating need
      self.w1 = nn.Linear(self.embedding_size, self.embedding_size)
      self.w2 = nn.Linear(self.embedding_size, self.embedding_size)
      self.b = nn.Parameter(
          torch.zeros(self.embedding_size), requires_grad=True
      )
  
      # define the module instance gating need
      self.w3 = nn.Linear(self.embedding_size, 1, bias=False)
      self.w4 = nn.Linear(
          self.embedding_size, self.max_seq_length, bias=False
      )
  
      # define item_embedding for prediction
      self.item_embedding_for_prediction = nn.Embedding(
          self.n_items, self.embedding_size
      )
  
      self.sigmoid = nn.Sigmoid()
  
      self.loss_type = config["loss_type"]
      if self.loss_type == "BPR":
          self.loss_fct = BPRLoss()
      elif self.loss_type == "CE":
          self.loss_fct = nn.CrossEntropyLoss()
      else:
          raise NotImplementedError(
              "Make sure 'loss_type' in ['BPR', 'CE']!"
          )
  
      # init the parameters of the model
      self.apply(self._init_weights)
  
file_path: RecBole/recbole/model/sequential_recommender/hgn.py
imports: import torch
  import torch.nn
  from torch.nn.init import xavier_uniform_, constant_, normal_
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 1 to create a new HGN object from inherited base classes: SequentialRecommender with example: obj = HGN(config, dataset)