Skip to content

Commit 950a256

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 96dd337ae073652ed4d77d331b285e67629c519d
1 parent d49cd83 commit 950a256

File tree

1,034 files changed

+3132
-3132
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,034 files changed

+3132
-3132
lines changed
82 Bytes
Binary file not shown.
80 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
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\n# Author: Gael Varoquaux <[email protected]>, Brian Cheung\n# License: BSD 3 clause\n\nimport time\n\nimport numpy as np\nimport scipy as sp\nimport matplotlib.pyplot as plt\n\nfrom sklearn.feature_extraction import image\nfrom sklearn.cluster import spectral_clustering\n\n\n# load the raccoon face as a numpy array\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 = sp.misc.imresize(face, 0.10) / 255.\n\n# Convert the image into a graph with the value of the gradient on the\n# edges.\ngraph = image.img_to_graph(face)\n\n# Take a decreasing function of the gradient: an exponential\n# The smaller beta is, the more independent the segmentation is of the\n# actual image. For beta=1, the segmentation is close to a voronoi\nbeta = 5\neps = 1e-6\ngraph.data = np.exp(-beta * graph.data / graph.data.std()) + eps\n\n# Apply spectral clustering (this step goes much faster if you have pyamg\n# installed)\nN_REGIONS = 25"
29+
"print(__doc__)\n\n# Author: Gael Varoquaux <[email protected]>, Brian Cheung\n# License: BSD 3 clause\n\nimport time\n\nimport numpy as np\nimport scipy as sp\nimport matplotlib.pyplot as plt\n\nfrom sklearn.feature_extraction import image\nfrom sklearn.cluster import spectral_clustering\nfrom sklearn.externals._pilutil import imresize\n\n\n# load the raccoon face as a numpy array\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\n# Convert the image into a graph with the value of the gradient on the\n# edges.\ngraph = image.img_to_graph(face)\n\n# Take a decreasing function of the gradient: an exponential\n# The smaller beta is, the more independent the segmentation is of the\n# actual image. For beta=1, the segmentation is close to a voronoi\nbeta = 5\neps = 1e-6\ngraph.data = np.exp(-beta * graph.data / graph.data.std()) + eps\n\n# Apply spectral clustering (this step goes much faster if you have pyamg\n# installed)\nN_REGIONS = 25"
3030
]
3131
},
3232
{

dev/_downloads/plot_face_segmentation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
from sklearn.feature_extraction import image
3232
from sklearn.cluster import spectral_clustering
33+
from sklearn.externals._pilutil import imresize
3334

3435

3536
# load the raccoon face as a numpy array
@@ -40,7 +41,7 @@
4041
face = sp.face(gray=True)
4142

4243
# Resize it to 10% of the original size to speed up the processing
43-
face = sp.misc.imresize(face, 0.10) / 255.
44+
face = imresize(face, 0.10) / 255.
4445

4546
# Convert the image into a graph with the value of the gradient on the
4647
# edges.

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\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 = sp.misc.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, contours=1,\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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from sklearn.feature_extraction.image import grid_to_graph
2525
from sklearn.cluster import AgglomerativeClustering
26+
from sklearn.externals._pilutil import imresize
2627

2728

2829
# #############################################################################
@@ -34,7 +35,7 @@
3435
face = sp.face(gray=True)
3536

3637
# Resize it to 10% of the original size to speed up the processing
37-
face = sp.misc.imresize(face, 0.10) / 255.
38+
face = imresize(face, 0.10) / 255.
3839

3940
X = np.reshape(face, (-1, 1))
4041

dev/_downloads/scikit-learn-docs.pdf

-12.5 KB
Binary file not shown.
-87 Bytes
-87 Bytes
171 Bytes

0 commit comments

Comments
 (0)