def createLists(dbFilename):
print('Splitting RIRs into sets...')
sets = [
RirSet('train', 0.8),
RirSet('test', 0.1),
RirSet('dev', 0.1),
]
# open database
rirDb = json.load(open(dbFilename))
rirs = sorted(list(rirDb.keys()))
# to distribute the RIRs to the set we could to a shuffle, but as they are in alphabetical order and just going over them guaranties that we distribute the different conditions (mostly) equally on the different sets
sets[0].add(rirs[0])
for i in range(1, len(rirs)):
si = np.argmin([s.missing(i) for s in sets])
sets[si].add(rirs[i])
# safe set files
util.createDirectory(ListDir)
for s in sets:
s.save(ListDir)
评论列表
文章目录