class_docstr: xDeepFM combines a CIN (Compressed Interaction Network) with a classical DNN.
  The model is able to learn certain bounded-degree feature interactions explicitly;
  Besides, it can also learn arbitrary low- and high-order feature interactions implicitly.
class_docstr_tok: ["xDeepFM","combines","a","CIN","(","Compressed","Interaction","Network",")","with","a","classical","DNN",".","The","model","is","able","to","learn","certain","bounded-degree","feature","interactions","explicitly",";","Besides",",","it","can","also","learn","arbitrary","low-","and","high-order","feature","interactions","implicitly","."]
code: def __init__(self, config, dataset):
      super(xDeepFM, self).__init__(config, dataset)
  
      # load parameters info
      self.mlp_hidden_size = config["mlp_hidden_size"]
      self.reg_weight = config["reg_weight"]
      self.dropout_prob = config["dropout_prob"]
      self.direct = config["direct"]
      self.cin_layer_size = temp_cin_size = list(
          config["cin_layer_size"]
      )
  
      # Check whether the size of the CIN layer is legal.
      if not self.direct:
          self.cin_layer_size = list(
              map(lambda x: int(x // 2 * 2), temp_cin_size)
          )
          if self.cin_layer_size[:-1] != temp_cin_size[:-1]:
              self.logger.warning(
                  "Layer size of CIN should be even except for the last layer when direct is True."
                  "It is changed to {}".format(self.cin_layer_size)
              )
  
      # Create a convolutional layer for each CIN layer
      self.conv1d_list = nn.ModuleList()
      self.field_nums = [self.num_feature_field]
      for i, layer_size in enumerate(self.cin_layer_size):
          conv1d = nn.Conv1d(
              self.field_nums[-1] * self.field_nums[0], layer_size, 1
          )
          self.conv1d_list.append(conv1d)
          if self.direct:
              self.field_nums.append(layer_size)
          else:
              self.field_nums.append(layer_size // 2)
  
      # Create MLP layer
      size_list = (
          [self.embedding_size * self.num_feature_field]
          + self.mlp_hidden_size
          + [1]
      )
      self.mlp_layers = MLPLayers(size_list, dropout=self.dropout_prob)
  
      # Get the output size of CIN
      if self.direct:
          self.final_len = sum(self.cin_layer_size)
      else:
          self.final_len = (
              sum(self.cin_layer_size[:-1]) // 2
              + self.cin_layer_size[-1]
          )
  
      self.cin_linear = nn.Linear(self.final_len, 1)
      self.sigmoid = nn.Sigmoid()
      self.loss = nn.BCEWithLogitsLoss()
      self.apply(self._init_weights)
  
file_path: RecBole/recbole/model/context_aware_recommender/xdeepfm.py
imports: import torch
  import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
  from recbole.model.layers import MLPLayers, activation_layer
label_desc: Use image node_id 1 to create a new xDeepFM object from inherited base classes: ContextRecommender with example: obj = xDeepFM(config, dataset)