@@ -270,8 +270,8 @@ def normalize_table(table):
270
270
PaperResult = namedtuple ("PaperResult" , ["arxiv_id" , "model" , "value" , "normalized" ])
271
271
272
272
273
- def label_tables (tasksfile , tables_dir , output , output_dir ):
274
- output_dir = Path (output_dir )
273
+ def label_tables (tasksfile , tables_dir ):
274
+ output_dir = Path (tables_dir )
275
275
tasks = get_sota_tasks (tasksfile )
276
276
metadata , tables = get_tables (tables_dir )
277
277
@@ -304,48 +304,5 @@ def label_tables(tasksfile, tables_dir, output, output_dir):
304
304
out .mkdir (parents = True , exist_ok = True )
305
305
best .to_csv (out / table .replace ("table" , "celltags" ), header = None , index = None )
306
306
307
- return
308
- tables_with_sota = []
309
- for task in tasks :
310
- for dataset in task .datasets :
311
- for row in dataset .sota .rows :
312
- # TODO: some results have more than one url, CoRR + journal / conference
313
- # check if we have the same results for both
314
-
315
- match = arxiv_url_re .match (row .paper_url )
316
- if match is not None :
317
- arxiv_id = match .group ("arxiv_id" )
318
- if arxiv_id not in tables :
319
- print (f"No tables for { arxiv_id } . Skipping" , file = sys .stderr )
320
- continue
321
-
322
- for metric in row .metrics :
323
- #print(f"{metric}\t{row.metrics[metric]}")
324
- #print((task.name, dataset.name, metric, row.model_name, row.metrics[metric], row.paper_url))
325
- matching = match_metric (metric , tables [arxiv_id ], row .metrics [metric ])
326
- if len (matching ) == 1 :
327
- sota_table = matching [0 ]
328
-
329
- tables_with_sota .append (
330
- dict (
331
- task_name = task .name ,
332
- dataset_name = dataset .name ,
333
- metric_name = metric ,
334
- model_name = row .model_name ,
335
- metric_value = row .metrics [metric ],
336
- paper_url = row .paper_url ,
337
- table_caption = metadata [arxiv_id ][sota_table ],
338
- table_filename = f"{ arxiv_id } /{ sota_table } "
339
- )
340
- )
341
- #if not matching:
342
- # print(f"{metric}, {row.metrics[metric]}, {arxiv_id}")
343
- #print(f"{metric},{len(matching)}")
344
- #if matching:
345
- # print((task.name, dataset.name, metric, row.model_name, row.metrics[metric], row.paper_url))
346
- # print(matching)
347
- pd .DataFrame (tables_with_sota ).to_csv (output , index = None )
348
-
349
-
350
307
351
308
if __name__ == "__main__" : fire .Fire (label_tables )
0 commit comments