-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_volume_calculation.py
26 lines (23 loc) · 1.28 KB
/
test_volume_calculation.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
import numpy as np
from cwc.evaluation.abstaingaincurve import AbstainGainCurve
from cwc.evaluation.rgp import RGP
from cwc.evaluation.rgrpg import RGRPG
if __name__ == "__main__":
predicted_labels_python = np.genfromtxt("datasets/predicted_labels_python.csv", delimiter=",", skip_header=True)
step1_labels = predicted_labels_python[:, 4]
step1_scores = predicted_labels_python[:, 0]
step1_reject_scores = step1_scores[step1_labels == 0]
step1_training_scores = step1_scores[step1_labels == 1]
training_labels = 1 * (predicted_labels_python[:, 5][step1_labels == 1] == 1)
step2_training_scores = predicted_labels_python[:, 2][step1_labels == 1]
# rgp = RGP(step1_reject_scores, step1_training_scores, step2_training_scores, training_labels)
# rgp.plot()
# print "Gaintp area: " + str(rgp.calculate_area())
rgrpg = RGRPG(step1_reject_scores, step1_training_scores, step2_training_scores, training_labels)
rgrpg.plot_simple_3d()
# print "RGRPG volume: " + str(rgrpg.calculate_volume())
# rgrpg.plot_rgrpg_2d()
# rgrpg.plot_rgrpg_3d(n_recalls=50, n_points_roc=50)
# ag = AbstainGainCurve(step1_reject_scores, step1_training_scores, step2_training_scores, training_labels)
# ag.plot()
# print "Abstain-gain area: " + str(ag.calculate_area())