aditya-grover / node2vec

http://snap.stanford.edu/node2vec/
MIT License
2.61k stars 912 forks source link

RuntimeError:you must first build vocabulary before training the model #42

Open iFe1er opened 6 years ago

iFe1er commented 6 years ago

Message:

Walk iteration: 1 / 10 2 / 10 3 / 10 4 / 10 5 / 10 6 / 10 7 / 10 8 / 10 9 / 10 10 / 10 Traceback (most recent call last): File "src/main.py", line 104, in main(args) File "src/main.py", line 100, in main learn_embeddings(walks) File "src/main.py", line 87, in learn_embeddings model = Word2Vec(walks, size=args.dimensions, window=args.window_size, min_count=0, sg=1, workers=args.workers, iter=args.iter) File "C:\Anaconda2\lib\site-packages\gensim\models\word2vec.py", line 473, in init self.train(sentences) File "C:\Anaconda2\lib\site-packages\gensim\models\word2vec.py", line 777, in train raise RuntimeError("you must first build vocabulary before training the model") RuntimeError: you must first build vocabulary before training the model

Google said it is a problem with Word2Vec where min_count is to large. However, here the problem still occur although min_count=0


Problem found: because walks = []

eirene-aisa commented 6 years ago

How about checking your input? I had the same error but it ended when I changed the separator of my file from , to space.

iFe1er commented 6 years ago

@dopha-mipa Yes that is right. I checked my input file format, and the problem occur since the default seperator setting in pandas is different from this file.

Thank you thought i solve the problem months ago. :)