Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample points in a circle are not uniformly distributed. #1

Open
kwonoh opened this issue Sep 28, 2018 · 0 comments
Open

Sample points in a circle are not uniformly distributed. #1

kwonoh opened this issue Sep 28, 2018 · 0 comments

Comments

@kwonoh
Copy link

kwonoh commented Sep 28, 2018

Hi,

Thank you for sharing the code.

I found that the function generateZ in MNIST_SlicedWassersteinAutoEncoder_Circle.ipynb does not generate sample points in a circle uniformly.
The generated sample points are more dense at the center of a circle. This can affect the resulting latent space.

It can be easily fixed by applying sqrt on random radius samples from a uniform distribution.

def generateZ(batchsize):
    # This function generates 2D samples from a `circle' distribution in 
    # a 2-dimensional space
    # r=np.random.uniform(size=(batchsize)) # before
    r=np.sqrt(np.random.uniform(size=(batchsize))) # after
    theta=2*np.pi*np.random.uniform(size=(batchsize))
    x=r*np.cos(theta)
    y=r*np.sin(theta)
    z_=np.array([x,y]).T
    return z_

Here is an related article: Generate a random point within a circle (uniformly)

Best,
Oh-Hyun

@kwonoh kwonoh changed the title Circle point generation is not uniform. Sample points in a circle are not uniformly distributed. Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant