CR-Gjx / LeakGAN

The codes of paper "Long Text Generation via Adversarial Training with Leaked Information" on AAAI 2018. Text generation using GAN and Hierarchical Reinforcement Learning.
https://arxiv.org/abs/1709.08624
576 stars 180 forks source link

why the code execution of cosin similarity in the optimization of manger and worker is 1 - cos(dis_feat, goal)? #9

Closed qingchenwuhou closed 6 years ago

qingchenwuhou commented 6 years ago

Hi, jiaxian: Thanks for your great work. I have a question that why the code execution of cosin similarity in the optimization of manger and worker is 1 - cos(dis_feat, goal) rather than cos(dis_feat, goal). For example: 280 self.Worker_Reward = 1 - tf.losses.cosine_distance(tf.nn.l2_normalize(self.all_sub_features,2), tf.nn.l2_normalize(self.all_sub_goals,2), 2)

qingchenwuhou commented 6 years ago

280 self.Worker_Reward = 1 - tf.losses.cosine_distance(tf.nn.l2_normalize(self.all_sub_features,2), tf.nn.l2_normalize(self.all_sub_goals,2), 2) the up code is the objection function of manager, and the corresponding gradient is equation(7) Solved.