Skip to content

Commit e057577

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

File tree

1,241 files changed

+4375
-4402
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

+4375
-4402
lines changed
Binary file not shown.

dev/_downloads/1e0968da80ca868bbdf21c1d0547f68c/plot_lle_digits.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
},
9999
"outputs": [],
100100
"source": [
101-
"from sklearn.decomposition import TruncatedSVD\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\nfrom sklearn.ensemble import RandomTreesEmbedding\nfrom sklearn.manifold import (\n Isomap,\n LocallyLinearEmbedding,\n MDS,\n SpectralEmbedding,\n TSNE,\n)\nfrom sklearn.neighbors import NeighborhoodComponentsAnalysis\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.random_projection import SparseRandomProjection\n\nembeddings = {\n \"Random projection embedding\": SparseRandomProjection(\n n_components=2, random_state=42\n ),\n \"Truncated SVD embedding\": TruncatedSVD(n_components=2),\n \"Linear Discriminant Analysis embedding\": LinearDiscriminantAnalysis(\n n_components=2\n ),\n \"Isomap embedding\": Isomap(n_neighbors=n_neighbors, n_components=2),\n \"Standard LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"standard\"\n ),\n \"Modified LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"modified\"\n ),\n \"Hessian LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"hessian\"\n ),\n \"LTSA LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"ltsa\"\n ),\n \"MDS embedding\": MDS(n_components=2, n_init=1, max_iter=120, n_jobs=2),\n \"Random Trees embedding\": make_pipeline(\n RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),\n TruncatedSVD(n_components=2),\n ),\n \"Spectral embedding\": SpectralEmbedding(\n n_components=2, random_state=0, eigen_solver=\"arpack\"\n ),\n \"t-SNE embeedding\": TSNE(\n n_components=2,\n n_iter=500,\n n_iter_without_progress=150,\n n_jobs=2,\n random_state=0,\n ),\n \"NCA embedding\": NeighborhoodComponentsAnalysis(\n n_components=2, init=\"pca\", random_state=0\n ),\n}"
101+
"from sklearn.decomposition import TruncatedSVD\nfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysis\nfrom sklearn.ensemble import RandomTreesEmbedding\nfrom sklearn.manifold import (\n Isomap,\n LocallyLinearEmbedding,\n MDS,\n SpectralEmbedding,\n TSNE,\n)\nfrom sklearn.neighbors import NeighborhoodComponentsAnalysis\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.random_projection import SparseRandomProjection\n\nembeddings = {\n \"Random projection embedding\": SparseRandomProjection(\n n_components=2, random_state=42\n ),\n \"Truncated SVD embedding\": TruncatedSVD(n_components=2),\n \"Linear Discriminant Analysis embedding\": LinearDiscriminantAnalysis(\n n_components=2\n ),\n \"Isomap embedding\": Isomap(n_neighbors=n_neighbors, n_components=2),\n \"Standard LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"standard\"\n ),\n \"Modified LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"modified\"\n ),\n \"Hessian LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"hessian\"\n ),\n \"LTSA LLE embedding\": LocallyLinearEmbedding(\n n_neighbors=n_neighbors, n_components=2, method=\"ltsa\"\n ),\n \"MDS embedding\": MDS(\n n_components=2, n_init=1, max_iter=120, n_jobs=2, normalized_stress=\"auto\"\n ),\n \"Random Trees embedding\": make_pipeline(\n RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),\n TruncatedSVD(n_components=2),\n ),\n \"Spectral embedding\": SpectralEmbedding(\n n_components=2, random_state=0, eigen_solver=\"arpack\"\n ),\n \"t-SNE embeedding\": TSNE(\n n_components=2,\n n_iter=500,\n n_iter_without_progress=150,\n n_jobs=2,\n random_state=0,\n ),\n \"NCA embedding\": NeighborhoodComponentsAnalysis(\n n_components=2, init=\"pca\", random_state=0\n ),\n}"
102102
]
103103
},
104104
{

dev/_downloads/3c9b7bcd0b16f172ac12ffad61f3b5f0/plot_stack_predictors.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"outputs": [],
4646
"source": [
47-
"import numpy as np\n\nfrom sklearn.datasets import fetch_openml\nfrom sklearn.utils import shuffle\n\n\ndef load_ames_housing():\n df = fetch_openml(name=\"house_prices\", as_frame=True, parser=\"pandas\")\n X = df.data\n y = df.target\n\n features = [\n \"YrSold\",\n \"HeatingQC\",\n \"Street\",\n \"YearRemodAdd\",\n \"Heating\",\n \"MasVnrType\",\n \"BsmtUnfSF\",\n \"Foundation\",\n \"MasVnrArea\",\n \"MSSubClass\",\n \"ExterQual\",\n \"Condition2\",\n \"GarageCars\",\n \"GarageType\",\n \"OverallQual\",\n \"TotalBsmtSF\",\n \"BsmtFinSF1\",\n \"HouseStyle\",\n \"MiscFeature\",\n \"MoSold\",\n ]\n\n X = X[features]\n X, y = shuffle(X, y, random_state=0)\n\n X = X[:600]\n y = y[:600]\n return X, np.log(y)\n\n\nX, y = load_ames_housing()"
47+
"import numpy as np\n\nfrom sklearn.datasets import fetch_openml\nfrom sklearn.utils import shuffle\n\n\ndef load_ames_housing():\n df = fetch_openml(name=\"house_prices\", as_frame=True, parser=\"pandas\")\n X = df.data\n y = df.target\n\n features = [\n \"YrSold\",\n \"HeatingQC\",\n \"Street\",\n \"YearRemodAdd\",\n \"Heating\",\n \"MasVnrType\",\n \"BsmtUnfSF\",\n \"Foundation\",\n \"MasVnrArea\",\n \"MSSubClass\",\n \"ExterQual\",\n \"Condition2\",\n \"GarageCars\",\n \"GarageType\",\n \"OverallQual\",\n \"TotalBsmtSF\",\n \"BsmtFinSF1\",\n \"HouseStyle\",\n \"MiscFeature\",\n \"MoSold\",\n ]\n\n X = X.loc[:,features]\n X, y = shuffle(X, y, random_state=0)\n\n X = X.iloc[:600]\n y = y.iloc[:600]\n return X, np.log(y)\n\n\nX, y = load_ames_housing()"
4848
]
4949
},
5050
{

dev/_downloads/4825fc8223d1af0f3b61080c3dea3a62/plot_faces_decomposition.py

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def plot_gallery(title, images, n_col=n_col, n_row=n_row, cmap=plt.cm.gray):
191191
batch_size=20,
192192
max_iter=50,
193193
random_state=rng,
194+
n_init="auto",
194195
)
195196
kmeans_estimator.fit(faces_centered)
196197
plot_gallery(

dev/_downloads/5d2d581a4569eb0718dbdb8abf7cbbdf/plot_kmeans_assumptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
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, n_init=10, random_state=random_state).fit_predict(
39+
y_pred = KMeans(n_clusters=3, n_init="auto", random_state=random_state).fit_predict(
4040
X_aniso
4141
)
4242

Binary file not shown.

dev/_downloads/9d97cc4ed755b7f2c7f9311bccc89a00/plot_lle_digits.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ def plot_embedding(X, title):
134134
"LTSA LLE embedding": LocallyLinearEmbedding(
135135
n_neighbors=n_neighbors, n_components=2, method="ltsa"
136136
),
137-
"MDS embedding": MDS(n_components=2, n_init=1, max_iter=120, n_jobs=2),
137+
"MDS embedding": MDS(
138+
n_components=2, n_init=1, max_iter=120, n_jobs=2, normalized_stress="auto"
139+
),
138140
"Random Trees embedding": make_pipeline(
139141
RandomTreesEmbedding(n_estimators=200, max_depth=5, random_state=0),
140142
TruncatedSVD(n_components=2),

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, 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()"
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=\"auto\", 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/c6ccb1a9c5f82321f082e9767a2706f3/plot_stack_predictors.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def load_ames_housing():
7272
"MoSold",
7373
]
7474

75-
X = X[features]
75+
X = X.loc[:,features]
7676
X, y = shuffle(X, y, random_state=0)
7777

78-
X = X[:600]
79-
y = y[:600]
78+
X = X.iloc[:600]
79+
y = y.iloc[:600]
8080
return X, np.log(y)
8181

8282

dev/_downloads/fcae36814d8e700024ca855a1eb87ca9/plot_faces_decomposition.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
},
185185
"outputs": [],
186186
"source": [
187-
"kmeans_estimator = cluster.MiniBatchKMeans(\n n_clusters=n_components,\n tol=1e-3,\n batch_size=20,\n max_iter=50,\n random_state=rng,\n)\nkmeans_estimator.fit(faces_centered)\nplot_gallery(\n \"Cluster centers - MiniBatchKMeans\",\n kmeans_estimator.cluster_centers_[:n_components],\n)"
187+
"kmeans_estimator = cluster.MiniBatchKMeans(\n n_clusters=n_components,\n tol=1e-3,\n batch_size=20,\n max_iter=50,\n random_state=rng,\n n_init=\"auto\",\n)\nkmeans_estimator.fit(faces_centered)\nplot_gallery(\n \"Cluster centers - MiniBatchKMeans\",\n kmeans_estimator.cluster_centers_[:n_components],\n)"
188188
]
189189
},
190190
{

dev/_downloads/scikit-learn-docs.zip

-486 Bytes
Binary file not shown.
-19 Bytes
40 Bytes
-25 Bytes
-21 Bytes
-2 Bytes
11 Bytes
-99 Bytes
-248 Bytes
-429 Bytes
250 Bytes
86 Bytes
155 Bytes
-2.13 KB
-430 Bytes
66 Bytes
26 Bytes
-113 Bytes
263 Bytes
121 Bytes
52 Bytes
149 Bytes
-102 Bytes
-76 Bytes
-2 Bytes
38 Bytes
72 Bytes
207 Bytes
320 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

+5-5

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

+15-15

0 commit comments

Comments
 (0)