fix mnist example with fetch_openml call
@@ -14,20 +14,21 @@ among the different digit classes -- keeping 1 far from
blend into one another in some cases.
"""
import umap
-from sklearn.datasets import fetch_mldata
+from sklearn.datasets import fetch_openml
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(context="paper", style="white")
-mnist = fetch_mldata("MNIST original")
+mnist = fetch_openml('mnist_784', version=1)
reducer = umap.UMAP(random_state=42)
embedding = reducer.fit_transform(mnist.data)
fig, ax = plt.subplots(figsize=(12, 10))
+color = mnist.target.astype(int)
plt.scatter(
- embedding[:, 0], embedding[:, 1], c=mnist.target, cmap="Spectral", s=0.1
+ embedding[:, 0], embedding[:, 1], c=color, cmap="Spectral", s=0.1
)
plt.setp(ax, xticks=[], yticks=[])
plt.title("MNIST data embedded into two dimensions by UMAP", fontsize=18)
