2 duplicate pairs
#2
pinned
by
mkieffer
- opened
I was trying to map all the USMLE IDs back to their source MedQA questions and found that MedQA-USMLE contains a few duplicate pairs: rows that contain the same question and answer choice options, but with a different actual correct answer listed.
By running the sql query below in the open-patients HF data viewer
SELECT _id, description
FROM train
WHERE _id IN ('usmle-1100', 'usmle-1409', 'usmle-2038', 'usmle-2044')
LIMIT 100;
you will see two duplicate pairs that carried over into Open-Patients:
- ['usmle-1100', 'usmle-1409']
- ['usmle-2038', 'usmle-2044']
Here is the python code I used to find them:
from __future__ import annotations
import sys
from collections import defaultdict
from typing import Dict, List
from datasets import load_dataset
def main() -> int:
ds = load_dataset("ncbi/Open-Patients", split="train")
desc_to_ids: Dict[str, List[str]] = defaultdict(list)
for row in ds:
desc = row.get("description")
rec_id = row.get("_id")
if not isinstance(desc, str) or rec_id is None:
continue
desc_to_ids[desc].append(str(rec_id))
dup_count = 0
for desc, ids in desc_to_ids.items():
if len(ids) >= 2:
dup_count += 1
print(
f"duplicate_count={len(ids)} ids={ids}"
)
print(f"\nTotal duplicate description groups: {dup_count}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
qiaojin
pinned discussion