sileod commited on
Commit
8dcbe4e
·
verified ·
1 Parent(s): 672de9d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -442,3 +442,24 @@ configs:
442
  - split: test
443
  path: two_ev-graham/test-*
444
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  - split: test
443
  path: two_ev-graham/test-*
444
  ---
445
+
446
+ # Evaluation code:
447
+ ```python
448
+
449
+ def parse(x):
450
+ if '<answer>' in x and '</answer>' in x:
451
+ start = x.find('<answer>') + len('<answer>')
452
+ end = x.find('</answer>')
453
+ x = x[start:end]
454
+
455
+ lines = [i.lstrip('L').strip() for i in x.strip().strip('.').split(',')]
456
+ return [int(i) for i in lines if i.isnumeric()]
457
+
458
+ def jaccard(list1, list2):
459
+ intersection = len(list(set(list1).intersection(list2)))
460
+ union = (len(set(list1)) + len(set(list2))) - intersection
461
+ return float(intersection) / union
462
+
463
+ df['yp']=df.prompt.parallel_apply(complete_m(m,num_retries=5))
464
+ df['metric']=df.apply(lambda x: jaccard(parse(x.yp), x.evidence_indices), axis=1)
465
+ ```