diff --git a/caliGraph.py b/caliGraph.py index 9737daa..caa31b5 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -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 diff --git a/py/gp.py b/py/gp.py index d559881..ca05c6e 100644 --- a/py/gp.py +++ b/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)