One million integers embedded into 2D space with UMAP

A view of a million integers

This is the first million integers, represented as binary vectors indicating their prime factors, and laid out using the UMAP dimensionality reduction algorithm by Leland McInnes. Each integer is represented in a high-dimensional space, and gets squished down to 2D so that numbers with similar prime factorisations are closer together than those with dissimilar factorisations.

A very pretty structure emerges; this might be spurious in that it captures more about the layout algorithm than any “true” structure of numbers. However, the visual effect is very appealling and requires no tricky manipulation to create.

Large 4k version of the image suitable for backgrounds

Code

The python code is available.

Massive ~10k resolution version 16Mb

Video

A short video, showing the numbers being added in sequence. Each frame adds 1000 integers, for a total of 1000 frames.

Note that the layout is a fixed layout for 1M points, and the video shows the points in this 1M point filtered over time. It is not a recomputation of the layout for each subset, as that would be too unstable to make a useful animation.

Interactive 3D viewer

There is a WebGL live in-browser 3D viewer here. The algorithm was run again compressing into a 3D space, instead of 2D. Much of the structure remains stable, which is very pleasing. This plot uses the “false colouring” to colour the points, as explained in below.

GIF of the visualisation rotating in the viewer

The 2D plot can be viewed as well in the same viewer.

I want a poster of this for my classroom/office/bathroom

A preview of the poster.