class_docstr: SimpleX is a simple, unified collaborative filtering model.
  
  SimpleX presents a simple and easy-to-understand model. Its advantage lies
  in its loss function, which uses a larger number of negative samples and
  sets a threshold to filter out less informative samples, it also uses
  relative weights to control the balance of positive-sample loss
  and negative-sample loss.
  
  We implement the model following the original author with a pairwise training mode.
code: def __init__(self, config, dataset):
      super(SimpleX, self).__init__(config, dataset)
  
      # Get user history interacted items
      (
          self.history_item_id,
          _,
          self.history_item_len,
      ) = dataset.history_item_matrix(
          max_history_len=config["history_len"]
      )
      self.history_item_id = self.history_item_id.to(self.device)
      self.history_item_len = self.history_item_len.to(self.device)
  
      # load parameters info
      self.embedding_size = config["embedding_size"]
      self.margin = config["margin"]
      self.negative_weight = config["negative_weight"]
      self.gamma = config["gamma"]
      self.neg_seq_len = config["train_neg_sample_args"]["sample_num"]
      self.reg_weight = config["reg_weight"]
      self.aggregator = config["aggregator"]
      if self.aggregator not in [
          "mean",
          "user_attention",
          "self_attention",
      ]:
          raise ValueError(
              "aggregator must be mean, user_attention or self_attention"
          )
      self.history_len = torch.max(self.history_item_len, dim=0)
  
      # user embedding matrix
      self.user_emb = nn.Embedding(self.n_users, self.embedding_size)
      # item embedding matrix
      self.item_emb = nn.Embedding(
          self.n_items, self.embedding_size, padding_idx=0
      )
      # feature space mapping matrix of user and item
      self.UI_map = nn.Linear(
          self.embedding_size, self.embedding_size, bias=False
      )
      if self.aggregator in ["user_attention", "self_attention"]:
          self.W_k = nn.Sequential(
              nn.Linear(self.embedding_size, self.embedding_size),
              nn.Tanh(),
          )
          if self.aggregator == "self_attention":
              self.W_q = nn.Linear(self.embedding_size, 1, bias=False)
      # dropout
      self.dropout = nn.Dropout(0.1)
      self.require_pow = config["require_pow"]
      # l2 regularization loss
      self.reg_loss = EmbLoss()
  
      # parameters initialization
      self.apply(xavier_normal_initialization)
      # get the mask
      self.item_emb.weight.data[0, :] = 0
  
file_path: RecBole/recbole/model/general_recommender/simplex.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.abstract_recommender import GeneralRecommender
  from recbole.model.loss import EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 1 to create a new SimpleX object from inherited base classes: GeneralRecommender with example: obj = SimpleX(config, dataset)