def __init__(self, feature_cards, factor_dim, hidden_sizes, dropout_rate=.1, name='fnfm'):
     super(FieldAwareNeuralFactorizationMachine, self).__init__(name=name)
     self.num_features = len(feature_cards)
     self.embeddings = FieldAwareEmbedFeatures(feature_cards, factor_dim,
                                               name=name + '/field_aware_feature_embedding')
     self.linear = LinearModel(feature_cards, name=name + '/linear_model')
     self.nn = FullyConnectedNetwork(units=hidden_sizes, dropout_rate=dropout_rate, name=name + '/fcn')
 def __init__(self, feature_cards, factor_dim, n_heads, n_attentions, hidden_sizes, dropout_rate=.1, name='deepfm'):
     super(AutomaticFeatureInteraction, self).__init__(name=name)
     self.linear = LinearModel(feature_cards, name=name + '/linear_model')
     self.embedding = EmbedFeatures(feature_cards, factor_dim, name=name + '/feature_embedding')
     self.flatten = tf.keras.layers.Flatten(data_format='channels_first')
     self.nn = FullyConnectedNetwork(units=hidden_sizes, dropout_rate=dropout_rate, name=name + '/fcn')
     self.attns = [
         MultiHeadAttention(n_heads, factor_dim, dropout_rate=dropout_rate, name=name + '/mhattn{}'.format(i))
         for i in range(n_attentions)
     ]
     self.attn_out = tf.keras.layers.Dense(1)
 def __init__(self,
              feature_cards,
              factor_dim,
              hidden_sizes,
              dropout_rate=.1,
              name='neural_factorization_machine'):
     super(NeuralFactorizationMachine, self).__init__(name=name)
     self.embedding = EmbedFeatures(feature_cards,
                                    factor_dim,
                                    name=name + '/feature_embedding')
     self.linear = LinearModel(feature_cards, name=name + '/linear_model')
     self.nn = FullyConnectedNetwork(units=hidden_sizes,
                                     dropout_rate=dropout_rate,
                                     name=name + '/fcn')
 def __init__(self,
              feature_cards,
              factor_dim,
              hidden_sizes,
              dropout_rate=.1,
              name='neural_factorization_machine'):
     super(FMNeuralNetwork, self).__init__(name=name)
     self.embedding = EmbedFeatures(feature_cards,
                                    factor_dim,
                                    name=name + '/feature_embedding')
     self.flatten = tf.keras.layers.Flatten(data_format='channels_first')
     self.nn = FullyConnectedNetwork(units=hidden_sizes,
                                     dropout_rate=dropout_rate,
                                     name=name + '/fcn')
Example #5
0
 def __init__(self,
              feature_cards,
              factor_dim,
              hidden_sizes,
              dropout_rate=.1,
              name='deepfm'):
     super(DeepFM, self).__init__(name=name)
     self.linear = LinearModel(feature_cards, name=name + '/linear_model')
     self.embedding = EmbedFeatures(feature_cards,
                                    factor_dim,
                                    name=name + '/feature_embedding')
     self.flatten = tf.keras.layers.Flatten(data_format='channels_first')
     self.nn = FullyConnectedNetwork(units=hidden_sizes,
                                     dropout_rate=dropout_rate,
                                     name=name + '/fcn')
 def __init__(self,
              feature_cards,
              factor_dim,
              fnn_hidden_sizes,
              cin_hidden_sizes,
              dropout_rate=.1,
              split=True,
              name='xdeepfm'):
     super(ExtremeDeepFactorizationMachine, self).__init__(name=name)
     self.linear = LinearModel(feature_cards, name=name + '/linear_model')
     self.embedding = EmbedFeatures(feature_cards,
                                    factor_dim,
                                    name=name + '/feature_embedding')
     self.flatten = tf.keras.layers.Flatten(data_format='channels_first')
     self.nn = FullyConnectedNetwork(units=fnn_hidden_sizes,
                                     dropout_rate=dropout_rate,
                                     name=name + '/fcn')
     self.cin = CompressedInteractionNetwork(cin_hidden_sizes,
                                             split,
                                             name=name + '/cin')