Edward J. Schwartz commited on
Commit ·
48b6277
1
Parent(s): 08c3539
dedup
Browse files125 unmodified lines126127128129129130131132133134135136137138139140141142143144145146141147148149150151152153148154155156157125 unmodified lines elif self.config.name in ["bylibrary", "bylibrarydedup"]: # A function (name) is a library function if it appears in more than one Exename
# this is (('func', 'oo.exe'): 123) # this is (('func', 'oo.exe')) testcount = set(zip(ds['Name'], ds['Exename']))
# (('func', 'path/oo.exe')) testcountfull = set(zip(ds['Name'], ds['Binary']))
# sorted pairs by function name testcount = sorted(testcount, key=lambda x: x[0]) testcountfull = sorted(testcountfull, key=lambda x: x[0])
# group by function name grouped = itertools.groupby(testcount, lambda t: t[0]) groupedfull = itertools.groupby(testcountfull, lambda t: t[0])
grouped = {k: [b for _,b in g] for k, g in grouped} groupedfull = {k: [b for _,b in g] for k, g in groupedfull}
library_func_names = {f for f, exes in grouped.items() if len(exes) > 1} library_func_names_dedup = {(f, exes[0]) for f, exes in grouped.items() if len(exes) > 1} library_func_names_dedup = {(f, exes[0]) for f, exes in groupedfull.items() if len(exes) > 1} nonlibrary_func_names = {f for f, exes in grouped.items() if len(exes) == 1}
train_filter_fun = None if self.config.name == "bylibrary": train_filter_fun = lambda r: r['Name'] in library_func_names elif self.config.name == "bylibrarydedup": train_filter_fun = lambda r: (r['Name'], r['Exename']) in library_func_names_dedup train_filter_fun = lambda r: (r['Name'], r['Binary']) in library_func_names_dedup else: assert False, "Invalid configuration"
oo-method-test-split.py+9-3