Skip to content

Commit 4797a5c

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 8cac52f9d1a393f7809801405013b5e0d2785499
1 parent a3d94e3 commit 4797a5c

File tree

1,338 files changed

+6509
-5896
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,338 files changed

+6509
-5896
lines changed

dev/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 525147e589feee6feecd89a2eab08c49
3+
config: 5cf9cb0e11f67e076f45771c1870a2e7
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.

dev/_downloads/1dcd684ce26b8c407ec2c2d2101c5c73/plot_kernel_ridge_regression.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
"scoring": "neg_mean_squared_error",
204204
"negate_score": True,
205205
"score_name": "Mean Squared Error",
206+
"score_type": "test",
206207
"std_display_style": None,
207208
"ax": ax,
208209
}
Binary file not shown.

dev/_downloads/7996e584c563a930d174772f44af2089/plot_validation_curve.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.datasets import load_digits\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import validation_curve\n\nX, y = load_digits(return_X_y=True)\nsubset_mask = np.isin(y, [1, 2]) # binary classification: 1 vs 2\nX, y = X[subset_mask], y[subset_mask]\n\nparam_range = np.logspace(-6, -1, 5)\ntrain_scores, test_scores = validation_curve(\n SVC(),\n X,\n y,\n param_name=\"gamma\",\n param_range=param_range,\n scoring=\"accuracy\",\n n_jobs=2,\n)\ntrain_scores_mean = np.mean(train_scores, axis=1)\ntrain_scores_std = np.std(train_scores, axis=1)\ntest_scores_mean = np.mean(test_scores, axis=1)\ntest_scores_std = np.std(test_scores, axis=1)\n\nplt.title(\"Validation Curve with SVM\")\nplt.xlabel(r\"$\\gamma$\")\nplt.ylabel(\"Score\")\nplt.ylim(0.0, 1.1)\nlw = 2\nplt.semilogx(\n param_range, train_scores_mean, label=\"Training score\", color=\"darkorange\", lw=lw\n)\nplt.fill_between(\n param_range,\n train_scores_mean - train_scores_std,\n train_scores_mean + train_scores_std,\n alpha=0.2,\n color=\"darkorange\",\n lw=lw,\n)\nplt.semilogx(\n param_range, test_scores_mean, label=\"Cross-validation score\", color=\"navy\", lw=lw\n)\nplt.fill_between(\n param_range,\n test_scores_mean - test_scores_std,\n test_scores_mean + test_scores_std,\n alpha=0.2,\n color=\"navy\",\n lw=lw,\n)\nplt.legend(loc=\"best\")\nplt.show()"
18+
"import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom sklearn.datasets import load_digits\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import ValidationCurveDisplay\n\nX, y = load_digits(return_X_y=True)\nsubset_mask = np.isin(y, [1, 2]) # binary classification: 1 vs 2\nX, y = X[subset_mask], y[subset_mask]\n\ndisp = ValidationCurveDisplay.from_estimator(\n SVC(),\n X,\n y,\n param_name=\"gamma\",\n param_range=np.logspace(-6, -1, 5),\n score_type=\"both\",\n n_jobs=2,\n score_name=\"Accuracy\",\n)\ndisp.ax_.set_title(\"Validation Curve for SVM with an RBF kernel\")\ndisp.ax_.set_xlabel(r\"gamma (inverse radius of the RBF kernel)\")\ndisp.ax_.set_ylim(0.0, 1.1)\nplt.show()"
1919
]
2020
}
2121
],

dev/_downloads/9d2f119ab4a1b6f1454c43b796f2c6a6/plot_kernel_ridge_regression.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
},
134134
"outputs": [],
135135
"source": [
136-
"from sklearn.model_selection import LearningCurveDisplay\n\n_, ax = plt.subplots()\n\nsvr = SVR(kernel=\"rbf\", C=1e1, gamma=0.1)\nkr = KernelRidge(kernel=\"rbf\", alpha=0.1, gamma=0.1)\n\ncommon_params = {\n \"X\": X[:100],\n \"y\": y[:100],\n \"train_sizes\": np.linspace(0.1, 1, 10),\n \"scoring\": \"neg_mean_squared_error\",\n \"negate_score\": True,\n \"score_name\": \"Mean Squared Error\",\n \"std_display_style\": None,\n \"ax\": ax,\n}\n\nLearningCurveDisplay.from_estimator(svr, **common_params)\nLearningCurveDisplay.from_estimator(kr, **common_params)\nax.set_title(\"Learning curves\")\nax.legend(handles=ax.get_legend_handles_labels()[0], labels=[\"SVR\", \"KRR\"])\n\nplt.show()"
136+
"from sklearn.model_selection import LearningCurveDisplay\n\n_, ax = plt.subplots()\n\nsvr = SVR(kernel=\"rbf\", C=1e1, gamma=0.1)\nkr = KernelRidge(kernel=\"rbf\", alpha=0.1, gamma=0.1)\n\ncommon_params = {\n \"X\": X[:100],\n \"y\": y[:100],\n \"train_sizes\": np.linspace(0.1, 1, 10),\n \"scoring\": \"neg_mean_squared_error\",\n \"negate_score\": True,\n \"score_name\": \"Mean Squared Error\",\n \"score_type\": \"test\",\n \"std_display_style\": None,\n \"ax\": ax,\n}\n\nLearningCurveDisplay.from_estimator(svr, **common_params)\nLearningCurveDisplay.from_estimator(kr, **common_params)\nax.set_title(\"Learning curves\")\nax.legend(handles=ax.get_legend_handles_labels()[0], labels=[\"SVR\", \"KRR\"])\n\nplt.show()"
137137
]
138138
}
139139
],

dev/_downloads/d7ef5ff0bffa701d573ebc3ef124729a/plot_validation_curve.py

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,53 +18,23 @@
1818

1919
from sklearn.datasets import load_digits
2020
from sklearn.svm import SVC
21-
from sklearn.model_selection import validation_curve
21+
from sklearn.model_selection import ValidationCurveDisplay
2222

2323
X, y = load_digits(return_X_y=True)
2424
subset_mask = np.isin(y, [1, 2]) # binary classification: 1 vs 2
2525
X, y = X[subset_mask], y[subset_mask]
2626

27-
param_range = np.logspace(-6, -1, 5)
28-
train_scores, test_scores = validation_curve(
27+
disp = ValidationCurveDisplay.from_estimator(
2928
SVC(),
3029
X,
3130
y,
3231
param_name="gamma",
33-
param_range=param_range,
34-
scoring="accuracy",
32+
param_range=np.logspace(-6, -1, 5),
33+
score_type="both",
3534
n_jobs=2,
35+
score_name="Accuracy",
3636
)
37-
train_scores_mean = np.mean(train_scores, axis=1)
38-
train_scores_std = np.std(train_scores, axis=1)
39-
test_scores_mean = np.mean(test_scores, axis=1)
40-
test_scores_std = np.std(test_scores, axis=1)
41-
42-
plt.title("Validation Curve with SVM")
43-
plt.xlabel(r"$\gamma$")
44-
plt.ylabel("Score")
45-
plt.ylim(0.0, 1.1)
46-
lw = 2
47-
plt.semilogx(
48-
param_range, train_scores_mean, label="Training score", color="darkorange", lw=lw
49-
)
50-
plt.fill_between(
51-
param_range,
52-
train_scores_mean - train_scores_std,
53-
train_scores_mean + train_scores_std,
54-
alpha=0.2,
55-
color="darkorange",
56-
lw=lw,
57-
)
58-
plt.semilogx(
59-
param_range, test_scores_mean, label="Cross-validation score", color="navy", lw=lw
60-
)
61-
plt.fill_between(
62-
param_range,
63-
test_scores_mean - test_scores_std,
64-
test_scores_mean + test_scores_std,
65-
alpha=0.2,
66-
color="navy",
67-
lw=lw,
68-
)
69-
plt.legend(loc="best")
37+
disp.ax_.set_title("Validation Curve for SVM with an RBF kernel")
38+
disp.ax_.set_xlabel(r"gamma (inverse radius of the RBF kernel)")
39+
disp.ax_.set_ylim(0.0, 1.1)
7040
plt.show()

dev/_downloads/scikit-learn-docs.zip

39.4 KB
Binary file not shown.

dev/_images/learning_curve-1.png

6.7 KB

dev/_images/learning_curve-2.png

13.3 KB

0 commit comments

Comments
 (0)