Open codefish1990 opened 3 years ago
another question: in ./ESAM/models/item_ranking/NeuMF_cikm_p.py,the function
def build_network_my(self, num_factor=10, num_factor_mlp=64, hidden_dimension=10, num_neg_sample=30): ... self.pair_loss=0 self.resort_item=[] self.resort_label=[] for i in range(0,self.batch_size): temp1=[] temp2=[]
temp1.append(item_feature[i*self.batch_size:(i+1)*self.batch_size,:])
temp2.append(self.y[i*self.batch_size:(i+1)*self.batch_size])
self.resort_item.append(temp1)
self.resort_label.append(temp2)
discriminative_loss=[]
for i in range(0,self.batch_size):
discriminative_loss.append(get_center_loss(tf.reshape(self.resort_item[i],(-1,128)),tf.reshape(self.resort_label[i],(-1,1)),2))
for i in range(0,self.batch_size):
self.pair_loss=self.pair_loss+discriminative_loss[i]/self.batch_size
...
why need "for i in range(0,self.batch_size)" ?
in ./ESAM/test/center_loss.py,the function def get_center_loss(features, labels, num_classes): ... return (loss_0 + loss_1)/(210+22)
why divide by (210+22) ? why is (210+22)?