An Open-Source Tool for Automatic Disease Diagnosis..

Overview

OpenMedicalChatbox

An Open-Source Package for Automatic Disease Diagnosis.

Overview

Due to the lack of open source for existing RL-base automated diagnosis methods. It's hard to make a comparison for different methods. OpenMedicalChatbox integrates several current diagnostic methods and datasets.

Dataset

At here, we show all the mentioned datasets in existing medical methods, including MZ-4, Dxy, MZ-10 and a simulated dataset based on Symcat. In goal.set in their folders, explicit symptoms, implicit symptoms and diagnosis given by doctors are recorded for each sample. Also, we provide the corresponding tools to extend them for each methods.

Here is the overview of datasets.

Name # of user goal # of diseases Ave. # of im. sym # of sym.
MZ-4 1,733 4 5.46 230
MZ-10 3,745 10 5.28 318
Dxy 527 5 1.67 41
SymCat-SD-90 30,000 90 2.60 266

Methods

Besides, we reproduce several mainstream models for comparison. For further information, you can refer to the paper.

  1. Flat-DQN: This is the baseline DQN agent, which has one layer policy and an action space including both symptoms and diseases.
  2. HRL-pretrained: This is a hierarchical model. The low level policy is pre-trained first and then the high level policy is trained. Besides, there is no disease classifier and the diagnosis is made by workers.
  3. REFUEL: This is a reinforcement learning method with reward shaping and feature rebuilding. It uses a branch to reconstruct the symptom vector to guide the policy gradient.
  4. KR-DS: This is an improved method based on Flat-DQN. It integrates a relational refinement branch and a knowledge-routed graph to strengthen the relationship between disease and symptoms. Here we adjust the code from fantasySE.
  5. GAMP: This is a GAN-based policy gradient network. It uses the GAN network to avoid generating randomized trials of symptom, and add mutual information to encourage the model to select the most discriminative symptoms.
  6. HRL: This is a new hierarchical policy we purposed for diagnosis. The high level policy consists of a master model that is responsible for triggering a low level model, the low level policy consists of several symptom checkers and a disease classifier. Also, we try not to divide symptoms into different group (Denoted as HRL (w/o grouped)) to demonstrate the strength of two-level structure and remove the separate disease discriminator (Denoted as HRL (w/o discriminator)) to show the effect of disease grouping in symptom information extraction.

Installation

  1. Install the packages
pip install OpenMedicalChatBox

or Cloning this repo

git clone https://github.com/Guardianzc/OpenMedicalChatBox.git
cd OpenMedicalChatBox
python setup.py install

After installation, you can try running demo.py to check if OpenMedicalChatBox works well

python demo.py
  1. Redirect the parameter file0 to the dataset needed. Note that if you use the KR-DS model, please redirect to "dataset_dxy" folder, and HRL dataset use the "HRL" folder.
  2. Tune the parameter as you need.
  3. Run the file or use the code below

Examples

The following code shows how to use OpenMedicalChatBox to apply different diagnosis method on datasets.

import OpenMedicalChatBox as OMCB
from warnings import simplefilter
simplefilter(action='ignore', category=FutureWarning)

HRL_test = OMCB.HRL(dataset_path = '.\Data\mz4\HRL\\', model_save_path = './simulate', groups = 2, model_load_path = './simulate', cuda_idx = 1, train_mode = True)
HRL_test.run()

KRDS_test = OMCB.KRDS(dataset_path = '.\Data\mz4\dataset_dxy\\', model_save_path = './simulate', model_load_path = './simulate', cuda_idx = 1, train_mode = True)
KRDS_test.run()


Flat_DQN_test = OMCB.Flat_DQN(dataset_path = '.\Data\mz4\\', model_save_path = './simulate',  model_load_path = './simulate', cuda_idx = 1, train_mode = True)
Flat_DQN_test.run()


GAMP_test = OMCB.GAMP(dataset_path = '.\Data\mz4\\', model_save_path = './simulate', model_load_path = './simulate', cuda_idx = 1, train_mode = True)
GAMP_test.run()

REFUEL_test = OMCB.REFUEL(dataset_path = '.\Data\mz4\\', model_save_path = './simulate', model_load_path = './simulate', cuda_idx = 0, train_mode = True)
REFUEL_test.run()

The detail experimental parameters are shown in here.

Experiment

We show the accuracy for disease diagnosis (Acc.), recall for symptom recovery (M.R.) and the average turns in interaction (Avg. T).

  • In real world dataset
Dxy MZ-4 MZ-10
Model Acc. M.R. Avg.T Acc. M.R. Avg.T Acc. M.R. Avg.T
Flat-DQN 0.731 0.110 1.96 0.681 0.062 1.27 0.408 0.047 9.75
KR-DS 0.740 0.399 5.65 0.678 0.177 4.61 0.485 0.279 5.95
REFUEL 0.721 0.186 3.11 0.716 0.215 5.01 0.505 0.262 5.50
GAMP 0.731 0.268 2.84 0.644 0.107 2.93 0.500 0.067 1.78
Classifier Lower Bound 0.682 -- -- 0.671 -- -- 0.532 -- --
HRL (w/o grouped) 0.731 0.297 6.61 0.689 0.004 2.25 0.540 0.114 4.59
HRL (w/o discriminator) -- 0.512 8.42 -- 0.233 5.71 -- 0.330 8.75
HRL 0.779 0.424 8.61 0.735 0.229 5.08 0.556 0.295 6.99
Classifier Upper Bound 0.846 -- -- 0.755 -- -- 0.612 -- --
  • In synthetic dataset
Model Acc. M.R. Avg.T
Flat-DQN 0.343 0.023 1.23
KR-DS 0.357 0.388 6.24
REFUEL 0.347 0.161 4.56
GAMP 0.267 0.077 1.36
Classifier Lower Bound 0.308 -- --
HRL-pretrained 0.452 -- 3.42
HRL 0.504 0.495 6.48
Classifier Upper Bound 0.781 -- --

Reference

Citation

Please cite our paper if you use toolkit

@article{liao2020task,
  title={Task-oriented dialogue system for automatic disease diagnosis via hierarchical reinforcement learning},
  author={Liao, Kangenbei and Liu, Qianlong and Wei, Zhongyu and Peng, Baolin and Chen, Qin and Sun, Weijian and Huang, Xuanjing},
  journal={arXiv preprint arXiv:2004.14254},
  year={2020}
}
Owner
School of Data Science, Fudan University
PyTorch implementation of "Representing Shape Collections with Alignment-Aware Linear Models" paper.

deep-linear-shapes PyTorch implementation of "Representing Shape Collections with Alignment-Aware Linear Models" paper. If you find this code useful i

Romain Loiseau 27 Sep 24, 2022
Pytorch implementation of BRECQ, ICLR 2021

BRECQ Pytorch implementation of BRECQ, ICLR 2021 @inproceedings{ li&gong2021brecq, title={BRECQ: Pushing the Limit of Post-Training Quantization by Bl

Yuhang Li 148 Dec 28, 2022
Compute execution plan: A DAG representation of work that you want to get done. Individual nodes of the DAG could be simple python or shell tasks or complex deeply nested parallel branches or embedded DAGs themselves.

Hello from magnus Magnus provides four capabilities for data teams: Compute execution plan: A DAG representation of work that you want to get done. In

12 Feb 08, 2022
COCO Style Dataset Generator GUI

A simple GUI-based COCO-style JSON Polygon masks' annotation tool to facilitate quick and efficient crowd-sourced generation of annotation masks and bounding boxes. Optionally, one could choose to us

Hans Krupakar 142 Dec 09, 2022
[ICLR 2021] HW-NAS-Bench: Hardware-Aware Neural Architecture Search Benchmark

HW-NAS-Bench: Hardware-Aware Neural Architecture Search Benchmark Accepted as a spotlight paper at ICLR 2021. Table of content File structure Prerequi

72 Jan 03, 2023
Mining-the-Social-Web-3rd-Edition - The official online compendium for Mining the Social Web, 3rd Edition (O'Reilly, 2018)

Mining the Social Web, 3rd Edition The official code repository for Mining the Social Web, 3rd Edition (O'Reilly, 2019). The book is available from Am

Mikhail Klassen 838 Jan 01, 2023
Optimal Adaptive Allocation using Deep Reinforcement Learning in a Dose-Response Study

Optimal Adaptive Allocation using Deep Reinforcement Learning in a Dose-Response Study Supplementary Materials for Kentaro Matsuura, Junya Honda, Imad

Kentaro Matsuura 4 Nov 01, 2022
Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation, available for both PyTorch and Tensorflow.

Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation, available for both PyTorch and Tensorflow.

730 Jan 09, 2023
Supervision Exists Everywhere: A Data Efficient Contrastive Language-Image Pre-training Paradigm

DeCLIP Supervision Exists Everywhere: A Data Efficient Contrastive Language-Image Pre-training Paradigm. Our paper is available in arxiv Updates ** Ou

Sense-GVT 470 Dec 30, 2022
A decent AI that solves daily Wordle puzzles. Works with different websites with similar wordlists,.

Wordle-AI A decent AI that solves daily "Wordle" puzzles. Works with different websites with similar wordlists. When prompted with "Word:" enter the w

Ethan 1 Feb 10, 2022
Capsule endoscopy detection DACON challenge

capsule_endoscopy_detection (DACON Challenge) Overview Yolov5, Yolor, mmdetection기반의 모델을 사용 (총 11개 모델 앙상블) 모든 모델은 학습 시 Pretrained Weight을 yolov5, yolo

MAILAB 11 Nov 25, 2022
Official Pytorch implementation of ICLR 2018 paper Deep Learning for Physical Processes: Integrating Prior Scientific Knowledge.

Deep Learning for Physical Processes: Integrating Prior Scientific Knowledge: Official Pytorch implementation of ICLR 2018 paper Deep Learning for Phy

emmanuel 47 Nov 06, 2022
GPT-Code-Clippy (GPT-CC) is an open source version of GitHub Copilot

GPT-Code-Clippy (GPT-CC) is an open source version of GitHub Copilot, a language model -- based on GPT-3, called GPT-Codex -- that is fine-tuned on publicly available code from GitHub.

2.3k Jan 09, 2023
Add-on for importing and auto setup of character creator 3 character exports.

CC3 Blender Tools An add-on for importing and automatically setting up materials for Character Creator 3 character exports. Using Blender in the Chara

260 Jan 05, 2023
Library for machine learning stacking generalization.

stacked_generalization Implemented machine learning *stacking technic[1]* as handy library in Python. Feature weighted linear stacking is also availab

114 Jul 19, 2022
Implementation of ECCV20 paper: the devil is in classification: a simple framework for long-tail object detection and instance segmentation

Implementation of our ECCV 2020 paper The Devil is in Classification: A Simple Framework for Long-tail Instance Segmentation This repo contains code o

twang 98 Sep 17, 2022
phylotorch-bito is a package providing an interface to BITO for phylotorch

phylotorch-bito phylotorch-bito is a package providing an interface to BITO for phylotorch Dependencies phylotorch BITO Installation Get the source co

Mathieu Fourment 2 Sep 01, 2022
Open standard for machine learning interoperability

Open Neural Network Exchange (ONNX) is an open ecosystem that empowers AI developers to choose the right tools as their project evolves. ONNX provides

Open Neural Network Exchange 13.9k Dec 30, 2022
Source code of article "Towards Toxic and Narcotic Medication Detection with Rotated Object Detector"

Towards Toxic and Narcotic Medication Detection with Rotated Object Detector Introduction This is the source code of article: Towards Toxic and Narcot

Woody. Wang 3 Oct 29, 2022
Source code for CVPR 2020 paper "Learning to Forget for Meta-Learning"

L2F - Learning to Forget for Meta-Learning Sungyong Baik, Seokil Hong, Kyoung Mu Lee Source code for CVPR 2020 paper "Learning to Forget for Meta-Lear

Sungyong Baik 29 May 22, 2022