Better rankings-list in cli and newly trained net
This commit is contained in:
parent
a2d747e41e
commit
3032dea8a0
32
caliGraph.py
32
caliGraph.py
@ -446,17 +446,21 @@ def getWeightForType(nodeType, edgeWeight=1):
|
||||
else:
|
||||
return w
|
||||
|
||||
def printBestList(G, num=-1):
|
||||
def printBestList(G, t='book', num=-1):
|
||||
print(t)
|
||||
bestlist = []
|
||||
for n in list(G.nodes):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'book':
|
||||
if node['t'] == t:
|
||||
if 'score' in node and node['score'] != None:
|
||||
bestlist.append(node)
|
||||
bestlist.sort(key=lambda node: node['score'], reverse=True)
|
||||
bestlist.sort(key=lambda node: node['score'] + 0.00001*(node['se'] if 'se' in node else 0), reverse=True)
|
||||
for i, book in enumerate(bestlist):
|
||||
print("["+str(i+1).zfill(int((math.log10(num) if num!=-1 else 3)+1))+"] "+book['title'] +
|
||||
" ("+" & ".join(book['authors'])+"): {:.5f}".format(book['score']))
|
||||
if t=='book':
|
||||
line = book['title'] + " ("+" & ".join(book['authors'])+")"+": {:.5f}".format(book['score'])
|
||||
else:
|
||||
line = book['label']
|
||||
print("["+str(i+1).zfill(int((math.log10(num) if num!=-1 else 3)+1))+"] "+line)
|
||||
if num!=-1 and i == num-1:
|
||||
break
|
||||
|
||||
@ -804,9 +808,17 @@ def recommenderCompetence(G):
|
||||
removeSeries(G)
|
||||
removeTopLists(G)
|
||||
|
||||
removeEdge(G)
|
||||
removeDangling(G, alsoBooks=True)
|
||||
|
||||
scaleBooksByRating(G)
|
||||
scaleOpinionsByRating(G)
|
||||
addScoreToLabels(G)
|
||||
|
||||
for n in list(G.nodes):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'recommender':
|
||||
node['score'] -= node['se'] * 1
|
||||
|
||||
def readBooksAnalysis(G, minRating=0, showAllTags=True, removeUnconnected=False, removeTopListsB=True):
|
||||
removeUnread(G)
|
||||
@ -1170,6 +1182,8 @@ def cliInterface():
|
||||
train(args.g, args.full)
|
||||
exit()
|
||||
|
||||
bestListT = 'book'
|
||||
|
||||
G, books = buildFullGraph(darkMode=args.dark_mode)
|
||||
mu, std = genScores(G, books)
|
||||
|
||||
@ -1199,20 +1213,20 @@ def cliInterface():
|
||||
elif args.cmd=="full":
|
||||
fullGraph(G, not args.keep_top_lists)
|
||||
elif args.cmd=="competence":
|
||||
bestListT = 'recommender'
|
||||
recommenderCompetence(G)
|
||||
elif args.cmd=="shell":
|
||||
shell(G, books, mu, std)
|
||||
elif args.cmd=="competence":
|
||||
recommenderCompetence(G)
|
||||
return
|
||||
elif args.cmd=="progress":
|
||||
progress(G, args.m)
|
||||
return
|
||||
elif args.cmd=="newBooks":
|
||||
bestListT = 'newBook'
|
||||
newBooks(G, books, args.n, mu, std)
|
||||
else:
|
||||
raise Exception("Bad")
|
||||
|
||||
|
||||
if not args.keep_priv:
|
||||
removePriv(G)
|
||||
if args.remove_read:
|
||||
@ -1226,7 +1240,7 @@ def cliInterface():
|
||||
removeEdge(G)
|
||||
|
||||
if not args.no_list:
|
||||
printBestList(G)
|
||||
printBestList(G, t=bestListT)
|
||||
if not args.no_web and not args.cmd in ['listScores']:
|
||||
genAndShowHTML(G, darkMode=args.dark_mode)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{"topList": 0.020357663923899313, "recommender": 0.3428529069584538, "author": 1.288739952769999, "series": 0.6484880619815447, "tag": 0.026296102297284726, "pagerank": 0.011025414086463162, "mu": 1.1052719819984915, "sigma": 0.5964842267419479, "bias": 0.0346189601467517}
|
||||
{"topList": 0.008877350797718757, "recommender": 0.3310976523405012, "author": 1.2297781106971182, "series": 0.6295690756530204, "tag": 0.029071357518799894, "pagerank": 0.011066788616739529, "mu": 1.1289465103781409, "sigma": 0.6694694643304658, "bias": 0.03536567416040619}
|
Loading…
Reference in New Issue
Block a user