igul222 / improved_wgan_training

Code for reproducing experiments in "Improved Training of Wasserstein GANs"
MIT License
2.35k stars 669 forks source link

Countour plotting needs transposition #8

Closed stefdoerr closed 7 years ago

stefdoerr commented 7 years ago

Hey, I noticed a bug in your contour plotting as in this function: https://github.com/igul222/improved_wgan_training/blob/master/gan_toy.py#L163. You have to transpose the height values for the contour using .transpose() i.e. plt.contour(x,y,disc_map.reshape((len(x), len(y))).transpose())

The reason the results look ok for the gaussian toy examples is because they are symmetrical. Try removing a few gaussians from the 8gaussian example like this and see what happens:

    elif DATASET == '8gaussians':
        scale = 2.
        centers = [
            (1,0),
            #(-1,0),
            #(0,1),
            (0,-1),
            (1./np.sqrt(2), 1./np.sqrt(2)),
            (1./np.sqrt(2), -1./np.sqrt(2)),
            #(-1./np.sqrt(2), 1./np.sqrt(2)),
            #(-1./np.sqrt(2), -1./np.sqrt(2))
        ]

This might improve your results on the swiss roll as well since it's not perfectly symmetrical.

Had me scratching my head for a bit on my own unsymmetrical dataset wondering why the controus looked so wrong haha.

Cheers

igul222 commented 7 years ago

Good catch!