This repository contains the implementation for "Neurosymbolic Approach to Improve Performance of Neural Diagnosis Systems Leveraging Pubmed Based Knowledge Graph" research.
This research introduces a neurosymbolic approach to improve the performance of neural diagnosis prediction systems. The key components include:
Our approach demonstrates significant improvements (16-67% in F1-score) across various neural models (MFLMs, LLMs, RAG) by augmenting them with structured medical knowledge.
kg_train*.ipynb: Notebooks for creating and training the knowledge graph using PubMed dataz-mimic-preprocessing/: Scripts for processing MIMIC-III/IV datasets
mimic-iv-processing.ipynb: Preprocessing pipeline for MIMIC-IV datamain2.ipynb: Main preprocessing pipeline for MIMIC-III dataALL_3_DIGITS_DIA_CODES.txt: List of 3-digit ICD-9 diagnosis codes usedz-mimic-3-files/: Contains processed MIMIC-III datasets
DIA_GROUPS_3_DIGITS_adm_train.csv: Training data with 3-digit ICD-9 codesDIA_GROUPS_3_DIGITS_adm_test.csv: Test dataDIA_GROUPS_3_DIGITS_adm_val.csv: Validation dataz-extracted-symptoms/: Extracted symptoms from clinical notes
mimic-3/: Symptoms extracted from MIMIC-III clinical notesmimic-4/: Symptoms extracted from MIMIC-IV clinical notesbiobert_finetune.py, biolink_finetune.py: Fine-tuning for BioBERT and BioLinkBERT modelsfine_tuning.ipynb: General fine-tuning notebookfine_tuning_llama.py: Fine-tuning script for LLaMA modelsfine_tuning_gemma.ipynb: Fine-tuning for Gemma modelsz-inference/: Scripts for model inference
infer.py, infer2.py: General inference scriptsmistral_inference*.py: Inference scripts for Mistral modelsMIMIC_3_4_CLRAG_PMKG_SYM_EHR.ipynb: Clinical RAG with PMKG inferencez-testing/: Testing and evaluation scripts
t-test.ipynb: Statistical testing for model comparisonz-HSDN-rebutttal-data/: Data files for baseline comparison with HSDN
z-old-test-data/: Legacy test data files
kg-setup.ipynb: Knowledge graph setup scriptdocker-compose.yml: Docker configurationcontainer-setup.ipynb: Container setup guideOur approach consists of three main components:
Knowledge Graph Construction: We build a PubMed-based Medical Knowledge Graph (PMKG) connecting symptoms from UMLS with diseases from ICD9-CM, using Neo4j.
Medical Model Fine-tuning: We fine-tune several medical language models (BioBERT, BioLinkBERT, CORe) on MIMIC-III data, using both extracted symptoms and clinical notes as input.
Neurosymbolic Inference: We combine the knowledge from PMKG with neural models' predictions to improve diagnosis accuracy:
Our neurosymbolic approach significantly improves the performance of various models:
The improvements are particularly significant for cases with multiple symptoms.
The project has several dependencies. Core requirements include:
fastapi==0.109.1
uvicorn==0.27.0
transformers==4.37.2
torch==2.2.0
pydantic==2.6.1
python-multipart==0.0.6
Additional dependencies needed for different components:
Knowledge Graph Construction:
Model Training:
Inference:
MIMIC Data Processing:
# Citation information will be added when published
Jupyter Notebook
98.9%
Python
1.1%
This repository contains the implementation for "Neurosymbolic Approach to Improve Performance of Neural Diagnosis Systems Leveraging Pubmed Based Knowledge Graph" research.
This research introduces a neurosymbolic approach to improve the performance of neural diagnosis prediction systems. The key components include:
Our approach demonstrates significant improvements (16-67% in F1-score) across various neural models (MFLMs, LLMs, RAG) by augmenting them with structured medical knowledge.
kg_train*.ipynb: Notebooks for creating and training the knowledge graph using PubMed dataz-mimic-preprocessing/: Scripts for processing MIMIC-III/IV datasets
mimic-iv-processing.ipynb: Preprocessing pipeline for MIMIC-IV datamain2.ipynb: Main preprocessing pipeline for MIMIC-III dataALL_3_DIGITS_DIA_CODES.txt: List of 3-digit ICD-9 diagnosis codes usedz-mimic-3-files/: Contains processed MIMIC-III datasets
DIA_GROUPS_3_DIGITS_adm_train.csv: Training data with 3-digit ICD-9 codesDIA_GROUPS_3_DIGITS_adm_test.csv: Test dataDIA_GROUPS_3_DIGITS_adm_val.csv: Validation dataz-extracted-symptoms/: Extracted symptoms from clinical notes
mimic-3/: Symptoms extracted from MIMIC-III clinical notesmimic-4/: Symptoms extracted from MIMIC-IV clinical notesbiobert_finetune.py, biolink_finetune.py: Fine-tuning for BioBERT and BioLinkBERT modelsfine_tuning.ipynb: General fine-tuning notebookfine_tuning_llama.py: Fine-tuning script for LLaMA modelsfine_tuning_gemma.ipynb: Fine-tuning for Gemma modelsz-inference/: Scripts for model inference
infer.py, infer2.py: General inference scriptsmistral_inference*.py: Inference scripts for Mistral modelsMIMIC_3_4_CLRAG_PMKG_SYM_EHR.ipynb: Clinical RAG with PMKG inferencez-testing/: Testing and evaluation scripts
t-test.ipynb: Statistical testing for model comparisonz-HSDN-rebutttal-data/: Data files for baseline comparison with HSDN
z-old-test-data/: Legacy test data files
kg-setup.ipynb: Knowledge graph setup scriptdocker-compose.yml: Docker configurationcontainer-setup.ipynb: Container setup guideOur approach consists of three main components:
Knowledge Graph Construction: We build a PubMed-based Medical Knowledge Graph (PMKG) connecting symptoms from UMLS with diseases from ICD9-CM, using Neo4j.
Medical Model Fine-tuning: We fine-tune several medical language models (BioBERT, BioLinkBERT, CORe) on MIMIC-III data, using both extracted symptoms and clinical notes as input.
Neurosymbolic Inference: We combine the knowledge from PMKG with neural models' predictions to improve diagnosis accuracy:
Our neurosymbolic approach significantly improves the performance of various models:
The improvements are particularly significant for cases with multiple symptoms.
The project has several dependencies. Core requirements include:
fastapi==0.109.1
uvicorn==0.27.0
transformers==4.37.2
torch==2.2.0
pydantic==2.6.1
python-multipart==0.0.6
Additional dependencies needed for different components:
Knowledge Graph Construction:
Model Training:
Inference:
MIMIC Data Processing:
# Citation information will be added when published
Jupyter Notebook
98.9%
Python
1.1%