Skip to content

Commit ceb8a12

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 53acd0fe52cb5d8c6f5a86a1fc1352809240b68d
1 parent 714c9b6 commit ceb8a12

File tree

1,360 files changed

+4618
-4626
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,360 files changed

+4618
-4626
lines changed
Binary file not shown.

dev/_downloads/2f930acda654766f8ba0fee08887bb41/plot_affinity_propagation.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Between Data Points", Science Feb. 2007
99
1010
"""
11+
import numpy as np
1112

1213
from sklearn.cluster import AffinityPropagation
1314
from sklearn import metrics
@@ -48,27 +49,26 @@
4849
# Plot result
4950
# -----------
5051
import matplotlib.pyplot as plt
51-
from itertools import cycle
5252

5353
plt.close("all")
5454
plt.figure(1)
5555
plt.clf()
5656

57-
colors = cycle("bgrcmykbgrcmykbgrcmykbgrcmyk")
57+
colors = plt.cycler("color", plt.cm.viridis(np.linspace(0, 1, 4)))
58+
5859
for k, col in zip(range(n_clusters_), colors):
5960
class_members = labels == k
6061
cluster_center = X[cluster_centers_indices[k]]
61-
plt.plot(X[class_members, 0], X[class_members, 1], col + ".")
62-
plt.plot(
63-
cluster_center[0],
64-
cluster_center[1],
65-
"o",
66-
markerfacecolor=col,
67-
markeredgecolor="k",
68-
markersize=14,
62+
plt.scatter(
63+
X[class_members, 0], X[class_members, 1], color=col["color"], marker="."
64+
)
65+
plt.scatter(
66+
cluster_center[0], cluster_center[1], s=14, color=col["color"], marker="o"
6967
)
7068
for x in X[class_members]:
71-
plt.plot([cluster_center[0], x[0]], [cluster_center[1], x[1]], col)
69+
plt.plot(
70+
[cluster_center[0], x[0]], [cluster_center[1], x[1]], color=col["color"]
71+
)
7272

7373
plt.title("Estimated number of clusters: %d" % n_clusters_)
7474
plt.show()
Binary file not shown.

dev/_downloads/91999ecc168932f9034d0cbc1cc248fa/plot_affinity_propagation.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"from sklearn.cluster import AffinityPropagation\nfrom sklearn import metrics\nfrom sklearn.datasets import make_blobs"
29+
"import numpy as np\n\nfrom sklearn.cluster import AffinityPropagation\nfrom sklearn import metrics\nfrom sklearn.datasets import make_blobs"
3030
]
3131
},
3232
{
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"import matplotlib.pyplot as plt\nfrom itertools import cycle\n\nplt.close(\"all\")\nplt.figure(1)\nplt.clf()\n\ncolors = cycle(\"bgrcmykbgrcmykbgrcmykbgrcmyk\")\nfor k, col in zip(range(n_clusters_), colors):\n class_members = labels == k\n cluster_center = X[cluster_centers_indices[k]]\n plt.plot(X[class_members, 0], X[class_members, 1], col + \".\")\n plt.plot(\n cluster_center[0],\n cluster_center[1],\n \"o\",\n markerfacecolor=col,\n markeredgecolor=\"k\",\n markersize=14,\n )\n for x in X[class_members]:\n plt.plot([cluster_center[0], x[0]], [cluster_center[1], x[1]], col)\n\nplt.title(\"Estimated number of clusters: %d\" % n_clusters_)\nplt.show()"
83+
"import matplotlib.pyplot as plt\n\nplt.close(\"all\")\nplt.figure(1)\nplt.clf()\n\ncolors = plt.cycler(\"color\", plt.cm.viridis(np.linspace(0, 1, 4)))\n\nfor k, col in zip(range(n_clusters_), colors):\n class_members = labels == k\n cluster_center = X[cluster_centers_indices[k]]\n plt.scatter(\n X[class_members, 0], X[class_members, 1], color=col[\"color\"], marker=\".\"\n )\n plt.scatter(\n cluster_center[0], cluster_center[1], s=14, color=col[\"color\"], marker=\"o\"\n )\n for x in X[class_members]:\n plt.plot(\n [cluster_center[0], x[0]], [cluster_center[1], x[1]], color=col[\"color\"]\n )\n\nplt.title(\"Estimated number of clusters: %d\" % n_clusters_)\nplt.show()"
8484
]
8585
}
8686
],

dev/_downloads/scikit-learn-docs.zip

-5.01 KB
Binary file not shown.
-3 Bytes
3.37 KB
5.72 KB
27 Bytes
-97 Bytes

0 commit comments

Comments
 (0)