-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathice_roc_with_sizes.py
103 lines (93 loc) · 7.9 KB
/
ice_roc_with_sizes.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import matplotlib.pyplot as plt
from sklearn.metrics import auc
# size = 25
tpr = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 0.9838709677419355, 0.9354838709677419, 0.9193548387096774, 0.9193548387096774,
0.8387096774193549, 0.7741935483870968, 0.6451612903225806, 0.5645161290322581, 0.4838709677419355,
0.45161290322580644, 0.4032258064516129, 0.3870967741935484, 0.3548387096774194, 0.3387096774193548,
0.3387096774193548, 0.25806451612903225, 0.20967741935483872, 0.14516129032258066, 0.11290322580645161,
0.06451612903225806, 0.016129032258064516, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
fpr = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.996268656716418, 0.9888059701492538,
0.9813432835820896, 0.9626865671641791, 0.9514925373134329, 0.9067164179104478, 0.8507462686567164,
0.8246268656716418, 0.7947761194029851, 0.75, 0.6604477611940298, 0.5746268656716418, 0.503731343283582,
0.4253731343283582, 0.376865671641791, 0.33955223880597013, 0.2574626865671642, 0.23134328358208955,
0.23134328358208955, 0.23134328358208955, 0.22388059701492538, 0.22388059701492538, 0.22014925373134328,
0.22014925373134328, 0.21641791044776118, 0.2126865671641791, 0.20522388059701493, 0.19029850746268656,
0.1791044776119403, 0.17164179104477612, 0.1417910447761194, 0.11567164179104478, 0.09328358208955224,
0.07462686567164178, 0.06343283582089553, 0.04477611940298507, 0.014925373134328358, 0.007462686567164179,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0]
plt.figure()
roc_auc = auc(fpr, tpr)
print('AUC: %f' % roc_auc)
plt.plot(fpr, tpr, label='Size = 25 with ROC = %f' % roc_auc)
# size = 50
tpr = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.967741935483871, 0.967741935483871,
0.967741935483871, 0.9354838709677419, 0.8870967741935484, 0.8548387096774194, 0.8225806451612904,
0.8225806451612904, 0.8064516129032258, 0.7580645161290323, 0.6612903225806451, 0.5806451612903226,
0.5806451612903226, 0.5, 0.46774193548387094, 0.46774193548387094, 0.43548387096774194, 0.43548387096774194,
0.41935483870967744, 0.41935483870967744, 0.4032258064516129, 0.3548387096774194, 0.3548387096774194,
0.2903225806451613, 0.25806451612903225, 0.1935483870967742, 0.0967741935483871, 0.0967741935483871,
0.08064516129032258, 0.016129032258064516, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0]
tpr = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.996268656716418,
0.996268656716418, 0.9850746268656716, 0.9701492537313433, 0.9701492537313433, 0.9440298507462687,
0.9104477611940298, 0.8731343283582089, 0.8432835820895522, 0.8432835820895522, 0.8059701492537313,
0.7798507462686567, 0.7574626865671642, 0.7238805970149254, 0.7238805970149254, 0.7164179104477612,
0.6865671641791045, 0.6455223880597015, 0.6268656716417911, 0.6268656716417911, 0.5895522388059702,
0.5485074626865671, 0.5223880597014925, 0.4701492537313433, 0.4701492537313433, 0.44402985074626866,
0.40671641791044777, 0.373134328358209, 0.34328358208955223, 0.34328358208955223, 0.2835820895522388,
0.23134328358208955, 0.19402985074626866, 0.1865671641791045, 0.1865671641791045, 0.17164179104477612,
0.15298507462686567, 0.1044776119402985, 0.08582089552238806, 0.08582089552238806, 0.05970149253731343,
0.022388059701492536, 0.0037313432835820895, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
roc_auc = auc(fpr, tpr)
print('AUC: %f' % roc_auc)
plt.plot(fpr, tpr, label='Size = 50 with ROC = %f' % roc_auc)
# size = 100
tpr = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.9838709677419355, 0.9838709677419355, 0.9838709677419355, 0.9838709677419355, 0.9838709677419355,
0.967741935483871, 0.967741935483871, 0.967741935483871, 0.967741935483871, 0.967741935483871,
0.7580645161290323, 0.7580645161290323, 0.7580645161290323, 0.7580645161290323, 0.7580645161290323,
0.5645161290322581, 0.5645161290322581, 0.5645161290322581, 0.5645161290322581, 0.5645161290322581,
0.24193548387096775, 0.24193548387096775, 0.24193548387096775, 0.24193548387096775, 0.24193548387096775,
0.06451612903225806, 0.06451612903225806, 0.06451612903225806, 0.06451612903225806, 0.06451612903225806,
0.016129032258064516, 0.016129032258064516, 0.016129032258064516, 0.016129032258064516, 0.016129032258064516]
fpr = [1.0, 1.0, 1.0, 1.0, 1.0, 0.996268656716418, 0.996268656716418, 0.996268656716418, 0.996268656716418,
0.996268656716418, 0.9925373134328358, 0.9925373134328358, 0.9925373134328358, 0.9925373134328358,
0.9925373134328358, 0.9626865671641791, 0.9626865671641791, 0.9626865671641791, 0.9626865671641791,
0.9626865671641791, 0.9589552238805971, 0.9589552238805971, 0.9589552238805971, 0.9589552238805971,
0.9589552238805971, 0.8470149253731343, 0.8470149253731343, 0.8470149253731343, 0.8470149253731343,
0.8470149253731343, 0.7425373134328358, 0.7425373134328358, 0.7425373134328358, 0.7425373134328358,
0.7425373134328358, 0.6156716417910447, 0.6156716417910447, 0.6156716417910447, 0.6156716417910447,
0.6156716417910447, 0.5335820895522388, 0.5335820895522388, 0.5335820895522388, 0.5335820895522388,
0.5335820895522388, 0.5, 0.5, 0.5, 0.5, 0.5, 0.48880597014925375, 0.48880597014925375, 0.48880597014925375,
0.48880597014925375, 0.48880597014925375, 0.43656716417910446, 0.43656716417910446, 0.43656716417910446,
0.43656716417910446, 0.43656716417910446, 0.373134328358209, 0.373134328358209, 0.373134328358209,
0.373134328358209, 0.373134328358209, 0.3208955223880597, 0.3208955223880597, 0.3208955223880597,
0.3208955223880597, 0.3208955223880597, 0.22014925373134328, 0.22014925373134328, 0.22014925373134328,
0.22014925373134328, 0.22014925373134328, 0.08955223880597014, 0.08955223880597014, 0.08955223880597014,
0.08955223880597014, 0.08955223880597014, 0.041044776119402986, 0.041044776119402986, 0.041044776119402986,
0.041044776119402986, 0.041044776119402986, 0.026119402985074626, 0.026119402985074626, 0.026119402985074626,
0.026119402985074626, 0.026119402985074626, 0.0037313432835820895, 0.0037313432835820895, 0.0037313432835820895,
0.0037313432835820895, 0.0037313432835820895, 0.0, 0.0, 0.0, 0.0, 0.0]
roc_auc = auc(fpr, tpr)
print('AUC: %f' % roc_auc)
plt.plot(fpr, tpr, label="Size = 100 with ROC = %f" % roc_auc)
plt.plot([0, 1], [0, 1], 'k--')
plt.xlim([0.0, 1.05])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.legend()
plt.title("Classification results with different square sizes")
# plt.title('ROC curve with AUC(%0.2f)' % roc_auc)
plt.show()