Coder Social home page Coder Social logo

med2vec-pytorch's Introduction

Med2Vec in Pytorch

This is a re-implementation of Med2Vec [1] in Pytorch. It simply embeds clinical concepts into a distributed representation using skip-gram model with an aditional code loss.

To run the code first obtain the ADMISSION.CSV and DIAGNOSES_ICD.CSV from MIMIC-III database here.

Compile the data by running bash gen_data.sh make sure you set the correct paths to the files.

The directories are structured as follows:

  • ./base: base trainer, data loader.
  • ./configs: json files for experiments. This where you pass in arguments to the model/trainer and what have you.
  • ./trainer: contains training logic, and anything that must be done to train the model.
  • ./model: directory containing the med2vec model.

To train the model run the following:

python train_med2vec.py -c ./configs/config.json

note: make sure the directories are set appropiatly in ./configs/config.json.

[1] Choi, Edward, et al. "Multi-layer representation learning for medical concepts." Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. ACM, 2016.

med2vec-pytorch's People

Contributors

sajaddarabi avatar

Stargazers

Victor Chaba avatar  avatar insanexixi avatar Niall Taylor avatar  avatar  avatar  avatar  avatar Zhenbang Wu avatar  avatar

med2vec-pytorch's Issues

med2vec model class

In the med2vec.py, there is a self.embedding in the __init__, and there is an embedding as method. In the forward method, which one is being used?

class Med2Vec(BaseModel):
    def __init__(self, icd9_size, demographics_size=0, embedding_size=2000, hidden_size=100,):
       ...
        self.embedding = nn.Embedding(self.vocabulary_size, self.embedding_size)
...


    def embedding(self, x):
        return F.linear(x, self.embedding_w, self.embedding_b)

cannot find data_loader.utils.vocab

Hello

I am trying to run your code with mimiic data but got the following error

Traceback (most recent call last):
  File "gen_data.py", line 13, in <module>
    from data_loader.utils.vocab import Vocab
ModuleNotFoundError: No module named 'data_loader.utils'

I checked the code and could not find any implementation about Vocab.

What's more, the following lines in base_trainer.py seems also problematic

from utils.util import ensure_dir
from utils.visualization import WriterTensorboardX

I could not find the module/directory utils in the repository

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.