How to perform UMAP dimensionality reduction?

This new method UMAP looks to be better than TSNE, unfortunately it is not available as a dimension reduction method yet:

Does anyone know if there exists an implementation of it in, or accessible from, Mathematica?

• The method seems to be pretty new (only published on arxiv in this year's February). You don't expect that anybody implents that for you do you? But with version 11.3, you can try to call the Python code from within Mathematica (see documentation). Commented Aug 29, 2018 at 19:24
• @HenrikSchumacher That's true, but I'm hoping someone can figure out how to call into the python code in a clean way... Commented Aug 31, 2018 at 18:07
• @user5601 Excuse me for off-topic question, can you explain me why did you choose to use Mathematica for dimension reduction instead of doing it explicitly in python? Commented Dec 14, 2019 at 19:16

Download Miniconda (Python 3.7) and install in the directory C:\Anaconda3.

In Command Prompt:

conda create --name umap python=3.7
conda activate umap
conda install numpy
pip install pyzmq umap-learn


In Mathematica:

RegisterExternalEvaluator["Python", "C:\\Anaconda3\\envs\\umap\\python.exe"]

python = StartExternalSession["Python"]


ExternalEvaluate[python, "import umap"]

umap = ExternalFunction[python, "def DimensionReduce(data): return umap.UMAP(random_state=0).fit_transform(data)"]


SeedRandom[0];
data = RandomReal[{-1, 1}, {100, 10}];

umap@data


ListPlot[%]


• I use anaconda already, is it possible to make more efficient for larger datasets? Commented Dec 13, 2019 at 17:17
• What do you mean by "more efficient"? Commented Dec 13, 2019 at 17:51