gpt4 book ai didi

java - 加权 HITS 算法实现(中心和权威分数)

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:21:52 27 4
gpt4 key购买 nike

我正在研究 HITS 算法实现的加权版本。

这是 Hits 算法的公式(非加权版本): enter image description here

其中HITS A为权威评分,HITS H为hub评分,维基百科算法伪代码:

 G := set of pages
for each page p in G do
p.auth = 1 // p.auth is the authority score of the page p
p.hub = 1 // p.hub is the hub score of the page p
function HubsAndAuthorities(G)

for step from 1 to k do // run the algorithm for k steps
norm = 0
for each page p in G do // update all authority values first
p.auth = 0
for each page q in p.incomingNeighbors do // p.incomingNeighbors is the set of pages that link to p
p.auth += q.hub
norm += square(p.auth) // calculate the sum of the squared auth values to normalise
norm = sqrt(norm)
for each page p in G do // update the auth scores
p.auth = p.auth / norm // normalise the auth values
norm = 0
for each page p in G do // then update all hub values
p.hub = 0
for each page r in p.outgoingNeighbors do // p.outgoingNeighbors is the set of pages that p links to
p.hub += r.auth
norm += square(p.hub) // calculate the sum of the squared hub values to normalise
norm = sqrt(norm)
for each page p in G do // then update all hub values
p.hub = p.hub / norm // normalise the hub values

如何更改此算法以适用于问题的加权版本: enter image description here

请提供伪代码或java实现

最佳答案

对于加权版本的算法,您需要更改更新部分的代码:

p.hub += weight(p,r) * r.auth
^^^

类似地:

p.auth += weight(q,p) * q.hub
^^^

请注意,如果我们为所有节点设置 wight(u,v)=1,则此更新会衰减到原始算法,这是一个所需的属性。

关于java - 加权 HITS 算法实现(中心和权威分数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32815973/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com