node2vec icon indicating copy to clipboard operation
node2vec copied to clipboard

RuntimeError:you must first build vocabulary before training the model

Open iFe1er opened this issue 7 years ago • 2 comments

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 = []

iFe1er avatar Jun 07 '18 06:06 iFe1er

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

eirene-aisa avatar Aug 08 '18 06:08 eirene-aisa

@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. :)

iFe1er avatar Aug 08 '18 07:08 iFe1er