Display author for new books

This commit is contained in:
Dominik Moritz Roth 2022-02-06 19:10:21 +01:00
parent 4d3925b193
commit 51f80e0867

View File

@ -994,7 +994,7 @@ def findNewBooks(G, books, num, minRecSco=5):
recs.append({'name': node['label'], 'rec': node, 'newBooks': newBooks, 'oldBooks': oldBooks})
for rec in recs:
for book in rec['newBooks']:
G.add_node('n/'+book['title'], color='blue', t='newBook', label=book['title'])
G.add_node('n/'+book['title'], color='blue', t='newBook', label=book['title'], author=book['author'])
G.add_node('r/'+rec['rec']['label'], color='orange', t='recommender', label=rec['rec']['label'], score=rec['rec']['score'])
G.add_edge('r/'+rec['rec']['label'], 'n/'+book['title'], color='blue')
@ -1019,6 +1019,7 @@ def findNewBooks(G, books, num, minRecSco=5):
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'])
node['label'] += '\n ' + node['author']
removeKeepBest(G, num, 10, 'newBook')
# while batchSize is implemented, we only get a good gonvergence when we disable it (batchSize=-1)