8000 DOC Accelerate examples/manifold/plot_compare_methods.py (#21635) · scikit-learn/scikit-learn@5900e26 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5900e26

Browse files
authored
DOC Accelerate examples/manifold/plot_compare_methods.py (#21635)
* Accelerate plot_compare_methods.py * Change tsne perplexity
1 parent b80138f commit 5900e26

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/manifold/plot_compare_methods.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
# Create figure
4444
fig = plt.figure(figsize=(15, 8))
4545
fig.suptitle(
46-
"Manifold Learning with %i points, %i neighbors" % (1000, n_neighbors), fontsize=14
46+
"Manifold Learning with %i points, %i neighbors" % (n_points, n_neighbors),
47+
fontsize=14,
4748
)
4849

4950
# Add 3d scatter plot
@@ -57,6 +58,7 @@
5758
n_neighbors=n_neighbors,
5859
n_components=n_components,
5960
eigen_solver="auto",
61+
random_state=0,
6062
)
6163

6264
methods = OrderedDict()
@@ -65,11 +67,13 @@
6567
methods["Hessian LLE"] = LLE(method="hessian")
6668
methods["Modified LLE"] = LLE(method="modified")
6769
methods["Isomap"] = manifold.Isomap(n_neighbors=n_neighbors, n_components=n_components)
68-
methods["MDS"] = manifold.MDS(n_components, max_iter=100, n_init=1)
70+
methods["MDS"] = manifold.MDS(n_components, max_iter=50, n_init=1, random_state=0)
6971
methods["SE"] = manifold.SpectralEmbedding(
70-
n_components=n_components, n_neighbors=n_neighbors
72+
n_components=n_components, n_neighbors=n_neighbors, random_state=0
73+
)
74+
methods["t-SNE"] = manifold.TSNE(
75+
n_components=n_components, perplexity=30, n_iter=250, init="pca", random_state=0
7176
)
72-
methods["t-SNE"] = manifold.TSNE(n_components=n_components, init="pca", random_state=0)
7377

7478
# Plot results
7579
for i, (label, method) in enumerate(methods.items()):

0 commit comments

Comments
 (0)
0