Better newBooks

This commit is contained in:
Dominik Moritz Roth 2022-02-11 17:50:07 +01:00
parent bcec24fbf7
commit 05a51cd5e6

View File

@ -992,7 +992,7 @@ def progress(G, minimum=3.5):
print('Progress: '+str(perc)+'%')
def analyze(G, books, type_name, name, dist=2.1):
def analyze(G, books, mu, type_name, name, dist=2.1):
from fuzzywuzzy import fuzz
type_ident = type_name[0]
full_name = type_ident + "/" + name
@ -1009,7 +1009,7 @@ def analyze(G, books, type_name, name, dist=2.1):
if bestRatio < 70:
print("Best Match: "+match['label'])
findNewBooks(G, books, num=-1, minRecSco=1)
findNewBooks(G, books, mu, num=-1, minRecSco=1)
menge = set()
waveFlow(G, match, n, dist, menge)
@ -1095,8 +1095,8 @@ def shell(G, books, mu, std):
def newBooks(G, books, num, mu, std):
removeBad(G, mu-std*2)
findNewBooks(G, books, mu, num, minRecSco = mu-std)
removeThinRecs(G, 2)
findNewBooks(G, books, num, minRecSco = mu-std)
removeUnread(G)
removeUselessReadBooks(G)
removeTags(G)
@ -1110,7 +1110,7 @@ def newBooks(G, books, num, mu, std):
addScoreToLabels(G)
def findNewBooks(G, books, num=-1, minRecSco=5):
def findNewBooks(G, books, mu, num=-1, minRecSco=5):
mrbdf = pd.read_csv('mrb_db.csv')
recs = []
for n in list(G.nodes):
@ -1148,9 +1148,10 @@ def findNewBooks(G, books, num=-1, minRecSco=5):
G.remove_node(n)
else:
ses.append(min(ses))
node['fake_se'] = sum(ses)/(len(ses)**1.2) + 0.5 + 0.5 * (len(scores)==1) # This is not how SE works. DILLIGAF?
scores.append(mu)
node['fake_se'] = sum(ses)/(len(ses)**1.2) + 0.5 + 0.5 * (len(scores)==2) # This is not how SE works. DILLIGAF?
node['score'] = sum(scores)/len(scores)*1.2 - node['fake_se']*2 + 0.5 - 0.1/math.sqrt(len(scores))
if len(scores)==1:
if len(scores)==2:
node['score']*=0.80
node['value'] = 20 + 5 * float(node['score'])
node['label'] += " ({:.2f}±{:.1f})".format(node['score'], node['fake_se'])
@ -1342,7 +1343,7 @@ def cliInterface():
if args.new==-1:
args.new = int(args.n / 5)
if args.new != 0:
findNewBooks(G, books, args.new, minRecSco = mu-std)
findNewBooks(G, books, mu, args.new, minRecSco = mu-std)
if args.tag_based:
if args.recommender_based:
raise Exception('tag-based and recommender-based can not be be combined')
@ -1356,7 +1357,7 @@ def cliInterface():
elif args.cmd=="read":
readBooksAnalysis(G, args.min_rating, args.all_tags, args.only_connected, not args.keep_top_lists)
elif args.cmd=="analyze":
analyze(G, books, args.type, args.name, args.d)
analyze(G, books, mu, args.type, args.name, args.d)
elif args.cmd=="full":
fullGraph(G, not args.keep_top_lists)
elif args.cmd=="competence":