Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Link prediction code #87

Open
alimuham1 opened this issue Feb 19, 2020 · 2 comments
Open

Use of Link prediction code #87

alimuham1 opened this issue Feb 19, 2020 · 2 comments

Comments

@alimuham1
Copy link

I want to use the link prediction code with my own embedding methods. Could you please explain me how i would use this.

I am using cora edgelist as dataset, and i have generated embeddings with the help of deepwalk method and now i want to try the task of link prediction.

Is it possible that i could use your link prediction file to generate the accuracy score.
Sorry, may be i am bit confuse to use your code for my link prediction task.

Any help would be a great favor for me.

Thanks

@XiHaKitty
Copy link

Hello
The problem I urgently need to solve is exactly similar to your goal. I generated the embedding in another way. I need to solve the task of link prediction. Could you please solve it.
Any answer will be of great help to me.
Thank you

@claudiodtbarros
Copy link
Contributor

I have solved issues regarding link prediction by changing the following files and the following lines:

  1. File /gem/utils/evaluation.util.py
    Line 40: for (st, ed, w) in di_graph.edges_iter(data='weight', default=1):

I have changed to for (st, ed, w) in list(di_graph.edges(data='weight', default=1)):
Reason: As far as I have understood, edges_iter was removed after NetworkX 2.0.

  1. File /gem/evaluation/evaluate_link_prediction.py
    Line 67: filtered_edge_list = [e for e in predicted_edge_list if not train_digraph.has_edge(node_l(e[0]), node_l(e[1]))]

I have changed to filtered_edge_list = [e for e in predicted_edge_list if not train_digraph.has_edge(node_l[e[0]], node_l[e[1]])]

Reason: If node_l is None (line 65), then node_l is defined as a list (line 66). Therefore, as lists being not callable, one must use node_l[...], and not node_l(...). I have not tested link prediction for labeled graphs yet.

Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants