import pandas as pd import numpy as np import ast import os import sys ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(ROOT_DIR) from core.paper import Paper df = pd.read_csv('data/urls.csv', sep="\t") success = 0 total = 0 papers = [Paper.from_row(row) for _, row in df.iterrows()] def normalize_url(url): return url.strip().lower().rstrip("/") tp, fp, fn = 0, 0, 0 for paper in papers: if (paper.venue == "MICCAI"): continue urls_auto = [normalize_url(u) for u in paper.urls_auto] urls_manual = [normalize_url(u) for u in paper.urls_manual] auto_set = set(urls_auto) manual_set = set(urls_manual) tp += len(auto_set & manual_set) fp += len(auto_set - manual_set) fn += len(manual_set - auto_set) precision = tp / (tp + fp) if (tp + fp) > 0 else 0 recall = tp / (tp + fn) if (tp + fn) > 0 else 0 print(f"Precision: {precision:.3f}") print(f"Recall: {recall:.3f}")