This commit is contained in:
Glenn Jocher 2019-07-21 03:48:57 +02:00
parent 7d43ee0d02
commit 9f7e71acab
1 changed files with 2 additions and 2 deletions

View File

@ -327,8 +327,8 @@ def print_mutation(hyp, results):
os.system('gsutil cp gs://%s/evolve.txt .' % opt.bucket) # download evolve.txt os.system('gsutil cp gs://%s/evolve.txt .' % opt.bucket) # download evolve.txt
with open('evolve.txt', 'a') as f: # append result with open('evolve.txt', 'a') as f: # append result
f.write(c + b + '\n') f.write(c + b + '\n')
x = np.loadtxt('evolve.txt', ndmin=2) x = np.unique(np.loadtxt('evolve.txt', ndmin=2), axis=0) # load unique rows
np.savetxt('evolve.txt', x[np.argsort(-fitness(x))], '%11.3g') # save sorted by fitness np.savetxt('evolve2.txt', x[np.argsort(-fitness(x))] , '%11.3g') # save sort by fitness
os.system('gsutil cp evolve.txt gs://%s' % opt.bucket) # upload evolve.txt os.system('gsutil cp evolve.txt gs://%s' % opt.bucket) # upload evolve.txt
else: else:
with open('evolve.txt', 'a') as f: with open('evolve.txt', 'a') as f: