WIP
This commit is contained in:
parent
153aa434d5
commit
0fbc9d7729
17
caliGraph.py
17
caliGraph.py
@ -378,6 +378,9 @@ def scoreUnread(G, globMu, globStd):
|
|||||||
if node['t'] == 'book':
|
if node['t'] == 'book':
|
||||||
if node['rating'] == None:
|
if node['rating'] == None:
|
||||||
adjacens = list(G.adj[n].keys())
|
adjacens = list(G.adj[n].keys())
|
||||||
|
cats = {}
|
||||||
|
for cat in weights.keys():
|
||||||
|
cats[cat] = []
|
||||||
for adj in adjacens:
|
for adj in adjacens:
|
||||||
adjNode = G.nodes[adj]
|
adjNode = G.nodes[adj]
|
||||||
if 'score' in adjNode and adjNode['score'] != None:
|
if 'score' in adjNode and adjNode['score'] != None:
|
||||||
@ -385,6 +388,7 @@ def scoreUnread(G, globMu, globStd):
|
|||||||
for fb in adjNode['feedbacks']:
|
for fb in adjNode['feedbacks']:
|
||||||
feedbacks.append(fb)
|
feedbacks.append(fb)
|
||||||
ws.append(w)
|
ws.append(w)
|
||||||
|
cats[adjNode['t']].append(fb)
|
||||||
if len(feedbacks):
|
if len(feedbacks):
|
||||||
node['mean'], node['std'] = norm.fit(feedbacks)
|
node['mean'], node['std'] = norm.fit(feedbacks)
|
||||||
node['se'] = globStd / math.sqrt(len(feedbacks))
|
node['se'] = globStd / math.sqrt(len(feedbacks))
|
||||||
@ -394,7 +398,18 @@ def scoreUnread(G, globMu, globStd):
|
|||||||
ws.append(['se'])
|
ws.append(['se'])
|
||||||
feedbacks.append(globMu)
|
feedbacks.append(globMu)
|
||||||
ws.append(['bias'])
|
ws.append(['bias'])
|
||||||
node['score'] = sum([fb*getWeightForType(w[0], w[1] if len(w)>1 else 1) for fb, w in zip(feedbacks, ws)])/sum([getWeightForType(w[0], w[1] if len(w)>1 else 1) for w in ws])
|
linScore = sum([fb*getWeightForType(w[0], w[1] if len(w)>1 else 1) for fb, w in zip(feedbacks, ws)])/sum([getWeightForType(w[0], w[1] if len(w)>1 else 1) for w in ws])
|
||||||
|
catWeightSum = sum([getWeightForType(c, 1) if cats[c] != [globMu] else 0 for c in weights])
|
||||||
|
catScores = [(sum(cats[c])/len(cats[c])) * getWeightForType(c, 1) for c in cats if len(cats[c])]
|
||||||
|
if len(catScores):
|
||||||
|
normScore = sum(catScores)/len(catScores)
|
||||||
|
else:
|
||||||
|
normScore = globMu
|
||||||
|
#print(catScores)
|
||||||
|
#print(linScore, normScore)
|
||||||
|
normF = getWeightForType('norm', 1)
|
||||||
|
normF = 1
|
||||||
|
node['score'] = linScore * (1-normF) + normScore * normF
|
||||||
node['_act'] = feedbacks
|
node['_act'] = feedbacks
|
||||||
node['_wgh'] = ws
|
node['_wgh'] = ws
|
||||||
else:
|
else:
|
||||||
|
@ -1 +1 @@
|
|||||||
{"topList": 0.8269026935523768, "recommender": 0.5687397308864482, "author": 0.9602300111040548, "series": 0.0015315822252870478, "tag": 0.0028789924118737056, "mu": 0.48730278196967397, "sigma": 0.02394878388858184, "se": 0.45207554705083647, "bias": 0.555294008129175}
|
{"topList": 0.6813597954924836, "recommender": 0.7373820050627435, "author": 0.9322587113850848, "series": 0.9256656037821412, "tag": 0.9917141164721258, "mu": 0.5619155530016923, "sigma": 0.05411831944351521, "se": 0.6823826056339866, "bias": 0.7987740969341441, "norm": 0.9443733783393993}
|
Loading…
Reference in New Issue
Block a user