Skip to content

Commit 0974a0d

Browse files
committed
Pushing the docs to dev/ for branch: main, commit d61efb6363a159a783fa7bfa8610add892c7b83e
1 parent 08858ff commit 0974a0d

File tree

1,249 files changed

+4471
-4420
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,249 files changed

+4471
-4420
lines changed
Binary file not shown.

dev/_downloads/083d8568c199bebbc1a847fc6c917e9e/plot_kernel_approximation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"outputs": [],
7171
"source": [
72-
"# visualize the decision surface, projected down to the first\n# two principal components of the dataset\npca = PCA(n_components=8).fit(data_train)\n\nX = pca.transform(data_train)\n\n# Generate grid along first two principal components\nmultiples = np.arange(-2, 2, 0.1)\n# steps along first component\nfirst = multiples[:, np.newaxis] * pca.components_[0, :]\n# steps along second component\nsecond = multiples[:, np.newaxis] * pca.components_[1, :]\n# combine\ngrid = first[np.newaxis, :, :] + second[:, np.newaxis, :]\nflat_grid = grid.reshape(-1, data.shape[1])\n\n# title for the plots\ntitles = [\n \"SVC with rbf kernel\",\n \"SVC (linear kernel)\\n with Fourier rbf feature map\\nn_components=100\",\n \"SVC (linear kernel)\\n with Nystroem rbf feature map\\nn_components=100\",\n]\n\nplt.figure(figsize=(18, 7.5))\nplt.rcParams.update({\"font.size\": 14})\n# predict and plot\nfor i, clf in enumerate((kernel_svm, nystroem_approx_svm, fourier_approx_svm)):\n # Plot the decision boundary. For that, we will assign a color to each\n # point in the mesh [x_min, x_max]x[y_min, y_max].\n plt.subplot(1, 3, i + 1)\n Z = clf.predict(flat_grid)\n\n # Put the result into a color plot\n Z = Z.reshape(grid.shape[:-1])\n plt.contourf(multiples, multiples, Z, cmap=plt.cm.Paired)\n plt.axis(\"off\")\n\n # Plot also the training points\n plt.scatter(\n X[:, 0], X[:, 1], c=targets_train, cmap=plt.cm.Paired, edgecolors=(0, 0, 0)\n )\n\n plt.title(titles[i])\nplt.tight_layout()\nplt.show()"
72+
"# visualize the decision surface, projected down to the first\n# two principal components of the dataset\npca = PCA(n_components=8).fit(data_train)\n\nX = pca.transform(data_train)\n\n# Generate grid along first two principal components\nmultiples = np.arange(-2, 2, 0.1)\n# steps along first component\nfirst = multiples[:, np.newaxis] * pca.components_[0, :]\n# steps along second component\nsecond = multiples[:, np.newaxis] * pca.components_[1, :]\n# combine\ngrid = first[np.newaxis, :, :] + second[:, np.newaxis, :]\nflat_grid = grid.reshape(-1, data.shape[1])\n\n# title for the plots\ntitles = [\n \"SVC with rbf kernel\",\n \"SVC (linear kernel)\\n with Fourier rbf feature map\\nn_components=100\",\n \"SVC (linear kernel)\\n with Nystroem rbf feature map\\nn_components=100\",\n]\n\nplt.figure(figsize=(18, 7.5))\nplt.rcParams.update({\"font.size\": 14})\n# predict and plot\nfor i, clf in enumerate((kernel_svm, nystroem_approx_svm, fourier_approx_svm)):\n # Plot the decision boundary. For that, we will assign a color to each\n # point in the mesh [x_min, x_max]x[y_min, y_max].\n plt.subplot(1, 3, i + 1)\n Z = clf.predict(flat_grid)\n\n # Put the result into a color plot\n Z = Z.reshape(grid.shape[:-1])\n levels = np.arange(10)\n lv_eps = 0.01 # Adjust a mapping from calculated contour levels to color.\n plt.contourf(\n multiples,\n multiples,\n Z,\n levels=levels - lv_eps,\n cmap=plt.cm.tab10,\n vmin=0,\n vmax=10,\n alpha=0.7,\n )\n plt.axis(\"off\")\n\n # Plot also the training points\n plt.scatter(\n X[:, 0],\n X[:, 1],\n c=targets_train,\n cmap=plt.cm.tab10,\n edgecolors=(0, 0, 0),\n vmin=0,\n vmax=10,\n )\n\n plt.title(titles[i])\nplt.tight_layout()\nplt.show()"
7373
]
7474
}
7575
],
Binary file not shown.

dev/_downloads/e1de994d83a2eb57b73b2f69bb7ada4a/plot_kernel_approximation.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,29 @@
223223

224224
# Put the result into a color plot
225225
Z = Z.reshape(grid.shape[:-1])
226-
plt.contourf(multiples, multiples, Z, cmap=plt.cm.Paired)
226+
levels = np.arange(10)
227+
lv_eps = 0.01 # Adjust a mapping from calculated contour levels to color.
228+
plt.contourf(
229+
multiples,
230+
multiples,
231+
Z,
232+
levels=levels - lv_eps,
233+
cmap=plt.cm.tab10,
234+
vmin=0,
235+
vmax=10,
236+
alpha=0.7,
237+
)
227238
plt.axis("off")
228239

229240
# Plot also the training points
230241
plt.scatter(
231-
X[:, 0], X[:, 1], c=targets_train, cmap=plt.cm.Paired, edgecolors=(0, 0, 0)
242+
X[:, 0],
243+
X[:, 1],
244+
c=targets_train,
245+
cmap=plt.cm.tab10,
246+
edgecolors=(0, 0, 0),
247+
vmin=0,
248+
vmax=10,
232249
)
233250

234251
plt.title(titles[i])

dev/_downloads/scikit-learn-docs.zip

-30.2 KB
Binary file not shown.
-16 Bytes
178 Bytes
163 Bytes
-14 Bytes
-349 Bytes
8 Bytes
-121 Bytes
-6 Bytes
128 Bytes
47 Bytes
-2.33 KB
1.05 KB
-807 Bytes
-90 Bytes
-11 Bytes
-85 Bytes
-46 Bytes
-17 Bytes
-3 Bytes
124 Bytes
-14 Bytes
-70 Bytes
2 Bytes
-81 Bytes
-632 Bytes
-62 Bytes
-381 Bytes
530 Bytes
21 Bytes

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

Lines changed: 1 addition & 1 deletion

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

Lines changed: 1 addition & 1 deletion

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

Lines changed: 5 additions & 5 deletions

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

Lines changed: 14 additions & 14 deletions

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

Lines changed: 28 additions & 28 deletions

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

Lines changed: 1 addition & 1 deletion

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

Lines changed: 1 addition & 1 deletion

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

Lines changed: 2 additions & 2 deletions

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

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)