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

enter image description here

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

  • 3
    $\begingroup$ 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). $\endgroup$ Commented Aug 29, 2018 at 19:24
  • $\begingroup$ @HenrikSchumacher That's true, but I'm hoping someone can figure out how to call into the python code in a clean way... $\endgroup$
    – user5601
    Commented Aug 31, 2018 at 18:07
  • $\begingroup$ @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? $\endgroup$
    – Oiale
    Commented Dec 14, 2019 at 19:16

1 Answer 1


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"]

enter image description here

ExternalEvaluate[python, "import umap"]

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

enter image description here

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


enter image description here


enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.