Smol Tweaks (for newBooks)

This commit is contained in:
Dominik Moritz Roth 2022-02-06 18:56:53 +01:00
parent 9373e66e29
commit e599a851cf

View File

@ -447,6 +447,7 @@ def getWeightForType(nodeType, edgeWeight=1):
return w
def printBestList(G, t='book', num=-1):
print(t)
bestlist = []
for n in list(G.nodes):
node = G.nodes[n]
@ -1010,11 +1011,12 @@ def findNewBooks(G, books, num, minRecSco=5):
if adj['t'] == 'recommender':
scores.append(adj['score'])
ses.append(adj['se'])
ses.append(min(ses))
if len(scores) < 2:
G.remove_node(n)
else:
node['score'] = sum(scores)/len(scores) - 0.1/math.sqrt(len(scores))
node['fake_se'] = sum(ses)/(len(ses)*1.2) # This is not how SE works. DILLIGAF?
node['fake_se'] = sum(ses)/(len(ses)**1.2) # This is not how SE works. DILLIGAF?
node['score'] = sum(scores)/len(scores)*1.2 - node['fake_se']*2.5 + 0.5 - 0.1/math.sqrt(len(scores))
node['value'] = 20 + 5 * float(node['score'])
node['label'] += " ({:.2f}±{:.1f})".format(node['score'], node['fake_se'])
removeKeepBest(G, num, 10, 'newBook')