-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprinter.py
54 lines (48 loc) · 1.53 KB
/
sprinter.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
from statter import LSHStatter, KDStatter, NOStatter, MSStatter
import datahelper as dh
from logger import printl, addLogFile, stacktrace
def getlsh(data):
allv = []
for t in dh.LSHTypeEnum.getValidTypes():
data.cfg['lshtype'] = t
nd = dh.Data(data.cfg)
try:
fs = LSHStatter(nd.getFoldedFiles('lshbenchfilepath'), nd)
allv.append(fs)
except:
allv.append(NOStatter(t.name.upper(), nd))
return allv
def getms(data):
allv = []
for t in dh.MSTypeEnum.getValidTypes():
data.cfg['mstype'] = t
nd = dh.Data(data.cfg)
try:
fs = MSStatter(nd.getFoldedFiles('msbenchfilepath'), nd)
allv.append(fs)
except:
allv.append(NOStatter(t.name.upper(), nd))
return allv
def printstats(stats):
if not isinstance(stats, list):
stats = [stats]
a = [
'headerline',
'Dim', 'Size', 'K', 'Var', 'NClus', 'IdxName',
'Cost', 'Average QueryTime', 'Average Calcs', 'Precision', 'Recall'
]
final = [a]
for s in stats:
if 'synthetic' in s.data.cfg:
c = s.data.cfg
a = [ 'statline',
c.D, c.S, c.K, c['variance'], c['nclus'], s.name,
s.cost, s.querytime, s.average, s.precision, s.recall]
final.append(a)
else:
pass ### TODO
for s in final:
printl('\t'.join([str(x) for x in s]))
# for s in final:
# print("\t".join([str(s) for s in s]))
return final