10
$\begingroup$

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?

$\endgroup$
  • 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$ – Henrik Schumacher Aug 29 '18 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 Aug 31 '18 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 Dec 14 '19 at 19:16
6
+100
$\begingroup$

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

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

umap@data

enter image description here

ListPlot[%]

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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