UMAP Intersections and unions are broken
See original GitHub issueHi Leland,
Just wanted to point out that fresh installs of umap seem to not be working entirely correct. The intersection and union methods seem to be the most obvious thing I’ve found, hopefully they are the only method broken. Here is an example following the instructions in the UMAP docs (https://umap-learn.readthedocs.io/en/latest/composing_models.html) on mnist:
I’ve noticed this on multiple datasets and multiple different fresh conda environments. So either an update to UMAP went astray or a backend dependency has updated and caused some issues. Here is the yaml file I used to create a fresh conda environment:
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- python>=3.9
- joblib>=1
- tbb
- hdbscan
- matplotlib
- numpy
- seaborn
- scikit-learn
- scikit-bio
- numba=0.53.0
- pebble
- biopython
- pynndescent
- threadpoolctl
- imageio
- umap-learn>=0.5
And here is the code I used to generate the above plot:
import sklearn.datasets
from sklearn.preprocessing import RobustScaler
import seaborn as sns
import pandas as pd
import numpy as np
import umap
import matplotlib.pyplot as plt
mnist = sklearn.datasets.fetch_openml("mnist_784")
top = mnist.data.iloc[:, :28 * 14]
bottom = mnist.data.iloc[:, 28 * 14:]
top_mapper = umap.UMAP(random_state=42).fit(top)
bot_mapper = umap.UMAP(random_state=42).fit(bottom)
intersection_mapper = top_mapper * bot_mapper
mnist_targets = [int(v) for v in mnist.target]
color_palette = sns.color_palette('Paired', max(mnist_targets) + 1)
cluster_colors = [
color_palette[x] if x >= 0 else (0.5, 0.5, 0.5) for x in mnist_targets
]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(intersection_mapper.embedding_[:, 0],
intersection_mapper.embedding_[:, 1],
s=7,
linewidth=0,
c=cluster_colors,
alpha=0.7)
plt.gca().set_aspect('equal', 'datalim')
plt.show()
I’ve attached the output of conda list
as well so you can see all of the packages that have been installed: conda_freeze.txt
Hopefully this is a fairly early fix, but please keep me posted and let me know if I can help in any way.
Cheers, Rhys
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thanks, I suspect it is indeed related to #798. It must be an odd interaction. I’ll see if I can track it down.
Nice, seems to be fixed on my end. Thanks for the quick turn around on that!