Skip to content

Commit 9bd4214

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 3d16a21b6c9c6940509d98e5e0c030658f7c348c
1 parent 35df73f commit 9bd4214

File tree

1,241 files changed

+4410
-4437
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,241 files changed

+4410
-4437
lines changed
Binary file not shown.

dev/_downloads/5d2d581a4569eb0718dbdb8abf7cbbdf/plot_kmeans_assumptions.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
X, y = make_blobs(n_samples=n_samples, random_state=random_state)
2828

2929
# Incorrect number of clusters
30-
y_pred = KMeans(n_clusters=2, random_state=random_state).fit_predict(X)
30+
y_pred = KMeans(n_clusters=2, n_init="auto", random_state=random_state).fit_predict(X)
3131

3232
plt.subplot(221)
3333
plt.scatter(X[:, 0], X[:, 1], c=y_pred)
@@ -36,7 +36,9 @@
3636
# Anisotropicly distributed data
3737
transformation = [[0.60834549, -0.63667341], [-0.40887718, 0.85253229]]
3838
X_aniso = np.dot(X, transformation)
39-
y_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_aniso)
39+
y_pred = KMeans(n_clusters=3, n_init=10, random_state=random_state).fit_predict(
40+
X_aniso
41+
)
4042

4143
plt.subplot(222)
4244
plt.scatter(X_aniso[:, 0], X_aniso[:, 1], c=y_pred)
@@ -46,15 +48,19 @@
4648
X_varied, y_varied = make_blobs(
4749
n_samples=n_samples, cluster_std=[1.0, 2.5, 0.5], random_state=random_state
4850
)
49-
y_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_varied)
51+
y_pred = KMeans(n_clusters=3, n_init="auto", random_state=random_state).fit_predict(
52+
X_varied
53+
)
5054

5155
plt.subplot(223)
5256
plt.scatter(X_varied[:, 0], X_varied[:, 1], c=y_pred)
5357
plt.title("Unequal Variance")
5458

5559
# Unevenly sized blobs
5660
X_filtered = np.vstack((X[y == 0][:500], X[y == 1][:100], X[y == 2][:10]))
57-
y_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_filtered)
61+
y_pred = KMeans(n_clusters=3, n_init=10, random_state=random_state).fit_predict(
62+
X_filtered
63+
)
5864

5965
plt.subplot(224)
6066
plt.scatter(X_filtered[:, 0], X_filtered[:, 1], c=y_pred)
Binary file not shown.

dev/_downloads/b05e6cdf6d51481f37bf29b0bb92995e/plot_kmeans_assumptions.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"# Author: Phil Roth <[email protected]>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.cluster import KMeans\nfrom sklearn.datasets import make_blobs\n\nplt.figure(figsize=(12, 12))\n\nn_samples = 1500\nrandom_state = 170\nX, y = make_blobs(n_samples=n_samples, random_state=random_state)\n\n# Incorrect number of clusters\ny_pred = KMeans(n_clusters=2, random_state=random_state).fit_predict(X)\n\nplt.subplot(221)\nplt.scatter(X[:, 0], X[:, 1], c=y_pred)\nplt.title(\"Incorrect Number of Blobs\")\n\n# Anisotropicly distributed data\ntransformation = [[0.60834549, -0.63667341], [-0.40887718, 0.85253229]]\nX_aniso = np.dot(X, transformation)\ny_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_aniso)\n\nplt.subplot(222)\nplt.scatter(X_aniso[:, 0], X_aniso[:, 1], c=y_pred)\nplt.title(\"Anisotropicly Distributed Blobs\")\n\n# Different variance\nX_varied, y_varied = make_blobs(\n n_samples=n_samples, cluster_std=[1.0, 2.5, 0.5], random_state=random_state\n)\ny_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_varied)\n\nplt.subplot(223)\nplt.scatter(X_varied[:, 0], X_varied[:, 1], c=y_pred)\nplt.title(\"Unequal Variance\")\n\n# Unevenly sized blobs\nX_filtered = np.vstack((X[y == 0][:500], X[y == 1][:100], X[y == 2][:10]))\ny_pred = KMeans(n_clusters=3, random_state=random_state).fit_predict(X_filtered)\n\nplt.subplot(224)\nplt.scatter(X_filtered[:, 0], X_filtered[:, 1], c=y_pred)\nplt.title(\"Unevenly Sized Blobs\")\n\nplt.show()"
29+
"# Author: Phil Roth <[email protected]>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.cluster import KMeans\nfrom sklearn.datasets import make_blobs\n\nplt.figure(figsize=(12, 12))\n\nn_samples = 1500\nrandom_state = 170\nX, y = make_blobs(n_samples=n_samples, random_state=random_state)\n\n# Incorrect number of clusters\ny_pred = KMeans(n_clusters=2, n_init=\"auto\", random_state=random_state).fit_predict(X)\n\nplt.subplot(221)\nplt.scatter(X[:, 0], X[:, 1], c=y_pred)\nplt.title(\"Incorrect Number of Blobs\")\n\n# Anisotropicly distributed data\ntransformation = [[0.60834549, -0.63667341], [-0.40887718, 0.85253229]]\nX_aniso = np.dot(X, transformation)\ny_pred = KMeans(n_clusters=3, n_init=10, random_state=random_state).fit_predict(\n X_aniso\n)\n\nplt.subplot(222)\nplt.scatter(X_aniso[:, 0], X_aniso[:, 1], c=y_pred)\nplt.title(\"Anisotropicly Distributed Blobs\")\n\n# Different variance\nX_varied, y_varied = make_blobs(\n n_samples=n_samples, cluster_std=[1.0, 2.5, 0.5], random_state=random_state\n)\ny_pred = KMeans(n_clusters=3, n_init=\"auto\", random_state=random_state).fit_predict(\n X_varied\n)\n\nplt.subplot(223)\nplt.scatter(X_varied[:, 0], X_varied[:, 1], c=y_pred)\nplt.title(\"Unequal Variance\")\n\n# Unevenly sized blobs\nX_filtered = np.vstack((X[y == 0][:500], X[y == 1][:100], X[y == 2][:10]))\ny_pred = KMeans(n_clusters=3, n_init=10, random_state=random_state).fit_predict(\n X_filtered\n)\n\nplt.subplot(224)\nplt.scatter(X_filtered[:, 0], X_filtered[:, 1], c=y_pred)\nplt.title(\"Unevenly Sized Blobs\")\n\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/scikit-learn-docs.zip

12.9 KB
Binary file not shown.
-178 Bytes
-83 Bytes
-51 Bytes
-81 Bytes
-34 Bytes
80 Bytes
-4 Bytes
85 Bytes
-42 Bytes
2.45 KB
-236 Bytes
216 Bytes
-86 Bytes
6 Bytes
61 Bytes
-74 Bytes
81 Bytes
24 Bytes
2 Bytes
54 Bytes
14 Bytes
-305 Bytes
-84 Bytes
52 Bytes

dev/_sources/auto_examples/applications/plot_cyclical_feature_engineering.rst.txt

+1-1

dev/_sources/auto_examples/applications/plot_digits_denoising.rst.txt

+1-1

dev/_sources/auto_examples/applications/plot_face_recognition.rst.txt

+4-4

dev/_sources/auto_examples/applications/plot_model_complexity_influence.rst.txt

+15-15

dev/_sources/auto_examples/applications/plot_out_of_core_classification.rst.txt

+29-29

dev/_sources/auto_examples/applications/plot_outlier_detection_wine.rst.txt

+1-1

dev/_sources/auto_examples/applications/plot_prediction_latency.rst.txt

+1-1

0 commit comments

Comments
 (0)