Code Monkey home page Code Monkey logo

kg-miml-net's Introduction

KG-MIML-Net

Knowledge Guided Multi-instance Multi-label Learning via Neural Networks in Medicines Prediction

Paper has been accepted in ACML, 2018 and paper link will be released later.

Overview

This repository contains code necessary to run KG-MIML-Net model. KG-MIML-Net is mainly based on RNN encoder-decoder, and two additional knowledge, i.e., structural knowledge and contextual knowledge are combined to improve performance on medicines prediction task. KG-MIML-Net is tested on real-world clinical dataset MIMIC-III containing more than 40,000 patients and demonstrates its effectiveness compared with several state-of-the-art methods in MIML learning and heathcare area.

Requirements

  • Pytorch >=0.4
  • Python >=3.5

Running the code

Data preprocessing

It's the toughest thing to prepare the fuel for the model. Fortunately, you can find the preprocessing code called create_data.py in ./data. But some data is missing because of the regulation of MIMIC-III like DIAGNOSES_ICD.csv, PRESCRIPTIONS.csv. You should complete the required training course of MIMIC-III, then download and put the above mentioned files in ./data. For contextual knowledge, there are some codes in mimic-code where demographics and measurements within firstday (e.g. age, weight, blood-gas) can be extracted. Then you may put it under ./data dir to use the contextual knowledge.

Model Comparation

  • K-most frequent: The simple baseline choose K medicines for a disease which is the most common K medicines co-occur with that disease. K is the hyper parameter determined according to the performance in evaluation set. refer to ./baseline/k_most_frequency.py
  • MLP: The diseases and medicines are firstly transformed to multi-hot vector, the a 3-layer MLP is carried to make multi-label prediction. A global threshold is used to select positive medicines. refer to ./baseline/mlp.py
  • MIMLFast: The traditional state-of-art MIML method transfered instances to label specific space and considered sub-concepts for each label. The representation of instances should be given first, so we use the skip-gram method to pre-generate the instances' representation. refer to matlab code
  • Leap: refer to neozhangthe1's Github

Model variants

To test the effectiveness of three different components proposed in KG-MIML-Net, the user can modify the config_template.json file.

"add_contextual_layer": true # set true to use contextual knowledge
"add_supervised": true # set true to use supervised attention module
"add_tree_inputs_embedding": true # set true to use structural knowledge for input instances
"add_tree_outputs_embedding": true # set true to use structural knowledge for output instances

Train and test

You can feel free to change the hyper-parameters and specify a model_name by changing "model_name" attr in in config_template.json file. The ./main.py is the entrance for training, testing and sampling.

python main.py # training script
python main.py -e # testing script
python main.py -p patient_id # sampling a patient 

Acknowledgements

Pytorch framework is modified from victoresque's github

kg-miml-net's People

Contributors

sjy1203 avatar

Stargazers

 avatar Au avatar  avatar  avatar  avatar  avatar yuanke avatar  avatar  avatar  avatar  avatar  avatar Mr.Harddisk avatar Shenda Hong avatar

Watchers

 avatar

kg-miml-net's Issues

找不到gather_firstday.csv文件

您好, 我最近在读您公布的这份代码,但是没有找到gather_firstday.csv文件,这个文件好像也并不是MIMIC-III数据集中的一个文件,是您更改了名字还是自己生成的呢?因为缺少这个文件,也不知道具体的文件格式,所以代码不能跑起来,麻烦您能给出明示,谢谢!

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.