Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 98ac51f

Browse files
committed
1.geo.py 2.add test.py 3.readme 4.ideas
1 parent 179fe0f commit 98ac51f

11 files changed

+472
-374
lines changed

.gitignore

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
**/res
1212
**/pics
1313
**/results
14-
**/test.py
15-
**.pkl
14+
**.pkl
15+
**/resources
16+
hhw_code/plt_test.py
17+
hhw_code/tmp.ipynb
18+
hhw_code/dim_reduce/
19+
hhw_code/restats

hhw_code/dim_reduce.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import umap
2+
from sklearn.datasets import fetch_openml
3+
import matplotlib.pyplot as plt
4+
import seaborn as sns
5+
6+
sns.set(context="paper", style="white")
7+
8+
mnist = fetch_openml("mnist_784", version=1)
9+
10+
reducer = umap.UMAP(random_state=42)
11+
embedding = reducer.fit_transform(mnist.data)
12+
13+
fig, ax = plt.subplots(figsize=(12, 10))
14+
color = mnist.target.astype(int)
15+
plt.scatter(embedding[:, 0], embedding[:, 1], c=color, cmap="Spectral", s=0.1)
16+
plt.setp(ax, xticks=[], yticks=[])
17+
plt.title("MNIST data embedded into two dimensions by UMAP", fontsize=18)
18+
19+
plt.show()

0 commit comments

Comments
 (0)