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

Fixed avg_deg calculation #4312

Merged
merged 3 commits into from
Mar 21, 2022
Merged

Fixed avg_deg calculation #4312

merged 3 commits into from
Mar 21, 2022

Conversation

gpdwatkins
Copy link
Contributor

Fixed calculation of self.avg_deg in pna_conv.py to correctly calculate averages (the change is consistent with original code at https://github.com/lukecavabarrett/pna).

The variable deg is a histogram of in-degrees of nodes in the training set. In the original implementation, the average degree is calculated by taking the mean of the elements of deg (the log and exp averages are calculated similarly). This actually takes an average of the frequencies, which is not the desired behaviour.

This change ensures that self.avg_deg is indeed finding the average (and log and exp averages) of the vertex in-degrees by calculating the sum-product of the degrees and their associated frequencies.

@codecov
Copy link

codecov bot commented Mar 21, 2022

Codecov Report

Merging #4312 (9026ebc) into master (63b520e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4312   +/-   ##
=======================================
  Coverage   82.28%   82.29%           
=======================================
  Files         310      310           
  Lines       15877    15879    +2     
=======================================
+ Hits        13065    13067    +2     
  Misses       2812     2812           
Impacted Files Coverage Δ
torch_geometric/nn/conv/pna_conv.py 94.64% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63b520e...9026ebc. Read the comment docs.

Copy link
Member

@rusty1s rusty1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right. Thank you for fixing :)

@rusty1s rusty1s changed the title Fixed avg_deg calculation Fixed avg_deg calculation Mar 21, 2022
@rusty1s rusty1s merged commit d62b976 into pyg-team:master Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants