why
For 2 n-dimensional unit vectors and
- The of the angle between them is
- By the Central Limit Theorem, approximates a normal distribution with mean zero as
- So as , the is more likely to be around the mean which is 0, which means the 2 vectors are more likely to be orthogonal
notes
- The vector must be sample from normal distribution, not uniform distribution. So one should use
np.rand.normal
andtorch.normal
instead ofnp.rand.random
andtorch.random
generate random unit vectors
How
- Draw from a standard distribution for each dimension.
- Do not draw from a uniform distribution.
- Or will need to apply Box-Muller transform
Implementation
Why that works
- Considering a 2D space, the probability of a point being at is
- The PDF for the standard distribution is , which is roughly in the form of
- Thus is in the form of , which is a function of the distance to the origin
- So the resulting distribution is radially symmetric around the origin
An intuitive explanation of why uniform sampling don’t work
- Considering a 2D space, uniformly sampling from both dimension results in a square population
- Whereas a random distribution in 2D space should be a circle
- This is called the corner effect