Skip to content

Commit 88e4248

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 2e78011ab56726f3b1590b4a4d5a53a7a72a08d2
1 parent 9f33b26 commit 88e4248

File tree

1,058 files changed

+3180
-3167
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,058 files changed

+3180
-3167
lines changed
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.

dev/_downloads/plot_face_segmentation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"outputs": [],
4646
"source": [
47-
"for assign_labels in ('kmeans', 'discretize'):\n t0 = time.time()\n labels = spectral_clustering(graph, n_clusters=N_REGIONS,\n assign_labels=assign_labels, random_state=42)\n t1 = time.time()\n labels = labels.reshape(face.shape)\n\n plt.figure(figsize=(5, 5))\n plt.imshow(face, cmap=plt.cm.gray)\n for l in range(N_REGIONS):\n plt.contour(labels == l, contours=1,\n colors=[plt.cm.spectral(l / float(N_REGIONS))])\n plt.xticks(())\n plt.yticks(())\n title = 'Spectral clustering: %s, %.2fs' % (assign_labels, (t1 - t0))\n print(title)\n plt.title(title)\nplt.show()"
47+
"for assign_labels in ('kmeans', 'discretize'):\n t0 = time.time()\n labels = spectral_clustering(graph, n_clusters=N_REGIONS,\n assign_labels=assign_labels, random_state=42)\n t1 = time.time()\n labels = labels.reshape(face.shape)\n\n plt.figure(figsize=(5, 5))\n plt.imshow(face, cmap=plt.cm.gray)\n for l in range(N_REGIONS):\n plt.contour(labels == l,\n colors=[plt.cm.spectral(l / float(N_REGIONS))])\n plt.xticks(())\n plt.yticks(())\n title = 'Spectral clustering: %s, %.2fs' % (assign_labels, (t1 - t0))\n print(title)\n plt.title(title)\nplt.show()"
4848
]
4949
}
5050
],

dev/_downloads/plot_face_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
plt.figure(figsize=(5, 5))
7272
plt.imshow(face, cmap=plt.cm.gray)
7373
for l in range(N_REGIONS):
74-
plt.contour(labels == l, contours=1,
74+
plt.contour(labels == l,
7575
colors=[plt.cm.spectral(l / float(N_REGIONS))])
7676
plt.xticks(())
7777
plt.yticks(())

dev/_downloads/plot_face_ward_segmentation.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 : Vincent Michel, 2010\n# Alexandre Gramfort, 2011\n# License: BSD 3 clause\n\nprint(__doc__)\n\nimport time as time\n\nimport numpy as np\nimport scipy as sp\n\nimport matplotlib.pyplot as plt\n\nfrom sklearn.feature_extraction.image import grid_to_graph\nfrom sklearn.cluster import AgglomerativeClustering\nfrom sklearn.externals._pilutil import imresize\n\n\n# #############################################################################\n# Generate data\ntry: # SciPy >= 0.16 have face in misc\n from scipy.misc import face\n face = face(gray=True)\nexcept ImportError:\n face = sp.face(gray=True)\n\n# Resize it to 10% of the original size to speed up the processing\nface = imresize(face, 0.10) / 255.\n\nX = np.reshape(face, (-1, 1))\n\n# #############################################################################\n# Define the structure A of the data. Pixels connected to their neighbors.\nconnectivity = grid_to_graph(*face.shape)\n\n# #############################################################################\n# Compute clustering\nprint(\"Compute structured hierarchical clustering...\")\nst = time.time()\nn_clusters = 15 # number of regions\nward = AgglomerativeClustering(n_clusters=n_clusters, linkage='ward',\n connectivity=connectivity)\nward.fit(X)\nlabel = np.reshape(ward.labels_, face.shape)\nprint(\"Elapsed time: \", time.time() - st)\nprint(\"Number of pixels: \", label.size)\nprint(\"Number of clusters: \", np.unique(label).size)\n\n# #############################################################################\n# Plot the results on an image\nplt.figure(figsize=(5, 5))\nplt.imshow(face, cmap=plt.cm.gray)\nfor l in range(n_clusters):\n plt.contour(label == l, contours=1,\n colors=[plt.cm.spectral(l / float(n_clusters)), ])\nplt.xticks(())\nplt.yticks(())\nplt.show()"
29+
"# Author : Vincent Michel, 2010\n# Alexandre Gramfort, 2011\n# License: BSD 3 clause\n\nprint(__doc__)\n\nimport time as time\n\nimport numpy as np\nimport scipy as sp\n\nimport matplotlib.pyplot as plt\n\nfrom sklearn.feature_extraction.image import grid_to_graph\nfrom sklearn.cluster import AgglomerativeClustering\nfrom sklearn.externals._pilutil import imresize\n\n\n# #############################################################################\n# Generate data\ntry: # SciPy >= 0.16 have face in misc\n from scipy.misc import face\n face = face(gray=True)\nexcept ImportError:\n face = sp.face(gray=True)\n\n# Resize it to 10% of the original size to speed up the processing\nface = imresize(face, 0.10) / 255.\n\nX = np.reshape(face, (-1, 1))\n\n# #############################################################################\n# Define the structure A of the data. Pixels connected to their neighbors.\nconnectivity = grid_to_graph(*face.shape)\n\n# #############################################################################\n# Compute clustering\nprint(\"Compute structured hierarchical clustering...\")\nst = time.time()\nn_clusters = 15 # number of regions\nward = AgglomerativeClustering(n_clusters=n_clusters, linkage='ward',\n connectivity=connectivity)\nward.fit(X)\nlabel = np.reshape(ward.labels_, face.shape)\nprint(\"Elapsed time: \", time.time() - st)\nprint(\"Number of pixels: \", label.size)\nprint(\"Number of clusters: \", np.unique(label).size)\n\n# #############################################################################\n# Plot the results on an image\nplt.figure(figsize=(5, 5))\nplt.imshow(face, cmap=plt.cm.gray)\nfor l in range(n_clusters):\n plt.contour(label == l,\n colors=[plt.cm.spectral(l / float(n_clusters)), ])\nplt.xticks(())\nplt.yticks(())\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/plot_face_ward_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
plt.figure(figsize=(5, 5))
6262
plt.imshow(face, cmap=plt.cm.gray)
6363
for l in range(n_clusters):
64-
plt.contour(label == l, contours=1,
64+
plt.contour(label == l,
6565
colors=[plt.cm.spectral(l / float(n_clusters)), ])
6666
plt.xticks(())
6767
plt.yticks(())

dev/_downloads/scikit-learn-docs.pdf

-4.57 KB
Binary file not shown.
-56 Bytes
-56 Bytes
270 Bytes

0 commit comments

Comments
 (0)