回答編集履歴
1
一部修正
answer
CHANGED
@@ -15,11 +15,11 @@
|
|
15
15
|
ap = []
|
16
16
|
for i in range(1000):
|
17
17
|
y_true = np.random.randint(0, 2, SIZE)
|
18
|
-
|
18
|
+
y_score = np.random.normal(0, 1, SIZE)
|
19
|
-
|
19
|
+
y_pred = np.where(y_score > 0.5, 1, 0)
|
20
|
-
prec.append(precision_score(y_true,
|
20
|
+
prec.append(precision_score(y_true, y_pred))
|
21
|
-
recall.append(recall_score(y_true,
|
21
|
+
recall.append(recall_score(y_true, y_pred))
|
22
|
-
ap.append(average_precision_score(y_true,
|
22
|
+
ap.append(average_precision_score(y_true, y_score))
|
23
23
|
|
24
24
|
_, ax = plt.subplots(1, 3)
|
25
25
|
ax[0].scatter(prec, recall, marker='.')
|