Fined tuned wheight of TopLists and Tags

This commit is contained in:
Dominik Moritz Roth 2021-07-04 20:08:25 +02:00
parent 486a8fb88f
commit be0afb59c7

View File

@ -86,7 +86,7 @@ def getTopListWheight(book, topList):
minScope = min(minScope, scope) minScope = min(minScope, scope)
if minScope == 100000: if minScope == 100000:
raise Exception("You stupid?") raise Exception("You stupid?")
return 100/minScope return minScope / 10
def removeRead(G): def removeRead(G):
@ -287,6 +287,7 @@ def scoreUnread(G, globMu, globStd, errorFac=0.6):
for n in list(G.nodes): for n in list(G.nodes):
feedbacks = [] feedbacks = []
deepFeedbacks = [] deepFeedbacks = []
deepLen = 0
tagFeedbacks = [] tagFeedbacks = []
node = G.nodes[n] node = G.nodes[n]
if node['t'] == 'book': if node['t'] == 'book':
@ -295,20 +296,27 @@ def scoreUnread(G, globMu, globStd, errorFac=0.6):
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:
if adjNode['t'] != 'tag': if adjNode['t'] == 'tag':
feedbacks.append(adjNode['score']) w = int(10/(len(G.adj[adj])))
for fb in adjNode['feedbacks']: elif adjNode['t'] == 'topList':
deepFeedbacks.append(fb) w = int(G[n][adj]['wheight']*5)
else: else:
tagFeedbacks.append(adjNode['score']) w = 10
feedbacks.append(adjNode['score'])
for fb in adjNode['feedbacks']:
for i in range(w):
deepFeedbacks.append(fb)
deepLen += w
if len(feedbacks): if len(feedbacks):
node['mean'], node['std'] = norm.fit(deepFeedbacks) node['mean'], node['std'] = norm.fit(deepFeedbacks)
node['mean2'], node['std2'] = norm.fit(feedbacks) node['mean2'], node['std2'] = norm.fit(feedbacks)
f_mean, f_std = norm.fit(feedbacks) if deepLen:
node['se'] = globStd / math.sqrt(len(deepFeedbacks)) node['se'] = globStd / math.sqrt(deepLen)
# - errorFac*node['se'] # - errorFac*node['se']
node['score'] = ( node['score'] = (
(node['mean'] - errorFac*node['se'])*4 + node['mean2']*2 + (f_mean)*1)/7 + node['std2'] * 0.25 (node['mean'] - errorFac*node['se'])*3 + node['mean2']*2)/5
else:
node['score'] = globMu - errorFac*globStd
if 'series' in node: if 'series' in node:
if node['series_index'] == 1.0: if node['series_index'] == 1.0:
node['score'] += 0.000000001 node['score'] += 0.000000001