Skip to content

Commit 28d12ec

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 7ec1bfc2ab7425bcd984d631b5bfeb9082ce11bf
1 parent 18139ea commit 28d12ec

File tree

1,363 files changed

+4723
-4753
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,363 files changed

+4723
-4753
lines changed
Binary file not shown.

dev/_downloads/13db5212719118ea59532c291af3a8f9/plot_bisect_kmeans.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-
"import matplotlib.pyplot as plt\n\nfrom sklearn.datasets import make_blobs\nfrom sklearn.cluster import BisectingKMeans, KMeans\n\n\nprint(__doc__)\n\n\n# Generate sample data\nn_samples = 1000\nrandom_state = 0\n\nX, _ = make_blobs(n_samples=n_samples, centers=2, random_state=random_state)\n\n# Number of cluster centers for KMeans and BisectingKMeans\nn_clusters_list = [2, 3, 4, 5]\n\n# Algorithms to compare\nclustering_algorithms = {\n \"Bisecting K-Means\": BisectingKMeans,\n \"K-Means\": KMeans,\n}\n\n# Make subplots for each variant\nfig, axs = plt.subplots(\n len(clustering_algorithms), len(n_clusters_list), figsize=(15, 5)\n)\n\naxs = axs.T\n\nfor i, (algorithm_name, Algorithm) in enumerate(clustering_algorithms.items()):\n for j, n_clusters in enumerate(n_clusters_list):\n algo = Algorithm(n_clusters=n_clusters, random_state=random_state)\n algo.fit(X)\n centers = algo.cluster_centers_\n\n axs[j, i].scatter(X[:, 0], X[:, 1], s=10, c=algo.labels_)\n axs[j, i].scatter(centers[:, 0], centers[:, 1], c=\"r\", s=20)\n\n axs[j, i].set_title(f\"{algorithm_name} : {n_clusters} clusters\")\n\n\n# Hide x labels and tick labels for top plots and y ticks for right plots.\nfor ax in axs.flat:\n ax.label_outer()\n ax.set_xticks([])\n ax.set_yticks([])\n\nplt.show()"
29+
"import matplotlib.pyplot as plt\n\nfrom sklearn.datasets import make_blobs\nfrom sklearn.cluster import BisectingKMeans, KMeans\n\n\nprint(__doc__)\n\n\n# Generate sample data\nn_samples = 1000\nrandom_state = 0\n\nX, _ = make_blobs(n_samples=n_samples, centers=2, random_state=random_state)\n\n# Number of cluster centers for KMeans and BisectingKMeans\nn_clusters_list = [2, 3, 4, 5]\n\n# Algorithms to compare\nclustering_algorithms = {\n \"Bisecting K-Means\": BisectingKMeans,\n \"K-Means\": KMeans,\n}\n\n# Make subplots for each variant\nfig, axs = plt.subplots(\n len(clustering_algorithms), len(n_clusters_list), figsize=(15, 5)\n)\n\naxs = axs.T\n\nfor i, (algorithm_name, Algorithm) in enumerate(clustering_algorithms.items()):\n for j, n_clusters in enumerate(n_clusters_list):\n algo = Algorithm(n_clusters=n_clusters, random_state=random_state, n_init=3)\n algo.fit(X)\n centers = algo.cluster_centers_\n\n axs[j, i].scatter(X[:, 0], X[:, 1], s=10, c=algo.labels_)\n axs[j, i].scatter(centers[:, 0], centers[:, 1], c=\"r\", s=20)\n\n axs[j, i].set_title(f\"{algorithm_name} : {n_clusters} clusters\")\n\n\n# Hide x labels and tick labels for top plots and y ticks for right plots.\nfor ax in axs.flat:\n ax.label_outer()\n ax.set_xticks([])\n ax.set_yticks([])\n\nplt.show()"
3030
]
3131
}
3232
],
Binary file not shown.

dev/_downloads/73962cec5f14b10630f1a505fe761ab7/plot_bisect_kmeans.py

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

4545
for i, (algorithm_name, Algorithm) in enumerate(clustering_algorithms.items()):
4646
for j, n_clusters in enumerate(n_clusters_list):
47-
algo = Algorithm(n_clusters=n_clusters, random_state=random_state)
47+
algo = Algorithm(n_clusters=n_clusters, random_state=random_state, n_init=3)
4848
algo.fit(X)
4949
centers = algo.cluster_centers_
5050

dev/_downloads/scikit-learn-docs.zip

-14.5 KB
Binary file not shown.
-380 Bytes
1 Byte
-428 Bytes
-553 Bytes
-155 Bytes

0 commit comments

Comments
 (0)