More GNTM
This commit is contained in:
parent
e87288a927
commit
02e912d4ff
@ -403,8 +403,7 @@ def scoreOpinions(G, globMu, globStd):
|
||||
node['score'] = node['mean']
|
||||
node['feedbacks'] = feedbacks
|
||||
else:
|
||||
node['score'] = globMu - globStd
|
||||
node['score'] = node['score'] / 2 + node['gpr_score']
|
||||
node['score'] = None
|
||||
|
||||
def scoreUnread(G, globMu, globStd):
|
||||
for n in list(G.nodes):
|
||||
@ -817,7 +816,7 @@ def genScores(G, books, calcPagerank=True):
|
||||
globMu, globStd = calcRecDist(G, books)
|
||||
if calcPagerank:
|
||||
runPagerank(G)
|
||||
genGprScores(G, globMu, globStd, 'score', 'std')
|
||||
genGprScores(G, globMu, globStd, 'score', 'se')
|
||||
#scoreOpinions(G, globMu, globStd)
|
||||
#scoreUnread(G, globMu, globStd)
|
||||
return globMu, globStd
|
||||
|
8
py/gp.py
8
py/gp.py
@ -62,14 +62,14 @@ def genGprScores(G, globMu, globStd, scoreName='gpr_score', stdName='gpr_std'):
|
||||
X = []
|
||||
for n in G.nodes:
|
||||
node = G.nodes[n]
|
||||
if 'rating' in node and node['rating']==None:
|
||||
if not 'rating' in node or node['rating']==None:
|
||||
X.append(n)
|
||||
print('[\] Inferencing GP')
|
||||
y, stds = gpr.predict(X, return_std=True)
|
||||
i=0
|
||||
for n in G.nodes:
|
||||
node = G.nodes[n]
|
||||
if 'rating' in node and node['rating']==None:
|
||||
s, std = y[i], stds[i]
|
||||
if not 'rating' in node or node['rating']==None:
|
||||
s, std = y[i], sum([val[0] for val in stds[i]])
|
||||
i+=1
|
||||
node[scoreName], node[stdName] = s, std
|
||||
node[scoreName], node[stdName] = float(s), float(std)
|
||||
|
Loading…
Reference in New Issue
Block a user