GithubHelp home page GithubHelp logo

earlydrgprediction's Introduction

Early DRG Prediction and Cost Estimation

This repo contains code to make early DRG prediction and cost estimation on acute inpatients using MIMIC-III. Please raise any issue if there's any question.

Setup

The scripts in the repo were tested in Python 3.6.9, and mainly require packages including:

  • numpy==1.18.1
  • pandas==1.0.3
  • scikit-learn==0.22.2.post1
  • torch==1.4.0
  • gensim==3.8.3
  • nltk==3.4.5

Other versions may work as well. A full list of packages is in requirement.txt. After setting up the environment, one can edit the arguments in option.py or using command line to run the following codes to perform the experiments.

Prepare data

To create the DRG cohort for the experiments, run below. This will create cohorts for both MS-DRG and APR-DRG. To ensure the consistency of dataset splits, we provided stay ids for the test set that we evaluated in the paper for each cohort.

# create cohort -- will print the cohort statistics during processing
python create_cohort.py --data_dir $DATA_PATH --mimic_dir $MIMIC_PATH --threshold 48

The BioWordVec word embedding is used in the experiments. After downloading it to $EMBED_PATH, run the line below to preprocess the notes. We also include the selected embeddings and token-to-id dictionary for the two cohorts in data.

# preprocessing text for MS-DRG cohort 
python preprocessing.py --data_dir $DATA_PATH --pretrained_embed_dir $EMBED_PATH --word_min_freq 3 --cohort ms

# preprocessing text for MS-DRG cohort 
python preprocessing.py --data_dir $DATA_PATH --pretrained_embed_dir $EMBED_PATH --word_min_freq 3 --cohort apr

Training and Evaluation

The current experiment uses CAML, an attention-based CNN model, to predict early DRG. This would require GPU resource for computation, a device can be specified in the command line. The following code can be run to load the model checkpoint provided in checkpoints/$cohort to evaluate on the test set. We provided one model checkpoint for each cohort.

# evaluate on the MS-DRG cohort
python main.py --model CAML --single_kernel_size 5 --cnn_filter_maps 256 --cohort ms --eval_model $CHECKPOINT_PATH

# evaluate on the APR-DRG cohort
python main.py --model CAML --single_kernel_size 5 --cnn_filter_maps 256 --cohort apr --eval_model $CHECKPOINT_PATH

Or one can run the following commands to retrain the model and evaluate.

# run CAML on the MS-DRG cohort
python main.py --epochs 50 --patience 10 --max_seq_length 2000 --model CAML --single_kernel_size 5 --lr 1e-4 --wd 0 --cohort ms --device 0

# run CAML on the APR-DRG cohort
python main.py --epochs 50 --patience 10 --max_seq_length 2000 --model CAML --single_kernel_size 5 --lr 1e-4 --wd 0 --cohort ms --device 0

Acknowledgement

We would like to thank people who created the github repos to share the resources and code above.

earlydrgprediction's People

Contributors

jhliu7 avatar dependabot[bot] avatar ljinghui avatar

Stargazers

Bao Nguyen avatar Jonathan White, MD avatar  avatar  avatar  avatar Simon Šuster avatar Vector7  avatar  avatar  avatar  avatar  avatar Batuhan Bardak avatar Thanushi Peiris avatar

Watchers

 avatar

Forkers

andresjgcomfa

earlydrgprediction's Issues

本论文对drg分类为何使用多标签文本分类的模型caml

你好,我想请问您一下,CAML模型起初是用来进行ICD自动编码,属于多标签文本分类的问题,本论文的DRG预测按理说应该属于单标签文本分类,因为数据只有一个DRG标签,这种算是把多标签文本分类的方法应用到多标签文本分类上吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.