Skip to content

Commit ae22756

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 5900e2660f4293b52ea57bf830e7bff312779036
1 parent 3c2c29b commit ae22756

File tree

1,225 files changed

+4337
-4325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,225 files changed

+4337
-4325
lines changed
Binary file not shown.
Binary file not shown.

dev/_downloads/c8db473878b6afea8e75e36dc828f109/plot_compare_methods.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"# Author: Jake Vanderplas -- <[email protected]>\n\nfrom collections import OrderedDict\nfrom functools import partial\nfrom time import time\n\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib.ticker import NullFormatter\n\nfrom sklearn import manifold, datasets\n\n# Next line to silence pyflakes. This import is needed.\nAxes3D\n\nn_points = 1000\nX, color = datasets.make_s_curve(n_points, random_state=0)\nn_neighbors = 10\nn_components = 2\n\n# Create figure\nfig = plt.figure(figsize=(15, 8))\nfig.suptitle(\n \"Manifold Learning with %i points, %i neighbors\" % (1000, n_neighbors), fontsize=14\n)\n\n# Add 3d scatter plot\nax = fig.add_subplot(251, projection=\"3d\")\nax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)\nax.view_init(4, -72)\n\n# Set-up manifold methods\nLLE = partial(\n manifold.LocallyLinearEmbedding,\n n_neighbors=n_neighbors,\n n_components=n_components,\n eigen_solver=\"auto\",\n)\n\nmethods = OrderedDict()\nmethods[\"LLE\"] = LLE(method=\"standard\")\nmethods[\"LTSA\"] = LLE(method=\"ltsa\")\nmethods[\"Hessian LLE\"] = LLE(method=\"hessian\")\nmethods[\"Modified LLE\"] = LLE(method=\"modified\")\nmethods[\"Isomap\"] = manifold.Isomap(n_neighbors=n_neighbors, n_components=n_components)\nmethods[\"MDS\"] = manifold.MDS(n_components, max_iter=100, n_init=1)\nmethods[\"SE\"] = manifold.SpectralEmbedding(\n n_components=n_components, n_neighbors=n_neighbors\n)\nmethods[\"t-SNE\"] = manifold.TSNE(n_components=n_components, init=\"pca\", random_state=0)\n\n# Plot results\nfor i, (label, method) in enumerate(methods.items()):\n t0 = time()\n Y = method.fit_transform(X)\n t1 = time()\n print(\"%s: %.2g sec\" % (label, t1 - t0))\n ax = fig.add_subplot(2, 5, 2 + i + (i > 3))\n ax.scatter(Y[:, 0], Y[:, 1], c=color, cmap=plt.cm.Spectral)\n ax.set_title(\"%s (%.2g sec)\" % (label, t1 - t0))\n ax.xaxis.set_major_formatter(NullFormatter())\n ax.yaxis.set_major_formatter(NullFormatter())\n ax.axis(\"tight\")\n\nplt.show()"
29+
"# Author: Jake Vanderplas -- <[email protected]>\n\nfrom collections import OrderedDict\nfrom functools import partial\nfrom time import time\n\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom matplotlib.ticker import NullFormatter\n\nfrom sklearn import manifold, datasets\n\n# Next line to silence pyflakes. This import is needed.\nAxes3D\n\nn_points = 1000\nX, color = datasets.make_s_curve(n_points, random_state=0)\nn_neighbors = 10\nn_components = 2\n\n# Create figure\nfig = plt.figure(figsize=(15, 8))\nfig.suptitle(\n \"Manifold Learning with %i points, %i neighbors\" % (n_points, n_neighbors),\n fontsize=14,\n)\n\n# Add 3d scatter plot\nax = fig.add_subplot(251, projection=\"3d\")\nax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)\nax.view_init(4, -72)\n\n# Set-up manifold methods\nLLE = partial(\n manifold.LocallyLinearEmbedding,\n n_neighbors=n_neighbors,\n n_components=n_components,\n eigen_solver=\"auto\",\n random_state=0,\n)\n\nmethods = OrderedDict()\nmethods[\"LLE\"] = LLE(method=\"standard\")\nmethods[\"LTSA\"] = LLE(method=\"ltsa\")\nmethods[\"Hessian LLE\"] = LLE(method=\"hessian\")\nmethods[\"Modified LLE\"] = LLE(method=\"modified\")\nmethods[\"Isomap\"] = manifold.Isomap(n_neighbors=n_neighbors, n_components=n_components)\nmethods[\"MDS\"] = manifold.MDS(n_components, max_iter=50, n_init=1, random_state=0)\nmethods[\"SE\"] = manifold.SpectralEmbedding(\n n_components=n_components, n_neighbors=n_neighbors, random_state=0\n)\nmethods[\"t-SNE\"] = manifold.TSNE(\n n_components=n_components, perplexity=30, n_iter=250, init=\"pca\", random_state=0\n)\n\n# Plot results\nfor i, (label, method) in enumerate(methods.items()):\n t0 = time()\n Y = method.fit_transform(X)\n t1 = time()\n print(\"%s: %.2g sec\" % (label, t1 - t0))\n ax = fig.add_subplot(2, 5, 2 + i + (i > 3))\n ax.scatter(Y[:, 0], Y[:, 1], c=color, cmap=plt.cm.Spectral)\n ax.set_title(\"%s (%.2g sec)\" % (label, t1 - t0))\n ax.xaxis.set_major_formatter(NullFormatter())\n ax.yaxis.set_major_formatter(NullFormatter())\n ax.axis(\"tight\")\n\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/cda53b33015268619bc212d32b7000b9/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()):

dev/_downloads/scikit-learn-docs.zip

3.97 KB
Binary file not shown.

0 commit comments

Comments
 (0)