PacktPublishing / Graph-Machine-Learning

Graph Machine Learning, published by Packt
MIT License
261 stars 140 forks source link

Chapter 2 - embeddings #8

Closed ealmirall closed 2 years ago

ealmirall commented 2 years ago

import networkx as nx from node2vec import Node2Vec

G = nx.barbell_graph(m1=7, m2=4) draw_graph(G, nx.spring_layout(G))

node2vec = Node2Vec(G, dimensions=2) model = node2vec.fit(window=10)

Computing transition probabilities: 100% 18/18 [00:00<00:00, 261.56it/s] Generating walks (CPU: 1): 100%|██████████| 10/10 [00:00<00:00, 16.48it/s]

TypeError Traceback (most recent call last) in () 6 7 node2vec = Node2Vec(G, dimensions=2) ----> 8 model = node2vec.fit(window=10)

/usr/local/lib/python3.7/dist-packages/node2vec/node2vec.py in fit(self, skip_gram_params) 186 skip_gram_params['sg'] = 1 187 --> 188 return gensim.models.Word2Vec(self.walks, skip_gram_params)

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

amarzullo24 commented 2 years ago

Hi ealmirall, I can't reproduce this on my computer. Can you provide more details about your environment? (i.e. Python version, node2vec version, etc.). Please make sure you have the correct requirements as stated in the book, including:

Jupyter==1.0.0
networkx==2.5
matplotlib==3.2.2
node2vec==0.3.3
karateclub==1.0.19
scipy==1.6.2
ealmirall commented 2 years ago

Thanks a lot !

esteve

On 25 Mar 2022, at 22:20, emmeduz @.***> wrote:

Hi ealmirall https://github.com/ealmirall, I can't reproduce this on my computer. Can you provide more details about your environment? (i.e. Python version, node2vec version, etc.). Please make sure you have the correct requirements as stated in the book, including:

Jupyter==1.0.0 networkx==2.5 matplotlib==3.2.2 node2vec==0.3.3 karateclub==1.0.19 scipy==1.6.2 — Reply to this email directly, view it on GitHub https://github.com/PacktPublishing/Graph-Machine-Learning/issues/8#issuecomment-1079442471, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ5HCCCRPH4VOPKR4FK4DTVBYUYNANCNFSM5QWI4SHA. You are receiving this because you authored the thread.