-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_roc.py
More file actions
32 lines (26 loc) · 827 Bytes
/
plot_roc.py
File metadata and controls
32 lines (26 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
# Load predictions
#y_actual = np.load(dhhd
# Load labels
#y_pred = np.load(dhfgs
y_actual = np.load("labels.np.npy")
y_pred = np.load("predictions.np.npy")
print(y_actual.shape)
y_pred = y_pred[:,:,0].reshape(1500)
print(y_pred.shape)
fpr, tpr, thresholds = roc_curve(y_actual, y_pred, pos_label = 1)
roc_auc = auc(fpr, tpr)
plt.figure()
lw = 2
plt.plot(fpr[2], tpr[2], color='darkorange',
lw=lw, label='ROC curve (area = %0.2f)' % roc_auc[2])
plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver operating characteristic example')
plt.legend(loc="lower right")
plt.save("fun")