Skip to content

Commit a133a6e

Browse files
committed
Pushing the docs to dev/ for branch: main, commit dbde1da1954be91b9a0a12c9a109c17cd109bc76
1 parent c42d27f commit a133a6e

File tree

1,259 files changed

+4472
-4462
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,259 files changed

+4472
-4462
lines changed
Binary file not shown.

dev/_downloads/0af0092c704518874f82d38d725bb97f/plot_dict_face_patches.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"outputs": [],
5353
"source": [
54-
"import time\n\nimport numpy as np\n\nfrom sklearn.cluster import MiniBatchKMeans\nfrom sklearn.feature_extraction.image import extract_patches_2d\n\nprint(\"Learning the dictionary... \")\nrng = np.random.RandomState(0)\nkmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True, n_init=3)\npatch_size = (20, 20)\n\nbuffer = []\nt0 = time.time()\n\n# The online learning part: cycle over the whole dataset 6 times\nindex = 0\nfor _ in range(6):\n for img in faces.images:\n data = extract_patches_2d(img, patch_size, max_patches=50, random_state=rng)\n data = np.reshape(data, (len(data), -1))\n buffer.append(data)\n index += 1\n if index % 10 == 0:\n data = np.concatenate(buffer, axis=0)\n data -= np.mean(data, axis=0)\n data /= np.std(data, axis=0)\n kmeans.partial_fit(data)\n buffer = []\n if index % 100 == 0:\n print(\"Partial fit of %4i out of %i\" % (index, 6 * len(faces.images)))\n\ndt = time.time() - t0\nprint(\"done in %.2fs.\" % dt)"
54+
"import time\n\nimport numpy as np\n\nfrom sklearn.cluster import MiniBatchKMeans\nfrom sklearn.feature_extraction.image import extract_patches_2d\n\nprint(\"Learning the dictionary... \")\nrng = np.random.RandomState(0)\nkmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True)\npatch_size = (20, 20)\n\nbuffer = []\nt0 = time.time()\n\n# The online learning part: cycle over the whole dataset 6 times\nindex = 0\nfor _ in range(6):\n for img in faces.images:\n data = extract_patches_2d(img, patch_size, max_patches=50, random_state=rng)\n data = np.reshape(data, (len(data), -1))\n buffer.append(data)\n index += 1\n if index % 10 == 0:\n data = np.concatenate(buffer, axis=0)\n data -= np.mean(data, axis=0)\n data /= np.std(data, axis=0)\n kmeans.partial_fit(data)\n buffer = []\n if index % 100 == 0:\n print(\"Partial fit of %4i out of %i\" % (index, 6 * len(faces.images)))\n\ndt = time.time() - t0\nprint(\"done in %.2fs.\" % dt)"
5555
]
5656
},
5757
{
Binary file not shown.

dev/_downloads/7f205ae026a8c21fcab1e6a86cfadb7d/plot_dict_face_patches.py

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

4343
print("Learning the dictionary... ")
4444
rng = np.random.RandomState(0)
45-
kmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True, n_init=3)
45+
kmeans = MiniBatchKMeans(n_clusters=81, random_state=rng, verbose=True)
4646
patch_size = (20, 20)
4747

4848
buffer = []

dev/_downloads/c8db473878b6afea8e75e36dc828f109/plot_compare_methods.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
},
146146
"outputs": [],
147147
"source": [
148-
"md_scaling = manifold.MDS(\n n_components=n_components,\n max_iter=50,\n n_init=4,\n random_state=0,\n normalized_stress=False,\n)\nS_scaling = md_scaling.fit_transform(S_points)\n\nplot_2d(S_scaling, S_color, \"Multidimensional scaling\")"
148+
"md_scaling = manifold.MDS(\n n_components=n_components, max_iter=50, n_init=4, random_state=0\n)\nS_scaling = md_scaling.fit_transform(S_points)\n\nplot_2d(S_scaling, S_color, \"Multidimensional scaling\")"
149149
]
150150
},
151151
{

dev/_downloads/cda53b33015268619bc212d32b7000b9/plot_compare_methods.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,7 @@ def add_2d_scatter(ax, points, points_color, title=None):
163163
# Read more in the :ref:`User Guide <multidimensional_scaling>`.
164164

165165
md_scaling = manifold.MDS(
166-
n_components=n_components,
167-
max_iter=50,
168-
n_init=4,
169-
random_state=0,
170-
normalized_stress=False,
166+
n_components=n_components, max_iter=50, n_init=4, random_state=0
171167
)
172168
S_scaling = md_scaling.fit_transform(S_points)
173169

dev/_downloads/scikit-learn-docs.zip

9.01 KB
Binary file not shown.
-212 Bytes
-204 Bytes
65 Bytes

0 commit comments

Comments
 (0)