licesma commited on
Commit
2cfc97b
·
1 Parent(s): f94c0b8

Add column evaluator

Browse files
deepseek-coder-1.3b-instruct/extra/column_recall_evaluator.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def column_recall_score(expected: pd.DataFrame, generated: pd.DataFrame) -> float:
4
+ if expected.shape[0] != generated.shape[0]:
5
+ return 0.0
6
+
7
+ matched = 0
8
+ used_columns = set()
9
+
10
+ for exp_col in expected.columns:
11
+ found = False
12
+
13
+ for gen_col in generated.columns:
14
+ if gen_col in used_columns:
15
+ continue
16
+
17
+ if expected[exp_col].equals(generated[gen_col]):
18
+ matched += 1
19
+ used_columns.add(gen_col)
20
+ found = True
21
+ break
22
+
23
+ total = expected.shape[1]
24
+ return matched / total if total > 0 else 0.0