Giter VIP home page Giter VIP logo

Comments (11)

ZiruiYan avatar ZiruiYan commented on July 18, 2024

In training, graph2vec just use center not the nei_list, so the set of words will be same. However, I wonder whether the order of extracted_features, which is different in two versions, will hurt the results.

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

Hi ZiruiYan,
Not sure if this is related, but when I execute on a provided sample, results are not good.
To validate the result, I have added the following code:
`def test(model, document_collections):

ranks = []

second_ranks = []

for doc_id in range(len(document_collections)):

    inferred_vector = model.infer_vector(document_collections[doc_id].words)

    sims = model.docvecs.most_similar([inferred_vector], topn=len(model.docvecs))

    rank = [docid for docid, sim in sims].index("g_" + str(doc_id))

    ranks.append(rank)

    second_ranks.append(sims[1])

print(sorted(collections.Counter(ranks).items())`

Basically inferred vectors should be most similar to themselves, (0,50) would be ideal. What I am getting is absolutely random:
[(0, 1), (1, 2), (2, 3), (4, 1), (5, 2), (8, 2), (10, 2), (11, 2), (14, 1), (16, 3), (19, 1), (21, 1), (22, 2), (23, 1), (24, 1), (25, 2), (27, 1), (28, 2), (29, 1), (32, 2), (34, 1), (35, 3), (36, 1), (37, 1), (39, 1), (40, 3), (41, 1), (43, 1), (44, 1), (45, 2), (50, 3)]

Can you provide a fix for the code, so it will work same as original?

from graph2vec.

benedekrozemberczki avatar benedekrozemberczki commented on July 18, 2024

The provided samples are synthetic data.For inferring you have to use a large learning rate.

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

Can you please point to the data set and learning rate to be used so the inferring will show reasonable results?

from graph2vec.

benedekrozemberczki avatar benedekrozemberczki commented on July 18, 2024

Synthetic data means ER graphs. A learning rate above 0.05 helps.

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

So if I try on nci1 set from the original paper and learning rate 0.05, inferring should be OK right?
Do you have any not synthetic data sets in the json format as the software expects?

from graph2vec.

benedekrozemberczki avatar benedekrozemberczki commented on July 18, 2024

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

Thanks!!! Really appreciate this. Also want to see the inference working. Do not know if authors of the original paper tried to check the inference.

from graph2vec.

benedekrozemberczki avatar benedekrozemberczki commented on July 18, 2024

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

Hi Benedek, good news, found a bug in my test procedure.
Now I am getting almost perfect inferring results on the synthetic set: [(0, 50), (1, 1)]
using parameters --learning-rate 0.05 --down-sampling 0.001 --epochs 500

The correct test code:
`def test(model, document_collections):

ranks = []

second_ranks = []

for doc_id in range(len(document_collections)):

    inferred_vector = model.infer_vector(document_collections[doc_id].words)

    sims = model.docvecs.most_similar(positive=[inferred_vector], topn=len(model.docvecs))

    rank = [docid for docid, sim in sims].index(document_collections[doc_id].tags[0])

    ranks.append(rank)

    second_ranks.append(sims[1])

print(sorted(collections.Counter(ranks).items()))`

from graph2vec.

shaulz avatar shaulz commented on July 18, 2024

Something unrelated, suppose my node data is multidimensional i.e. has more than one label.
Any idea of how to use graph2vec in such case? Of course I can run separately on each label and merge results into a single TaggedDocument before calling Doc2Vec. Any other options?

from graph2vec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.