class_docstr: DeepFM is a DNN enhanced FM which both use a DNN and a FM to calculate feature interaction.
  Also DeepFM can be seen as a combination of FNN and FM.
class_docstr_tok: ["DeepFM","is","a","DNN","enhanced","FM","which","both","use","a","DNN","and","a","FM","to","calculate","feature","interaction",".","Also","DeepFM","can","be","seen","as","a","combination","of","FNN","and","FM","."]
code: def __init__(self, config, dataset):
      super(DeepFM, self).__init__(config, dataset)
  
      # load parameters info
      self.mlp_hidden_size = config["mlp_hidden_size"]
      self.dropout_prob = config["dropout_prob"]
  
      # define layers and loss
      self.fm = BaseFactorizationMachine(reduce_sum=True)
      size_list = [
          self.embedding_size * self.num_feature_field
      ] + self.mlp_hidden_size
      self.mlp_layers = MLPLayers(size_list, self.dropout_prob)
      self.deep_predict_layer = nn.Linear(
          self.mlp_hidden_size[-1], 1
      )  # Linear product to the final score
      self.sigmoid = nn.Sigmoid()
      self.loss = nn.BCEWithLogitsLoss()
  
      # parameters initialization
      self.apply(self._init_weights)
  
file_path: RecBole/recbole/model/context_aware_recommender/deepfm.py
imports: import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
  from recbole.model.layers import BaseFactorizationMachine, MLPLayers
label_desc: Use image node_id 1 to create a new DeepFM object from inherited base classes: ContextRecommender with example: obj = DeepFM(config, dataset)