benedekrozemberczki / graph2vec

A parallel implementation of "graph2vec: Learning Distributed Representations of Graphs" (MLGWorkshop 2017).
https://karateclub.readthedocs.io/
GNU General Public License v3.0
901 stars 169 forks source link

ValueError while using the default Dataset #33

Closed AkshatSood closed 3 years ago

AkshatSood commented 3 years ago

I was having trouble using the tool with my dataset, so I tried using the default dataset using the following command:

python src/graph2vec.py --dimensions 32

But even on the default dataset provided, I get the following error:

Traceback (most recent call last):
  File "src/graph2vec.py", line 129, in <module>
    main(args)
  File "src/graph2vec.py", line 125, in main
    save_embedding(args.output_path, model, graphs, args.dimensions)
  File "src/graph2vec.py", line 98, in save_embedding
    out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
ValueError: invalid literal for int() with base 10: 'dataset\\0'

I tried fixing the error for the string format, but that raises some KeyErrors. Could I kindly get some assistance with this?

Edit: I have attached the KeyError below:

Traceback (most recent call last):
  File "src/graph2vec.py", line 130, in <module>
    main(args)
  File "src/graph2vec.py", line 126, in main
    save_embedding(args.output_path, model, graphs, args.dimensions)
  File "src/graph2vec.py", line 99, in save_embedding
    out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
  File "C:\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\models\keyedvectors.py", line 1613, in __getitem__
    raise KeyError("tag '%s' not seen in training corpus/invalid" % index)
KeyError: "tag 'g_0' not seen in training corpus/invalid"

Thank you

AkshatSood commented 3 years ago

The issue was resolved by changing the way the code split the path of the dataset. Since I was using Windows, the paths used "\" instead of "/".

benedekrozemberczki commented 3 years ago

I would recommend using the KarateClub library.

On Tue, 9 Mar 2021 at 11:35, AkshatSood notifications@github.com wrote:

Closed #33 https://github.com/benedekrozemberczki/graph2vec/issues/33.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/benedekrozemberczki/graph2vec/issues/33#event-4427450150, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEETMF4FKAVAK2QSL656LPDTCYBWJANCNFSM4Y3MBCOA .