Edward J. Schwartz commited on
Commit ·
c164530
1
Parent(s): df293aa
Add bylibrarydedupall
Browse files40 unmodified lines41424344454647484973 unmodified lines1231241251261271281291301311321334 unmodified lines1381391401411421431441 unmodified line14614714814915015140 unmodified linesdatasets.BuilderConfig(name="bylibrarydedup",version=datasets.Version("1.0.0"),description="Split so that library functions (those appearing in >1 exe) are used for training, and non-library functions are used for testing. Only one example per function name is retained.",)]def __init__(self, *args, **kwargs):73 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)testcount = set(zip(ds['Name'], ds['Exename']))# sorted pairs by function nametestcount = sorted(testcount, key=lambda x: x[0])4 unmodified linesgrouped = {k: [b for _,b in g] for k, g in grouped}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}nonlibrary_func_names = {f for f, exes in grouped.items() if len(exes) == 1}train_filter_fun = None1 unmodified linetrain_filter_fun = lambda r: r['Name'] in library_func_nameselif self.config.name == "bylibrarydedup":train_filter_fun = lambda r: (r['Name'], r['Exename']) in library_func_names_dedupelse:assert False, "Invalid configuration"40 unmodified lines41424344454647484950515253545573 unmodified lines1291301311321331341351361371381394 unmodified lines1441451461471481491501511521531541551 unmodified line15715815916016116216316440 unmodified linesdatasets.BuilderConfig(name="bylibrarydedup",version=datasets.Version("1.0.0"),description="Split so that library functions (those appearing in >1 exe) are used for training, and non-library functions are used for testing. Only one example per function name is retained per program.",),datasets.BuilderConfig(name="bylibrarydedupall",version=datasets.Version("1.0.0"),description="Split so that library functions (those appearing in >1 exe) are used for training, and non-library functions are used for testing. Only one example per function name is retained.",)]def __init__(self, *args, **kwargs):73 unmodified lines]elif self.config.name in ["bylibrary", "bylibrarydedup", "bylibrarydedupall"]:# A function (name) is a library function if it appears in more than one Exename# this is (('func', 'oo.exe'): 123)testcount = set(zip(ds['Name'], zip(ds['Binary'], ds['Exename'])))# sorted pairs by function nametestcount = sorted(testcount, key=lambda x: x[0])4 unmodified linesgrouped = {k: [b for _,b in g] for k, g in grouped}library_func_names = {f for f, exes in grouped.items() if len(exes) > 1}# Exename# vlibrary_func_names_dedup = {(f, exes[0][1]) for f, exes in grouped.items() if len(exes) > 1}# Binary# vlibrary_func_names_dedup_all = {(f, exes[0][0]) for f, exes in grouped.items() if len(exes) > 1}nonlibrary_func_names = {f for f, exes in grouped.items() if len(exes) == 1}train_filter_fun = None1 unmodified linetrain_filter_fun = lambda r: r['Name'] in library_func_nameselif self.config.name == "bylibrarydedup":train_filter_fun = lambda r: (r['Name'], r['Exename']) in library_func_names_dedupelif self.config.name == "bylibrarydedupall":train_filter_fun = lambda r: (r['Name'], r['Binary']) in library_func_names_dedup_allelse:assert False, "Invalid configuration"
oo-method-test-split.py+16-3