Skip to content

Commit badc589

Browse files
committed
Remove unused parameter
1 parent 77614ae commit badc589

File tree

1 file changed

+2
-45
lines changed

1 file changed

+2
-45
lines changed

label_tables.py

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ def normalize_table(table):
270270
PaperResult = namedtuple("PaperResult", ["arxiv_id", "model", "value", "normalized"])
271271

272272

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)
275275
tasks = get_sota_tasks(tasksfile)
276276
metadata, tables = get_tables(tables_dir)
277277

@@ -304,48 +304,5 @@ def label_tables(tasksfile, tables_dir, output, output_dir):
304304
out.mkdir(parents=True, exist_ok=True)
305305
best.to_csv(out / table.replace("table", "celltags"), header=None, index=None)
306306

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-
350307

351308
if __name__ == "__main__": fire.Fire(label_tables)

0 commit comments

Comments
 (0)