-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcounts_matrix.py
executable file
·82 lines (72 loc) · 2.12 KB
/
counts_matrix.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
#!/usr/bin/env python3
import sqlite3
con = sqlite3.connect("results.sqlite3")
cur = con.cursor()
def disagreement(
table, pred1_name, pred1_state, pred2_name, pred2_state, filename_changed
):
changed = "original<>changed" if filename_changed else "original=changed"
query = f"""
select
count(1)
from
(
select
distinct a,b,original
from
{table}
where
analysis = '{pred1_name}'
and prediction = '{pred1_state}'
and {changed}
) as pred1 join (
select
distinct a,b,original
from
{table}
where
analysis = '{pred2_name}'
and prediction = '{pred2_state}'
and {changed}
) as pred2 on
pred1.a = pred2.a
and pred1.b = pred2.b
and pred1.original = pred2.original
"""
cur.execute(query)
return cur.fetchone()
def run(table, predictors):
for fnc in (True, False):
print("filename {0:s}changed".format("" if fnc else "un"), "\n", "-" * 20)
for p1 in predictors:
print(p1)
padding = " "
for p2 in predictors:
print(padding, p2)
print(
padding,
*disagreement(table, p1, 1, p2, 1, filename_changed=fnc),
",",
end="",
)
print(
padding,
*disagreement(table, p1, 1, p2, 0, filename_changed=fnc),
",",
end="",
)
print(
padding,
*disagreement(table, p1, 0, p2, 1, filename_changed=fnc),
",",
end="",
)
print(
padding,
*disagreement(table, p1, 0, p2, 0, filename_changed=fnc),
)
print("\n")
predictors = ("missing-previously-found-exports", "abidiff")
run("two_predictors", predictors)
predictors = ("missing-previously-found-exports", "abidiff", "abi-compliance-tester")
run("three_predictors", predictors)