Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import os
  2.  
  3. import _pickle as cPickle
  4. os.chdir('C://Users//DK//DATA1')
  5. from collections import defaultdict
  6. import numpy as np
  7. ans = defaultdict(list)
  8. for folder in os.listdir(os.getcwd()):
  9. if True:#'Out' in folder:
  10. for file in os.listdir(folder):
  11. if '.pkl' in file:
  12. results= cPickle.load(open(folder+'/'+file,'rb'))
  13. if 'sts' in file:
  14. max_key='spearman'
  15. elif 'mrpc' in file or 'qqp' in file:
  16. max_key = 'eval_f1'
  17. else:
  18. max_key='eval_accuracy'
  19. max_results = [ sum(results[j][max_key])/len(results[j][max_key]) for j in range(len(results))]
  20. ans[file].append(np.argmax(max_results))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement