Skip to content

Commit 4d5d84b

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 968252dfb4c252e252614ae8736cc6b1ebdde9ee
1 parent 98a3f46 commit 4d5d84b

File tree

1,234 files changed

+4533
-3755
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,234 files changed

+4533
-3755
lines changed
Binary file not shown.

dev/_downloads/83c5d8e143d12d2f86db0941ce3ebf3d/plot_precision_recall.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,12 @@
134134
# Plot the Precision-Recall curve
135135
# ................................
136136
from sklearn.metrics import precision_recall_curve
137+
from sklearn.metrics import plot_precision_recall_curve
137138
import matplotlib.pyplot as plt
138-
from inspect import signature
139139

140-
precision, recall, _ = precision_recall_curve(y_test, y_score)
141-
142-
# In matplotlib < 1.5, plt.fill_between does not have a 'step' argument
143-
step_kwargs = ({'step': 'post'}
144-
if 'step' in signature(plt.fill_between).parameters
145-
else {})
146-
plt.step(recall, precision, color='b', alpha=0.2,
147-
where='post')
148-
plt.fill_between(recall, precision, alpha=0.2, color='b', **step_kwargs)
149-
150-
plt.xlabel('Recall')
151-
plt.ylabel('Precision')
152-
plt.ylim([0.0, 1.05])
153-
plt.xlim([0.0, 1.0])
154-
plt.title('2-class Precision-Recall curve: AP={0:0.2f}'.format(
155-
average_precision))
140+
disp = plot_precision_recall_curve(classifier, X_test, y_test)
141+
disp.ax_.set_title('2-class Precision-Recall curve: '
142+
'AP={0:0.2f}'.format(average_precision))
156143

157144
###############################################################################
158145
# In multi-label settings
@@ -212,10 +199,7 @@
212199
#
213200

214201
plt.figure()
215-
plt.step(recall['micro'], precision['micro'], color='b', alpha=0.2,
216-
where='post')
217-
plt.fill_between(recall["micro"], precision["micro"], alpha=0.2, color='b',
218-
**step_kwargs)
202+
plt.step(recall['micro'], precision['micro'], where='post')
219203

220204
plt.xlabel('Recall')
221205
plt.ylabel('Precision')
Binary file not shown.

dev/_downloads/db64bab280d64daf7aeb5f752c778be0/plot_precision_recall.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"outputs": [],
7171
"source": [
72-
"from sklearn.metrics import precision_recall_curve\nimport matplotlib.pyplot as plt\nfrom inspect import signature\n\nprecision, recall, _ = precision_recall_curve(y_test, y_score)\n\n# In matplotlib < 1.5, plt.fill_between does not have a 'step' argument\nstep_kwargs = ({'step': 'post'}\n if 'step' in signature(plt.fill_between).parameters\n else {})\nplt.step(recall, precision, color='b', alpha=0.2,\n where='post')\nplt.fill_between(recall, precision, alpha=0.2, color='b', **step_kwargs)\n\nplt.xlabel('Recall')\nplt.ylabel('Precision')\nplt.ylim([0.0, 1.05])\nplt.xlim([0.0, 1.0])\nplt.title('2-class Precision-Recall curve: AP={0:0.2f}'.format(\n average_precision))"
72+
"from sklearn.metrics import precision_recall_curve\nfrom sklearn.metrics import plot_precision_recall_curve\nimport matplotlib.pyplot as plt\n\ndisp = plot_precision_recall_curve(classifier, X_test, y_test)\ndisp.ax_.set_title('2-class Precision-Recall curve: '\n 'AP={0:0.2f}'.format(average_precision))"
7373
]
7474
},
7575
{
@@ -123,7 +123,7 @@
123123
},
124124
"outputs": [],
125125
"source": [
126-
"plt.figure()\nplt.step(recall['micro'], precision['micro'], color='b', alpha=0.2,\n where='post')\nplt.fill_between(recall[\"micro\"], precision[\"micro\"], alpha=0.2, color='b',\n **step_kwargs)\n\nplt.xlabel('Recall')\nplt.ylabel('Precision')\nplt.ylim([0.0, 1.05])\nplt.xlim([0.0, 1.0])\nplt.title(\n 'Average precision score, micro-averaged over all classes: AP={0:0.2f}'\n .format(average_precision[\"micro\"]))"
126+
"plt.figure()\nplt.step(recall['micro'], precision['micro'], where='post')\n\nplt.xlabel('Recall')\nplt.ylabel('Precision')\nplt.ylim([0.0, 1.05])\nplt.xlim([0.0, 1.0])\nplt.title(\n 'Average precision score, micro-averaged over all classes: AP={0:0.2f}'\n .format(average_precision[\"micro\"]))"
127127
]
128128
},
129129
{

dev/_downloads/scikit-learn-docs.pdf

36.5 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
433 Bytes
433 Bytes
34 Bytes
34 Bytes

0 commit comments

Comments
 (0)