I have added a simple make-random-complex-generator (the implementation may not have caught up yet) which generates complex numbers from a specified rectangle of complex space, just as make-random-real-generator generates real numbers from a specified interval on the real line.

On Fri, Jun 26, 2020 at 7:21 PM Linas Vepstas <xxxxxx@gmail.com> wrote:
OK,

So the attached file contains a low-brow implementation for random uniform distributions on a sphere and inside a ball. By far the hardest part was writing a unit test... which does double duty as a test on the uniform gaussian distribution, as the algo depends very heavily on that.

Caveats:
* My implementation returns a list of double-precision floats. This should almost surely be changed to vectors.
* It seems that guile-3.0 does not have srfi-158 so I did not use that... disappointing, and so some decision needs to be made regarding what kind of vectors to use...
* It contains some very minor guile-isms that need to be ironed out.

I am still very interested in uniform distributions over complex projective space CP^N aka uniform distributions over the Fubini-Study metric. However, I would have to review what I know about such things.  It would also require two extensions to srfi-194 -- the use of complex numbers, and the use of vectors of complex numbers .... something to think about.

And while on the related topic: notable in it's absence is the dirichlet distribution -- notable because its the conjugate to the categorical distribution (which is in srfi-194), and because the sphere distribution is the "square root" of the dirichlet distribution. 

-- Linas

On Wed, Jun 24, 2020 at 2:28 PM Linas Vepstas <xxxxxx@gmail.com> wrote:
While I am stirring up trouble, I may as well mention one other thing: randomly distributed vectors.   First let me point at two of them, and then make long-winded comments:

guile provides random:hollow-sphere! and random:solid-sphere! see https://www.gnu.org/software/guile/manual/html_node/Random.html for guile docs.

What are these good for? The first is famous for what are called "random matrix models" which show up in nuclear physics and also in the study of the Riemann hypothesis. In my case, it also shows up in machine learning and neural nets, etc. So...

If you look at neural nets or machine learning, they often work in a vector space, which happens to be an n-dimensional "simplex" i.e. n random uniformly distributed numbers p_1 ... p_n such that sum_k p_k = 1. They then frequently (and incorrectly) apply cosine dot-products to this space, destroying the simplex (the most famous leading light of the scene, Yoshua Bengio, being the one who spread this faulty thinking).

The solution is provided by another luminary: Mikhail Gromov who points out that the square root of the p_k lie on the (surface of) the sphere, and that famous statistical relations, such as "Fisher information" (see wikipedia) is just "secretly" the metric on the (hollow) sphere (see "Fisher information metric" wikipedia) which is more or less the Bures metric (which is employed all over the quantum computing world).

In summary: if you do neural net learning on a simplex, but then distribute so that you are actually working on the surface of a sphere, then it is legal to take cosine products of vectors. As a bonus, you get consistent mutual information for the thing.

So, a vector distribution over a hollow sphere might find many interested users.  (I've got a small mountain of scheme code that works with this distribution) No clue what a solid sphere is good for, but I suppose some mechanical engineers would know.

Slightly off-topic: a decade ago, I wished for a scheme wrapper to gnu gmp -- that would have made so many things so much easier. A decade later, there still is no such thing :-( it's still a worthy undertaking.

--linas

--
cassette tapes - analog TV - film cameras - you


--
Verbogeny is one of the pleasurettes of a creatific thinkerizer.
        --Peter da Silva