hexiangnan / neural_factorization_machine

TenforFlow Implementation of Neural Factorization Machine
466 stars 186 forks source link

unnecessary addition #9

Open lmxhappy opened 4 years ago

lmxhappy commented 4 years ago

all_weights['feature_bias'] = tf.Variable(tf.random_uniform([self.features_M, 1], 0.0, 0.0), name='feature_bias') # features_M * 1 elements in all_weights['feature_bias'] are all zeros. so in # _________out _________ Bilinear = tf.reduce_sum(self.FM, 1, keep_dims=True) # None * 1 self.Feature_bias = tf.reduce_sum(tf.nn.embedding_lookup(self.weights['feature_bias'], self.train_features) , 1) # None * 1 Bias = self.weights['bias'] * tf.ones_like(self.train_labels) # None * 1 self.out = tf.add_n([Bilinear, self.Feature_bias, Bias]) # None * 1

all of elements in self.Feature_bias are zeros. So, all_weights['feature_bias'] should be initialized from 0 and 1.

ok?