dataset_info:
features:
- name: pubid
dtype: string
- name: question
dtype: string
- name: contexts_labels
list: string
- name: contexts
list: string
- name: long_answer
dtype: string
- name: tags
list: string
- name: final_decision
dtype: string
splits:
- name: pqaa
num_bytes: 445181053
num_examples: 211269
- name: pqal
num_bytes: 2060110
num_examples: 1000
- name: test
num_bytes: 1034634
num_examples: 500
download_size: 234895703
dataset_size: 448275797
configs:
- config_name: default
data_files:
- split: pqaa
path: data/pqaa-*
- split: pqal
path: data/pqal-*
- split: test
path: data/test-*
pubmedqa
PubmedQA dataset derived from the files contained or linked in the official pubmedqa repo: https://github.com/pubmedqa/pubmedqa
Dataset Explanation
(modified from https://huggingface.co/datasets/bigbio/pubmed_qa)
PubMedQA is a biomedical question answering (QA) dataset collected from PubMed abstracts. The task of PubMedQA is to answer research biomedical questions with yes/no/maybe using the corresponding abstracts. PubMedQA has 1k expert-annotated (PQA-L), 61.2k unlabeled (PQA-U) and 211.3k artificially generated QA instances (PQA-A).
Each PubMedQA instance is composed of: (1) a question which is either an existing research article title or derived from one, (2) a context which is the corresponding PubMed abstract without its conclusion, (3) a long answer, which is the conclusion of the abstract and, presumably, answers the research question, and (4) a yes/no/maybe answer which summarizes the conclusion.
PubMedQA is the first QA dataset where reasoning over biomedical research texts, especially their quantitative contents, is required to answer the questions.
The uploaded PubMedQA datasets comprise the following subsets:
- (1) PubMedQA Labeled (PQA-L): A labeled PubMedQA subset comprises of 1k manually annotated yes/no/maybe QA data collected from PubMed articles.
- (1b) PubMedQA Test Set: A 500 item subset of PQA-L used for model evaluation.
- (2) PubMedQA Artificial (PQA-A): An artificially labelled PubMedQA subset comprises of 211.3k PubMed articles with automatically generated questions from the statement titles and yes/no answer labels generated using a simple heuristic.
TBD: Questions were generated how?
Known Limitations
- Ambigious questions
- Abstracts may contian more or less informaiton of the results, and sometimes may even contain the result themselves.
- Scientific studies typically don't result in a perfect yes or no answer.
- Artificially generated content will vary a lot in quality.
Dataset Example Usage
from datasets import load_dataset
dataset = load_dataset("rschf/pubmedqa", split="test")
Dataset Postprocessing
This dataset is based on the following files contained or linked in the official pubmedqa repo:
ori_pqal.json- human annotated subsetori_pqaa.json- artificially labeled subsettest_groundtruth_json=r"test_ground_truth.json - pubmedids and human annotation labels for the 500 item subset from pqal used for testing
Code to reproduce the dataset based on those files:
import json
from datasets import Dataset, DatasetDict
def transform_into_ds(data_dict):
data_list = [
{
"pubid": pubid,
"question": entry["QUESTION"],
"contexts_labels": entry["LABELS"],
"contexts": entry["CONTEXTS"],
"long_answer": entry["LONG_ANSWER"],
"tags": entry["MESHES"],
"final_decision": entry["final_decision"],
}
for pubid, entry in data_dict.items()
]
return data_list
# from https://github.com/pubmedqa/pubmedqa/tree/master
pqal_json_fn=r"ori_pqal.json" # human annotated subset
pqaa_json_fn=r"ori_pqaa.json" # artificially labeled subset
# pubmedids and human annotation labels for the 500 item subset from pqal used for testing
test_groundtruth_json =r"test_ground_truth.json"
data_dict_pqal = json.load(open(pqal_json_fn))
data_dict_pqaa = json.load(open(pqaa_json_fn))
test_groundtruth = json.load(open(test_groundtruth_json))
# make sure ground truth agrees
for pubid, groundtruth in test_groundtruth.items():
assert data_dict_pqal[pubid]["final_decision"] == groundtruth, f"ground truth {groundtruth} does not match final_decision {data_dict_pqal[pubid]["final_decision"]} for pubid {pubid}"
test_pubids = list(test_groundtruth.keys());
data_list_pqaa = transform_into_ds(data_dict_pqaa)
data_list_pqal = transform_into_ds(data_dict_pqal)
data_list_test = transform_into_ds({k:v for k,v in data_dict_pqal.items() if k in test_pubids})
print("pqaa", len(data_list_pqaa), "\t", data_list_pqaa[0].keys())
print("pqal", len(data_list_pqal), "\t", data_list_pqal[0].keys())
print("test", len(data_list_test), "\t", data_list_test[0].keys())
# pqaa 211269 dict_keys(['pubid', 'question', 'contexts_labels', 'contexts', 'long_answer', 'tags', 'final_decision'])
# pqal 1000 dict_keys(['pubid', 'question', 'contexts_labels', 'contexts', 'long_answer', 'tags', 'final_decision'])
# test 500 dict_keys(['pubid', 'question', 'contexts_labels', 'contexts', 'long_answer', 'tags', 'final_decision'])
# 5. Create HF DatasetDict
ds = DatasetDict({
"pqaa": Dataset.from_list(data_list_pqaa),
"pqal": Dataset.from_list(data_list_pqal),
"test": Dataset.from_list(data_list_test)
})
from huggingface_hub import login
login(token="XXX")
# Push to HuggingFace Hub
ds.push_to_hub("rschf/pubmedqa")
Original Publication
@article{jin2019pubmedqa,
title={Pubmedqa: A dataset for biomedical research question answering},
author={Jin, Qiao and Dhingra, Bhuwan and Liu, Zhengping and Cohen, William W and Lu, Xinghua},
journal={arXiv preprint arXiv:1909.06146},
year={2019}
}