You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add reporting top-level config object, and taxonomy variable for it
* move report_dir config into reporting config
* move report_prefix config item to reporting config
* update report html to support flexible grouping by top-level tag
* presentation tweaks, add second-order sorts
f"insert into results values ('{pm}', '{pc}', '{detector}', '{score}', '{instances}')"
97
-
)
96
+
groups= []
97
+
iftaxonomyisnotNone:
98
+
# get the probe tags
99
+
m=importlib.import_module(f"garak.probes.{pm}")
100
+
tags=getattr(m, pc).tags
101
+
fortagintags:
102
+
iftag.split(":")[0] ==taxonomy:
103
+
groups.append(":".join(tag.split(":")[1:]))
104
+
ifgroups== []:
105
+
groups= ["other"]
106
+
else:
107
+
groups= [pm]
108
+
# add a row for each group
109
+
forgroupingroups:
110
+
cursor.execute(
111
+
f"insert into results values ('{pm}', '{group}', '{pc}', '{detector}', '{score}', '{instances}')"
112
+
)
98
113
99
114
# calculate per-probe scores
100
115
101
-
res=cursor.execute("select distinct probe_module from results")
102
-
module_names= [i[0] foriinres.fetchall()]
116
+
res=cursor.execute(
117
+
"select distinct probe_group from results order by probe_group"
118
+
)
119
+
group_names= [i[0] foriinres.fetchall()]
103
120
104
121
# top score: % of passed probes
105
122
# probe score: mean of detector scores
106
123
107
124
# let's build a dict of per-probe score
108
125
109
-
forprobe_moduleinmodule_names:
110
-
sql=f"select avg(score)*100 as s from results where probe_module = '{probe_module}' order by s asc;"
126
+
forprobe_groupingroup_names:
127
+
sql=f"select avg(score)*100 as s from results where probe_group = '{probe_group}' order by s asc, probe_class asc;"
111
128
# sql = f"select probe_module || '.' || probe_class, avg(score) as s from results where probe_module = '{probe_module}' group by probe_module, probe_class order by desc(s)"
f"select probe_class, avg(score)*100 as s from results where probe_module='{probe_module}' group by probe_class order by s asc;"
164
+
f"select probe_module, probe_class, avg(score)*100 as s from results where probe_group='{probe_group}' group by probe_class order by s asc, probe_class asc;"
0 commit comments