bobchennan/Wasserstein-GAN-Keras

Confusion with Wasserstein about Implementations

Closed this issue · 4 comments

@bobchennan Hi Chennan, glad to see your implementations of WGANs. Thank you for your contribution. When reading your codes, I see two main changes that you have made:
(1) Line 55: K.mean(target*output)
(2) Line 133: replace 'linear' with 'sigmoid' in the original GANs.
Could you please explain why these changes could implement the WGAN? Besides, are you computing Wasserstein Distance by using K.mean(target*output)? Looking forward to your reply.

You can read the original paper or this tutorial. Briefly speaking for the first WGAN used a the difference between two expectation as the objective function, so we used +1 -1 to represent that.

@bobchennan Thank you for your feedback! One question is is: any difference when we define y_true = -1 or y_true = +1?

I am not sure but I think it is different.

changing y_true = -1 or y_true = +1 would reverse the sign of the loss, which clearly is undesirable.