Code Monkey home page Code Monkey logo

Comments (12)

PaigeDavid avatar PaigeDavid commented on September 25, 2024 1

Looks like I wasn't in an activated environment. Changed back vector_size to size, but it is still giving that error of the unexpected keyword. Here is my full run and traceback:

'(py35) C:\Users\paige\Desktop\690 Project\icd-prediction-mimic-master\icd-prediction-mimic-master>MIMIC_train_w2v.py
2021-08-02 16:36:16.572323: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-08-02 16:36:16.572426: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
C:\Python37\lib\site-packages\gensim\similarities_init_.py:15: UserWarning: The gensim.similarities.levenshtein submodule is disabled, because the optional Levenshtein package https://pypi.org/project/python-Levenshtein/ is unavailable. Install Levenhstein (e.g. pip install python-Levenshtein) to suppress this warning.
warnings.warn(msg)
[nltk_data] Downloading package stopwords to
[nltk_data] C:\Users\paige\AppData\Roaming\nltk_data...
[nltk_data] Package stopwords is already up-to-date!

        Data Split: 0, 0, 0

Traceback (most recent call last):
File "C:\Users\paige\Desktop\690 Project\icd-prediction-mimic-master\icd-prediction-mimic-master\MIMIC_train_w2v.py", line 56, in
main(args)
File "C:\Users\paige\Desktop\690 Project\icd-prediction-mimic-master\icd-prediction-mimic-master\MIMIC_train_w2v.py", line 29, in main
w2v = fx.W2V(args)
File "C:\Users\paige\Desktop\690 Project\icd-prediction-mimic-master\icd-prediction-mimic-master\feature_extraction.py", line 76, in init
workers=self.args.workers, sg=self.args.sg, seed=3778)
TypeError: init() got an unexpected keyword argument 'size''

from icd-prediction-mimic.

PaigeDavid avatar PaigeDavid commented on September 25, 2024 1

Yup. that appears to have fixed it. It is currently training embeddings and I got a Data Split of 47719, 1631, 3372. Thank you! Python is not my forte, but this model was perfect for my paper. Thank you for the help and quick responses

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024 1

Anytime! Good luck in your research!

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

Hello @PaigeDavid! Can you confirm you're using gensim version 3.8.3?

from icd-prediction-mimic.

PaigeDavid avatar PaigeDavid commented on September 25, 2024

Doing a conda list gensim I get the following:

` packages in environment at C:\Users\paige\Anaconda3:

Name Version Build Channel
gensim 3.8.3 pypi_0 pypi`

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

This line in feature_extraction.py builds the vocabulary before calling Word2Vec.train(), so this error is unexpected. I'll investigate possible reasons and come back to you, ok?

from icd-prediction-mimic.

PaigeDavid avatar PaigeDavid commented on September 25, 2024

That was my understanding as well when looking through the code. I don't have a lot of knowledge on this stuff, but everything I was seeing online basically was saying I shouldn't be getting this error.

I will add in that I have now tried this on two separate computers, and after fixing the size to vector_size, I receive the same error on both computers. Windows 10. Thanks for looking into it.

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

No problem! Are you sure your conda environment is active? I ask that because the Gensim 3.8.3 documentation explicitly sets size, not vector_size to the Word2Vec constructor. This could indicate you're indeed using another version, which could also explain further errors. Could you check into that? Perhaps try and setup another conda env or use a python venv instead.

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

Ok, so the problem seems to be something else. One last try regarding versions, just to be sure. Could you please create a .py file with these contents and run it inside your environment and show us the printed message?

import numpy
import gensim
import pandas

print(numpy.__version__, gensim.__version__, pandas.__version__)

It's also unexpected to see Data Split: 0, 0, 0 in your log. Have you followed steps 1 and 2 from the README.md? I've had this issue before when using a newer version of pandas. You should've gotten Data Split: 47719, 1631, 3372 instead.

from icd-prediction-mimic.

PaigeDavid avatar PaigeDavid commented on September 25, 2024

I did do steps 1 and 2, and I made sure I did them in the activated environment. Unsure if that mattered.

Results from running the python file:

C:\Python37\lib\site-packages\gensim\similarities_init_.py:15: UserWarning: The gensim.similarities.levenshtein submodule is disabled, because the optional Levenshtein package https://pypi.org/project/python-Levenshtein/ is unavailable. Install Levenhstein (e.g. pip install python-Levenshtein) to suppress this warning.
warnings.warn(msg)
1.19.2 4.0.1 1.3.1

(py35) C:\Users\paige\Desktop\690 Project\icd-prediction-mimic-master\icd-prediction-mimic-master>python --version
Python 3.6.9 :: Anaconda, Inc.

I ran python --version just to make sure since it looks like python 3.7 is being called? But I am not sure, nor am, I sure how I would change that in the conda environment

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

Looks like you're using version 4.0.1 of gensim and 1.3.1 of pandas. Downgrading them to the versions specified in the README should do the trick. As far as I can see, you seem to have a conda environment named py35 activated in your terminal. Could you please try and run this code line by line in your terminal?

> conda deactivate
> conda create --name icd_mimic python=3.6.9 numpy=1.19.0 scikit-learn=0.23.1 pandas=0.25.3 nltk=3.4.4 scipy=1.4.1 gensim=3.8.3 tensorflow=2.1.0
> conda activate icd_mimic

After running the code above sucessfully, you'll be in a new conda env (icd_mimic). Execute your python script (the one which prints the packages' versions) by running python script_name.py. If the printed versions are correct (1.19.0 3.8.3 0.25.3), go ahead and run steps 1,2 and 3 from the README again. Let me know if everything worked (:

from icd-prediction-mimic.

arthurreys avatar arthurreys commented on September 25, 2024

I'm closing this issue as we have solved it. Feel free to open it again or contact me via email if any new questions arise.

from icd-prediction-mimic.

Related Issues (3)

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.