class_docstr: FFM is a context-based recommendation model. It aims to model the different feature interactions
  between different fields. Each feature has several latent vectors :math:`v_{i,F(j)}`,
  which depend on the field of other features, and one of them is used to do the inner product.
  
  The model defines as follows:
  
  .. math::
     y = w_0 + \sum_{i=1}^{m}x_{i}w_{i} + \sum_{i=1}^{m}\sum_{j=i+1}^{m}x_{i}x_{j}<v_{i,F(j)}, v_{j,F(i)}>
code: def __init__(self, config, dataset):
      super(FFM, self).__init__(config, dataset)
  
      # load parameters info
      self.fields = config[
          "fields"
      ]  # a dict; key: field_id; value: feature_list
  
      self.sigmoid = nn.Sigmoid()
  
      self.feature2id = {}
      self.feature2field = {}
  
      self.feature_names = (
          self.token_field_names,
          self.float_field_names,
          self.token_seq_field_names,
          self.float_seq_field_names,
      )
      self.feature_dims = (
          self.token_field_dims,
          self.float_field_dims,
          self.token_seq_field_dims,
          self.float_seq_field_dims,
      )
      self._get_feature2field()
      self.num_fields = len(
          set(self.feature2field.values())
      )  # the number of fields
  
      self.ffm = FieldAwareFactorizationMachine(
          self.feature_names,
          self.feature_dims,
          self.feature2id,
          self.feature2field,
          self.num_fields,
          self.embedding_size,
          self.device,
      )
      self.loss = nn.BCEWithLogitsLoss()
  
      # parameters initialization
      self.apply(self._init_weights)
  
imports: import numpy
  import torch
  import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
label_desc: Use image node_id 1 to create a new FFM object from inherited base classes: ContextRecommender with example: obj = FFM(config, dataset)