Skip to content

Commit 4fe7fa4

Browse files
committed
Pushing the docs to dev/ for branch: main, commit e838429839f4d11b63380f0ac810db853955a0aa
1 parent 9a775be commit 4fe7fa4

File tree

1,331 files changed

+7246
-7257
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,331 files changed

+7246
-7257
lines changed

dev/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 2ccc2acf4828f3ca83cd5004e280d200
3+
config: d33342b06755304fde4cac8e35421a5a
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.

dev/_downloads/1e0968da80ca868bbdf21c1d0547f68c/plot_lle_digits.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
},
8888
"outputs": [],
8989
"source": [
90-
"from sklearn.decomposition import TruncatedSVD\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\nfrom sklearn.ensemble import RandomTreesEmbedding\nfrom sklearn.manifold import (\n MDS,\n TSNE,\n Isomap,\n LocallyLinearEmbedding,\n SpectralEmbedding,\n)\nfrom sklearn.neighbors import NeighborhoodComponentsAnalysis\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.random_projection import SparseRandomProjection\n\nembeddings = {\n \"Random projection embedding\": SparseRandomProjection(\n n_components=2, random_state=42\n ),\n \"Truncated SVD embedding\": TruncatedSVD(n_components=2),\n \"Linear Discriminant Analysis embedding\": LinearDiscriminantAnalysis(\n n_components=2\n ),\n \"Isomap embedding\": Isomap(n_neighbors=n_neighbors, n_components=2),\n \"Standard LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"standard\"\n ),\n \"Modified LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"modified\"\n ),\n \"Hessian LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"hessian\"\n ),\n \"LTSA LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"ltsa\"\n ),\n \"MDS embedding\": MDS(\n n_components=2, n_init=1, max_iter=120, n_jobs=2, normalized_stress=\"auto\"\n ),\n \"Random Trees embedding\": make_pipeline(\n RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),\n TruncatedSVD(n_components=2),\n ),\n \"Spectral embedding\": SpectralEmbedding(\n n_components=2, random_state=0, eigen_solver=\"arpack\"\n ),\n \"t-SNE embedding\": TSNE(\n n_components=2,\n n_iter=500,\n n_iter_without_progress=150,\n n_jobs=2,\n random_state=0,\n ),\n \"NCA embedding\": NeighborhoodComponentsAnalysis(\n n_components=2, init=\"pca\", random_state=0\n ),\n}"
90+
"from sklearn.decomposition import TruncatedSVD\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\nfrom sklearn.ensemble import RandomTreesEmbedding\nfrom sklearn.manifold import (\n MDS,\n TSNE,\n Isomap,\n LocallyLinearEmbedding,\n SpectralEmbedding,\n)\nfrom sklearn.neighbors import NeighborhoodComponentsAnalysis\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.random_projection import SparseRandomProjection\n\nembeddings = {\n \"Random projection embedding\": SparseRandomProjection(\n n_components=2, random_state=42\n ),\n \"Truncated SVD embedding\": TruncatedSVD(n_components=2),\n \"Linear Discriminant Analysis embedding\": LinearDiscriminantAnalysis(\n n_components=2\n ),\n \"Isomap embedding\": Isomap(n_neighbors=n_neighbors, n_components=2),\n \"Standard LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"standard\"\n ),\n \"Modified LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"modified\"\n ),\n \"Hessian LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"hessian\"\n ),\n \"LTSA LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"ltsa\"\n ),\n \"MDS embedding\": MDS(n_components=2, n_init=1, max_iter=120, n_jobs=2),\n \"Random Trees embedding\": make_pipeline(\n RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),\n TruncatedSVD(n_components=2),\n ),\n \"Spectral embedding\": SpectralEmbedding(\n n_components=2, random_state=0, eigen_solver=\"arpack\"\n ),\n \"t-SNE embedding\": TSNE(\n n_components=2,\n n_iter=500,\n n_iter_without_progress=150,\n n_jobs=2,\n random_state=0,\n ),\n \"NCA embedding\": NeighborhoodComponentsAnalysis(\n n_components=2, init=\"pca\", random_state=0\n ),\n}"
9191
]
9292
},
9393
{

dev/_downloads/604c0a9de0e1b80dae9e6754fdb27014/plot_manifold_sphere.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"# Author: Jaques Grobler <[email protected]>\n# License: BSD 3 clause\n\nfrom time import time\n\nimport matplotlib.pyplot as plt\n\n# Unused but required import for doing 3d projections with matplotlib < 3.2\nimport mpl_toolkits.mplot3d # noqa: F401\nimport numpy as np\nfrom matplotlib.ticker import NullFormatter\n\nfrom sklearn import manifold\nfrom sklearn.utils import check_random_state\n\n# Variables for manifold learning.\nn_neighbors = 10\nn_samples = 1000\n\n# Create our sphere.\nrandom_state = check_random_state(0)\np = random_state.rand(n_samples) * (2 * np.pi - 0.55)\nt = random_state.rand(n_samples) * np.pi\n\n# Sever the poles from the sphere.\nindices = (t < (np.pi - (np.pi / 8))) & (t > ((np.pi / 8)))\ncolors = p[indices]\nx, y, z = (\n np.sin(t[indices]) * np.cos(p[indices]),\n np.sin(t[indices]) * np.sin(p[indices]),\n np.cos(t[indices]),\n)\n\n# Plot our dataset.\nfig = plt.figure(figsize=(15, 8))\nplt.suptitle(\n \"Manifold Learning with %i points, %i neighbors\" % (1000, n_neighbors), fontsize=14\n)\n\nax = fig.add_subplot(251, projection=\"3d\")\nax.scatter(x, y, z, c=p[indices], cmap=plt.cm.rainbow)\nax.view_init(40, -10)\n\nsphere_data = np.array([x, y, z]).T\n\n# Perform Locally Linear Embedding Manifold learning\nmethods = [\"standard\", \"ltsa\", \"hessian\", \"modified\"]\nlabels = [\"LLE\", \"LTSA\", \"Hessian LLE\", \"Modified LLE\"]\n\nfor i, method in enumerate(methods):\n t0 = time()\n trans_data = (\n manifold.LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=method, random_state=42\n )\n .fit_transform(sphere_data)\n .T\n )\n t1 = time()\n print(\"%s: %.2g sec\" % (methods[i], t1 - t0))\n\n ax = fig.add_subplot(252 + i)\n plt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\n plt.title(\"%s (%.2g sec)\" % (labels[i], t1 - t0))\n ax.xaxis.set_major_formatter(NullFormatter())\n ax.yaxis.set_major_formatter(NullFormatter())\n plt.axis(\"tight\")\n\n# Perform Isomap Manifold learning.\nt0 = time()\ntrans_data = (\n manifold.Isomap(n_neighbors=n_neighbors, n_components=2)\n .fit_transform(sphere_data)\n .T\n)\nt1 = time()\nprint(\"%s: %.2g sec\" % (\"ISO\", t1 - t0))\n\nax = fig.add_subplot(257)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"%s (%.2g sec)\" % (\"Isomap\", t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform Multi-dimensional scaling.\nt0 = time()\nmds = manifold.MDS(2, max_iter=100, n_init=1, normalized_stress=\"auto\", random_state=42)\ntrans_data = mds.fit_transform(sphere_data).T\nt1 = time()\nprint(\"MDS: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(258)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"MDS (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform Spectral Embedding.\nt0 = time()\nse = manifold.SpectralEmbedding(\n n_components=2, n_neighbors=n_neighbors, random_state=42\n)\ntrans_data = se.fit_transform(sphere_data).T\nt1 = time()\nprint(\"Spectral Embedding: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(259)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"Spectral Embedding (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform t-distributed stochastic neighbor embedding.\nt0 = time()\ntsne = manifold.TSNE(n_components=2, random_state=0)\ntrans_data = tsne.fit_transform(sphere_data).T\nt1 = time()\nprint(\"t-SNE: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(2, 5, 10)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"t-SNE (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\nplt.show()"
18+
"# Author: Jaques Grobler <[email protected]>\n# License: BSD 3 clause\n\nfrom time import time\n\nimport matplotlib.pyplot as plt\n\n# Unused but required import for doing 3d projections with matplotlib < 3.2\nimport mpl_toolkits.mplot3d # noqa: F401\nimport numpy as np\nfrom matplotlib.ticker import NullFormatter\n\nfrom sklearn import manifold\nfrom sklearn.utils import check_random_state\n\n# Variables for manifold learning.\nn_neighbors = 10\nn_samples = 1000\n\n# Create our sphere.\nrandom_state = check_random_state(0)\np = random_state.rand(n_samples) * (2 * np.pi - 0.55)\nt = random_state.rand(n_samples) * np.pi\n\n# Sever the poles from the sphere.\nindices = (t < (np.pi - (np.pi / 8))) & (t > ((np.pi / 8)))\ncolors = p[indices]\nx, y, z = (\n np.sin(t[indices]) * np.cos(p[indices]),\n np.sin(t[indices]) * np.sin(p[indices]),\n np.cos(t[indices]),\n)\n\n# Plot our dataset.\nfig = plt.figure(figsize=(15, 8))\nplt.suptitle(\n \"Manifold Learning with %i points, %i neighbors\" % (1000, n_neighbors), fontsize=14\n)\n\nax = fig.add_subplot(251, projection=\"3d\")\nax.scatter(x, y, z, c=p[indices], cmap=plt.cm.rainbow)\nax.view_init(40, -10)\n\nsphere_data = np.array([x, y, z]).T\n\n# Perform Locally Linear Embedding Manifold learning\nmethods = [\"standard\", \"ltsa\", \"hessian\", \"modified\"]\nlabels = [\"LLE\", \"LTSA\", \"Hessian LLE\", \"Modified LLE\"]\n\nfor i, method in enumerate(methods):\n t0 = time()\n trans_data = (\n manifold.LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=method, random_state=42\n )\n .fit_transform(sphere_data)\n .T\n )\n t1 = time()\n print(\"%s: %.2g sec\" % (methods[i], t1 - t0))\n\n ax = fig.add_subplot(252 + i)\n plt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\n plt.title(\"%s (%.2g sec)\" % (labels[i], t1 - t0))\n ax.xaxis.set_major_formatter(NullFormatter())\n ax.yaxis.set_major_formatter(NullFormatter())\n plt.axis(\"tight\")\n\n# Perform Isomap Manifold learning.\nt0 = time()\ntrans_data = (\n manifold.Isomap(n_neighbors=n_neighbors, n_components=2)\n .fit_transform(sphere_data)\n .T\n)\nt1 = time()\nprint(\"%s: %.2g sec\" % (\"ISO\", t1 - t0))\n\nax = fig.add_subplot(257)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"%s (%.2g sec)\" % (\"Isomap\", t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform Multi-dimensional scaling.\nt0 = time()\nmds = manifold.MDS(2, max_iter=100, n_init=1, random_state=42)\ntrans_data = mds.fit_transform(sphere_data).T\nt1 = time()\nprint(\"MDS: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(258)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"MDS (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform Spectral Embedding.\nt0 = time()\nse = manifold.SpectralEmbedding(\n n_components=2, n_neighbors=n_neighbors, random_state=42\n)\ntrans_data = se.fit_transform(sphere_data).T\nt1 = time()\nprint(\"Spectral Embedding: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(259)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"Spectral Embedding (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\n# Perform t-distributed stochastic neighbor embedding.\nt0 = time()\ntsne = manifold.TSNE(n_components=2, random_state=0)\ntrans_data = tsne.fit_transform(sphere_data).T\nt1 = time()\nprint(\"t-SNE: %.2g sec\" % (t1 - t0))\n\nax = fig.add_subplot(2, 5, 10)\nplt.scatter(trans_data[0], trans_data[1], c=colors, cmap=plt.cm.rainbow)\nplt.title(\"t-SNE (%.2g sec)\" % (t1 - t0))\nax.xaxis.set_major_formatter(NullFormatter())\nax.yaxis.set_major_formatter(NullFormatter())\nplt.axis(\"tight\")\n\nplt.show()"
1919
]
2020
}
2121
],
Binary file not shown.

dev/_downloads/9846b34238b553e03157c49723da2b04/plot_manifold_sphere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112

113113
# Perform Multi-dimensional scaling.
114114
t0 = time()
115-
mds = manifold.MDS(2, max_iter=100, n_init=1, normalized_stress="auto", random_state=42)
115+
mds = manifold.MDS(2, max_iter=100, n_init=1, random_state=42)
116116
trans_data = mds.fit_transform(sphere_data).T
117117
t1 = time()
118118
print("MDS: %.2g sec" % (t1 - t0))

dev/_downloads/9d97cc4ed755b7f2c7f9311bccc89a00/plot_lle_digits.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ def plot_embedding(X, title):
135135
"LTSA LLE embedding": LocallyLinearEmbedding(
136136
n_neighbors=n_neighbors, n_components=2, method="ltsa"
137137
),
138-
"MDS embedding": MDS(
139-
n_components=2, n_init=1, max_iter=120, n_jobs=2, normalized_stress="auto"
140-
),
138+
"MDS embedding": MDS(n_components=2, n_init=1, max_iter=120, n_jobs=2),
141139
"Random Trees embedding": make_pipeline(
142140
RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),
143141
TruncatedSVD(n_components=2),

0 commit comments

Comments
 (0)