Skip to content

PageRank centrality computed by this codes maybe meaningless #4

@c747903646

Description

@c747903646

drop weightis is computed according to the folllowing codes in pGRACE/functional.py :

`def pr_drop_weights(edge_index, aggr: str = 'sink', k: int = 10):
pv = compute_pr(edge_index, k=k)
pv_row = pv[edge_index[0]].to(torch.float32)
pv_col = pv[edge_index[1]].to(torch.float32)
s_row = torch.log(pv_row)
s_col = torch.log(pv_col)
if aggr == 'sink':
s = s_col
elif aggr == 'source':
s = s_row
elif aggr == 'mean':
s = (s_col + s_row) * 0.5
else:
s = s_col
weights = (s.max() - s) / (s.max() - s.mean())

return `

However, in debugging codes, I found that some elements in array pv could be 0 (while using WikiCS for training). After executed torch.log(), min value of s_row and s_col will be -inf, resulted in all of weights became 0. At that time, the weights was meaningless.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions