Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in node2vec fit #60

Open
BSharmi opened this issue Mar 31, 2021 · 14 comments · Fixed by #61
Open

error in node2vec fit #60

BSharmi opened this issue Mar 31, 2021 · 14 comments · Fixed by #61

Comments

@BSharmi
Copy link

BSharmi commented Mar 31, 2021

Hello,

I ran the commands using the default data in the package and get the following error in the embed node step in the node2vec.fit step

import networkx as nx
from node2vec import Node2Vec
graph = nx.fast_gnp_random_graph(n=100, p=0.5)
node2vec = Node2Vec(graph, dimensions=64, walk_length=30, num_walks=200, workers=4)
model = node2vec.fit(window=10, min_count=1, batch_words=4)

error

--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-1-66dd459dbca1> in <module> 9 10 # Embed nodes ---> 11 model = node2vec.fit(window=10, min_count=1, batch_words=4) ~/anaconda3/envs/default/lib/python3.8/site-packages/node2vec/node2vec.py in fit(self, **skip_gram_params) 181 skip_gram_params['sg'] = 1 182 --> 183 return gensim.models.Word2Vec(self.walks, **skip_gram_params) TypeError: __init__() got an unexpected keyword argument 'size'

I have installed the required packages. Is there any step I missed?

Would appreciate a response!

Thank you!

@adamdingliang
Copy link

I had the same error. Waiting for a response!

@eliorc
Copy link
Owner

eliorc commented Mar 31, 2021

Yes, gensim has changed their interface, you can wither downgrade gensim to version less than 4 or wait for the weekedn and I'll fix it as I noted in #59

@adamdingliang
Copy link

Downgrade gensim to 3.8.3 works.

@BSharmi
Copy link
Author

BSharmi commented Apr 1, 2021

I would wait for the fix. Thanks very much for looking into it!

@eliorc eliorc closed this as completed in #61 Apr 2, 2021
@eliorc
Copy link
Owner

eliorc commented Apr 2, 2021

Solved in 4.2.0

ebrucucen pushed a commit to ebrucucen/node2vec that referenced this issue Oct 20, 2021
@p-dre
Copy link

p-dre commented Jan 27, 2023

TypeError: Word2Vec.init() got an unexpected keyword argument 'size'

with node2vec 4.6

@eliorc eliorc reopened this Jan 27, 2023
@eliorc
Copy link
Owner

eliorc commented Jan 27, 2023

Can you tell me which gensim version is installed?

TypeError: Word2Vec.init() got an unexpected keyword argument 'size'

with node2vec 4.6

@MikeB2019x
Copy link

MikeB2019x commented Feb 6, 2023

Fix for that is as follows. Replace the variable names in the Word2Vec call:

  • 'iter' -> 'epochs'
  • 'size' -> 'vector_size'

@eliorc
Copy link
Owner

eliorc commented Feb 6, 2023

Fix for that is as follows. Replace the variable names in the Word2Vec call:

  • 'iter' -> 'epochs'
  • 'size' -> 'vector_size'

Before validating a fix, I want to reproduce, can you tell me with which version of gensim and node2vec are you getting errors?

@MikeB2019x
Copy link

MikeB2019x commented Feb 6, 2023

Sorry about that :-D I was using: gensim 4.2.0 but encountered the problem while working with the struc2vec repo here. Basically a fork of your latest and then tried to get everything working in Python3 with the pr from @steenfatt. This is the link to the gensim 4.2.0 word2vec.py.

@eliorc
Copy link
Owner

eliorc commented Feb 9, 2023

I'll try to check it out in the weekend

@eliorc
Copy link
Owner

eliorc commented Apr 12, 2023

I can't find time to do this, I'd appreciate if anyone wants to contribute through a PR @MikeB2019x @p-dre

@MikeB2019x
Copy link

MikeB2019x commented Apr 12, 2023 via email

@eliorc
Copy link
Owner

eliorc commented Apr 13, 2023

@MikeB2019x I'd love to accept it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants