phanein/deepwalk

AttributeError: 'Graph' object has no attribute 'iterkeys'

yunmij opened this issue · 5 comments

Traceback (most recent call last):
File "/home/gan/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/gan/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "deepwalk/main.py", line 168, in
sys.exit(main())
File "deepwalk/main.py", line 165, in main
process(args)
File "deepwalk/main.py", line 92, in process
vertex_counts = G.degree(nodes=G.iterkeys())
AttributeError: 'Graph' object has no attribute 'iterkeys'

maybe it should use 'iterkeys(G)'?

GTmac commented

Are you using Python 2 or Python 3? I believe iterkeys() is removed in Python 3 -- but you can still import iterkeys() from compatibility modules like six or future.utils.

Are you using Python 2 or Python 3? I believe iterkeys() is removed in Python 3 -- but you can still import iterkeys() from compatibility modules like six or future.utils.

Thanks for your reply, I do use python3 and import six, then I'll try to use python2 to run it

I change iterkeys() to keys() (with Python 3), and it can work as well.But the question i want to know is the difference of setting vertex_freq_degree to True or False.What result will be taken with this setting?Does the faster than calculating the vocabulary mean that it will speed up the calculation of Skipgram model ?

GTmac commented

Actually, you can ignore the vertex_freq_degree argument -- setting it to True or False does not really make a large difference in most cases.

That said, this argument controls the node frequency distribution we feed into the gensim Skip-gram model (recall that Skip-gram samples negative words based on frequency). You can expect that the frequency distribution in random walks is (slightly) different from the node degree distribution. Hope this answers your question :-)

Get it,Thank you very much.