node2vec
node2vec copied to clipboard
error in node2vec fit
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!
I had the same error. Waiting for a response!
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
Downgrade gensim to 3.8.3 works.
I would wait for the fix. Thanks very much for looking into it!
Solved in 4.2.0
TypeError: Word2Vec.init() got an unexpected keyword argument 'size'
with node2vec 4.6
Can you tell me which gensim
version is installed?
TypeError: Word2Vec.init() got an unexpected keyword argument 'size'
with node2vec 4.6
Fix for that is as follows. Replace the variable names in the Word2Vec call:
- 'iter' -> 'epochs'
- 'size' -> 'vector_size'
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?
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.
I'll try to check it out in the weekend
I can't find time to do this, I'd appreciate if anyone wants to contribute through a PR @MikeB2019x @p-dre
I can do that.
Michael Bourassa
Data Scientist | MindBridge
+1 613-894-9189 <+1-613-894-9189>
Bourassa
mindbridge.ai
[image: twitter] https://twitter.com/mindbridge_ai
[image: linkedin] https://www.linkedin.com/company/mindbridge-ai/
[image: banner] https://www.mindbridge.ai/news/mindbridge-named-to-forbes-ai-50-list-of-most-promising-ai-companies
On Wed, Apr 12, 2023 at 2:53 AM Elior Cohen @.***> wrote:
I can't find time to do this, I'd appreciate if anyone wants to contribute through a PR @MikeB2019x https://github.com/MikeB2019x @p-dre https://github.com/p-dre
— Reply to this email directly, view it on GitHub https://github.com/eliorc/node2vec/issues/60#issuecomment-1504757987, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALV3V75KJ5TLOS56ARVLG5LXAZGQPANCNFSM42DV7BSQ . You are receiving this because you were mentioned.Message ID: @.***>
@MikeB2019x I'd love to accept it!