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

What does node2vec expect in .wv method? #5

Open
chuymtz opened this issue Jul 27, 2023 · 2 comments
Open

What does node2vec expect in .wv method? #5

chuymtz opened this issue Jul 27, 2023 · 2 comments

Comments

@chuymtz
Copy link

chuymtz commented Jul 27, 2023

Hello,

I;m working through chapter 4. In the prediction of the test set, you use train_mask_str in the book but in your gh code you use train_mask. Depending on which one you use one gets very different results.

if you pass the integer mask you get something that won't go pass 60% accuracy.

y_pred = clf.predict(node2vec.wv[test_mask])
acc = accuracy_score(y_pred, labels[test_mask])
print(f'Node2Vec accuracy = {acc*100:.2f}%')
>>>Node2Vec accuracy = 59.09%

But if i pass the string mask i get what you report both in gh and the book . Which seems really high considering how many samples you pick out in the train and test.

y_pred = clf.predict(node2vec.wv[test_mask_str])
acc = accuracy_score(y_pred, labels[test_mask])
print(f'Node2Vec accuracy = {acc*100:.2f}%')
>>>Node2Vec accuracy = 95.45%

How can one explain this discrepancy?

@mlabonne
Copy link
Collaborator

mlabonne commented Sep 9, 2023

Hi, sorry for the very late reply! Thank you for noticing this discrepancy between the book and the code. Unfortunately, I can't replicate your issue. The data type should not matter here because it's masking the same nodes.

@chuymtz
Copy link
Author

chuymtz commented Sep 11, 2023

No problem. thanks you for the reply (and amazing book). I think this is more of an issue with node2vec. I'll take what I learned conceptually and move on 😊 thanks!

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

No branches or pull requests

2 participants