Skip to content

Commit a2ed762

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 62389681eafb4609b70426c81b0223e8bcea9d2a
1 parent ebc9ee8 commit a2ed762

File tree

1,308 files changed

+5311
-5234
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,308 files changed

+5311
-5234
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: c9da83efc9c0f30360059804b16051bb
3+
config: cefd20e7a39e300ce7585bca4d46d63f
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Binary file not shown.

dev/_downloads/764d061a261a2e06ad21ec9133361b2d/plot_precision_recall.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
"outputs": [],
6060
"source": [
61-
"from sklearn.metrics import PrecisionRecallDisplay\n\ndisplay = PrecisionRecallDisplay.from_estimator(\n classifier, X_test, y_test, name=\"LinearSVC\"\n)\n_ = display.ax_.set_title(\"2-class Precision-Recall curve\")"
61+
"from sklearn.metrics import PrecisionRecallDisplay\n\ndisplay = PrecisionRecallDisplay.from_estimator(\n classifier, X_test, y_test, name=\"LinearSVC\", plot_chance_level=True\n)\n_ = display.ax_.set_title(\"2-class Precision-Recall curve\")"
6262
]
6363
},
6464
{
@@ -76,7 +76,7 @@
7676
},
7777
"outputs": [],
7878
"source": [
79-
"y_score = classifier.decision_function(X_test)\n\ndisplay = PrecisionRecallDisplay.from_predictions(y_test, y_score, name=\"LinearSVC\")\n_ = display.ax_.set_title(\"2-class Precision-Recall curve\")"
79+
"y_score = classifier.decision_function(X_test)\n\ndisplay = PrecisionRecallDisplay.from_predictions(\n y_test, y_score, name=\"LinearSVC\", plot_chance_level=True\n)\n_ = display.ax_.set_title(\"2-class Precision-Recall curve\")"
8080
]
8181
},
8282
{
@@ -148,7 +148,7 @@
148148
},
149149
"outputs": [],
150150
"source": [
151-
"display = PrecisionRecallDisplay(\n recall=recall[\"micro\"],\n precision=precision[\"micro\"],\n average_precision=average_precision[\"micro\"],\n)\ndisplay.plot()\n_ = display.ax_.set_title(\"Micro-averaged over all classes\")"
151+
"from collections import Counter\n\ndisplay = PrecisionRecallDisplay(\n recall=recall[\"micro\"],\n precision=precision[\"micro\"],\n average_precision=average_precision[\"micro\"],\n prevalence_pos_label=Counter(Y_test.ravel())[1] / Y_test.size,\n)\ndisplay.plot(plot_chance_level=True)\n_ = display.ax_.set_title(\"Micro-averaged over all classes\")"
152152
]
153153
},
154154
{

dev/_downloads/98161c8b335acb98de356229c1005819/plot_precision_recall.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
from sklearn.metrics import PrecisionRecallDisplay
143143

144144
display = PrecisionRecallDisplay.from_estimator(
145-
classifier, X_test, y_test, name="LinearSVC"
145+
classifier, X_test, y_test, name="LinearSVC", plot_chance_level=True
146146
)
147147
_ = display.ax_.set_title("2-class Precision-Recall curve")
148148

@@ -152,7 +152,9 @@
152152
# :func:`~sklearn.metrics.PrecisionRecallDisplay.from_predictions`.
153153
y_score = classifier.decision_function(X_test)
154154

155-
display = PrecisionRecallDisplay.from_predictions(y_test, y_score, name="LinearSVC")
155+
display = PrecisionRecallDisplay.from_predictions(
156+
y_test, y_score, name="LinearSVC", plot_chance_level=True
157+
)
156158
_ = display.ax_.set_title("2-class Precision-Recall curve")
157159

158160
# %%
@@ -214,12 +216,15 @@
214216
# %%
215217
# Plot the micro-averaged Precision-Recall curve
216218
# ..............................................
219+
from collections import Counter
220+
217221
display = PrecisionRecallDisplay(
218222
recall=recall["micro"],
219223
precision=precision["micro"],
220224
average_precision=average_precision["micro"],
225+
prevalence_pos_label=Counter(Y_test.ravel())[1] / Y_test.size,
221226
)
222-
display.plot()
227+
display.plot(plot_chance_level=True)
223228
_ = display.ax_.set_title("Micro-averaged over all classes")
224229

225230
# %%

dev/_downloads/scikit-learn-docs.zip

9.61 KB
Binary file not shown.
-347 Bytes
-286 Bytes
-238 Bytes
-271 Bytes

0 commit comments

Comments
 (0)