|
148 | 148 | },
|
149 | 149 | "outputs": [],
|
150 | 150 | "source": [
|
151 |
| - "batch_pca_estimator = decomposition.MiniBatchSparsePCA(\n n_components=n_components, alpha=0.1, n_iter=100, batch_size=3, random_state=rng\n)\nbatch_pca_estimator.fit(faces_centered)\nplot_gallery(\n \"Sparse components - MiniBatchSparsePCA\",\n batch_pca_estimator.components_[:n_components],\n)" |
| 151 | + "batch_pca_estimator = decomposition.MiniBatchSparsePCA(\n n_components=n_components, alpha=0.1, max_iter=100, batch_size=3, random_state=rng\n)\nbatch_pca_estimator.fit(faces_centered)\nplot_gallery(\n \"Sparse components - MiniBatchSparsePCA\",\n batch_pca_estimator.components_[:n_components],\n)" |
152 | 152 | ]
|
153 | 153 | },
|
154 | 154 | {
|
|
166 | 166 | },
|
167 | 167 | "outputs": [],
|
168 | 168 | "source": [
|
169 |
| - "batch_dict_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components, alpha=0.1, n_iter=50, batch_size=3, random_state=rng\n)\nbatch_dict_estimator.fit(faces_centered)\nplot_gallery(\"Dictionary learning\", batch_dict_estimator.components_[:n_components])" |
| 169 | + "batch_dict_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components, alpha=0.1, max_iter=50, batch_size=3, random_state=rng\n)\nbatch_dict_estimator.fit(faces_centered)\nplot_gallery(\"Dictionary learning\", batch_dict_estimator.components_[:n_components])" |
170 | 170 | ]
|
171 | 171 | },
|
172 | 172 | {
|
|
252 | 252 | },
|
253 | 253 | "outputs": [],
|
254 | 254 | "source": [
|
255 |
| - "dict_pos_dict_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n n_iter=50,\n batch_size=3,\n random_state=rng,\n positive_dict=True,\n)\ndict_pos_dict_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive dictionary\",\n dict_pos_dict_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
| 255 | + "dict_pos_dict_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n max_iter=50,\n batch_size=3,\n random_state=rng,\n positive_dict=True,\n)\ndict_pos_dict_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive dictionary\",\n dict_pos_dict_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
256 | 256 | ]
|
257 | 257 | },
|
258 | 258 | {
|
|
270 | 270 | },
|
271 | 271 | "outputs": [],
|
272 | 272 | "source": [
|
273 |
| - "dict_pos_code_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n n_iter=50,\n batch_size=3,\n fit_algorithm=\"cd\",\n random_state=rng,\n positive_code=True,\n)\ndict_pos_code_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive code\",\n dict_pos_code_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
| 273 | + "dict_pos_code_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n max_iter=50,\n batch_size=3,\n fit_algorithm=\"cd\",\n random_state=rng,\n positive_code=True,\n)\ndict_pos_code_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive code\",\n dict_pos_code_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
274 | 274 | ]
|
275 | 275 | },
|
276 | 276 | {
|
|
288 | 288 | },
|
289 | 289 | "outputs": [],
|
290 | 290 | "source": [
|
291 |
| - "dict_pos_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n n_iter=50,\n batch_size=3,\n fit_algorithm=\"cd\",\n random_state=rng,\n positive_dict=True,\n positive_code=True,\n)\ndict_pos_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive dictionary & code\",\n dict_pos_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
| 291 | + "dict_pos_estimator = decomposition.MiniBatchDictionaryLearning(\n n_components=n_components,\n alpha=0.1,\n max_iter=50,\n batch_size=3,\n fit_algorithm=\"cd\",\n random_state=rng,\n positive_dict=True,\n positive_code=True,\n)\ndict_pos_estimator.fit(faces_centered)\nplot_gallery(\n \"Dictionary learning - positive dictionary & code\",\n dict_pos_estimator.components_[:n_components],\n cmap=plt.cm.RdBu,\n)" |
292 | 292 | ]
|
293 | 293 | }
|
294 | 294 | ],
|
|
0 commit comments