Code Monkey home page Code Monkey logo

mtgan's Introduction

MTGAN

Code for the paper: Multi-Label Clinical Time-Series Generation via Conditional GAN

Commands

Preprocess Data

  1. Go to https://mimic.physionet.org/ for access. Once you have the authority for the dataset, download the dataset and extract the csv files to {data_path}/mimic3/raw/ and {data_path}/mimic4/raw/.
  2. Check hyper-parameter settings:
python run_preprocess.py --help
  1. Run preprocess program:
  • For MIMIC-III
python run_preprocess.py --dataset mimic3 --train_num 6000
  • For MIMIC-IV
python run_preprocess.py --dataset mimic4 --train_num 6000 --sample_num 10000

Add --from_saved if you run it again and want to load saved encoded data.

Training MTGAN

  1. Check hyper-parameter setting:
python run_train.py --help
  1. Run training program
  • For MIMIC-III
python run_train.py --dataset mimic3
  • For MIMIC-IV
python run_train.py --dataset mimic4
  1. The parameters are saved in default at results/{dataset}/params/. The training plots are saved at results/{dataset}/records/.

Generating EHR data

  1. Check hyper-parameter setting:
python run_generate.py --help
  1. Run generating program
  • For MIMIC-III
python run_generate.py --dataset mimic3
  • For MIMIC-IV
python run_generate.py --dataset mimic4
  1. The generated data are saved at results/synthetic_{dataset}.npz.

Requirements:

Environment

  • Python >= 3.7
  • Virtualenv (optional, recommended)
  • CUDA (optional, recommended)
  • RAM > 16GB

Installing packages:

  • matplotlib
  • numpy
  • openpyxl
  • pandas
  • scipy
  • pytorch

mtgan's People

Contributors

luchang-cs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mtgan's Issues

Error when running preprocessing

I am trying to synthesise the MIMIC IV data with the help of your code and README instructions.

After downloading the mimic dataset to the data/mimic4/raw location and setting the path environment variables I run:

python run_preprocess.py --dataset mimic4 --train_num 6000 --sample_num 10000

And get the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'data/mimic4/raw/icd10-icd9.csv'

My directory structure is as follows:

image

Where is the icd10-icd9.csv file? I cannot find it in the mimic4 dataset.

Thank you already!

Reading the results

Hello,
I ran the code with MIMIC-4.
As result I got a npz file with some files x (a 3d array containing 0s and 1s) and lens.
How do I understand the results?

Thank you in advance!

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.