Better newBooks
This commit is contained in:
parent
bcec24fbf7
commit
05a51cd5e6
17
caliGraph.py
17
caliGraph.py
@ -992,7 +992,7 @@ def progress(G, minimum=3.5):
|
|||||||
print('Progress: '+str(perc)+'%')
|
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
|
from fuzzywuzzy import fuzz
|
||||||
type_ident = type_name[0]
|
type_ident = type_name[0]
|
||||||
full_name = type_ident + "/" + name
|
full_name = type_ident + "/" + name
|
||||||
@ -1009,7 +1009,7 @@ def analyze(G, books, type_name, name, dist=2.1):
|
|||||||
if bestRatio < 70:
|
if bestRatio < 70:
|
||||||
print("Best Match: "+match['label'])
|
print("Best Match: "+match['label'])
|
||||||
|
|
||||||
findNewBooks(G, books, num=-1, minRecSco=1)
|
findNewBooks(G, books, mu, num=-1, minRecSco=1)
|
||||||
|
|
||||||
menge = set()
|
menge = set()
|
||||||
waveFlow(G, match, n, dist, menge)
|
waveFlow(G, match, n, dist, menge)
|
||||||
@ -1095,8 +1095,8 @@ def shell(G, books, mu, std):
|
|||||||
|
|
||||||
def newBooks(G, books, num, mu, std):
|
def newBooks(G, books, num, mu, std):
|
||||||
removeBad(G, mu-std*2)
|
removeBad(G, mu-std*2)
|
||||||
|
findNewBooks(G, books, mu, num, minRecSco = mu-std)
|
||||||
removeThinRecs(G, 2)
|
removeThinRecs(G, 2)
|
||||||
findNewBooks(G, books, num, minRecSco = mu-std)
|
|
||||||
removeUnread(G)
|
removeUnread(G)
|
||||||
removeUselessReadBooks(G)
|
removeUselessReadBooks(G)
|
||||||
removeTags(G)
|
removeTags(G)
|
||||||
@ -1110,7 +1110,7 @@ def newBooks(G, books, num, mu, std):
|
|||||||
addScoreToLabels(G)
|
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')
|
mrbdf = pd.read_csv('mrb_db.csv')
|
||||||
recs = []
|
recs = []
|
||||||
for n in list(G.nodes):
|
for n in list(G.nodes):
|
||||||
@ -1148,9 +1148,10 @@ def findNewBooks(G, books, num=-1, minRecSco=5):
|
|||||||
G.remove_node(n)
|
G.remove_node(n)
|
||||||
else:
|
else:
|
||||||
ses.append(min(ses))
|
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))
|
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['score']*=0.80
|
||||||
node['value'] = 20 + 5 * float(node['score'])
|
node['value'] = 20 + 5 * float(node['score'])
|
||||||
node['label'] += " ({:.2f}±{:.1f})".format(node['score'], node['fake_se'])
|
node['label'] += " ({:.2f}±{:.1f})".format(node['score'], node['fake_se'])
|
||||||
@ -1342,7 +1343,7 @@ def cliInterface():
|
|||||||
if args.new==-1:
|
if args.new==-1:
|
||||||
args.new = int(args.n / 5)
|
args.new = int(args.n / 5)
|
||||||
if args.new != 0:
|
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.tag_based:
|
||||||
if args.recommender_based:
|
if args.recommender_based:
|
||||||
raise Exception('tag-based and recommender-based can not be be combined')
|
raise Exception('tag-based and recommender-based can not be be combined')
|
||||||
@ -1356,7 +1357,7 @@ def cliInterface():
|
|||||||
elif args.cmd=="read":
|
elif args.cmd=="read":
|
||||||
readBooksAnalysis(G, args.min_rating, args.all_tags, args.only_connected, not args.keep_top_lists)
|
readBooksAnalysis(G, args.min_rating, args.all_tags, args.only_connected, not args.keep_top_lists)
|
||||||
elif args.cmd=="analyze":
|
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":
|
elif args.cmd=="full":
|
||||||
fullGraph(G, not args.keep_top_lists)
|
fullGraph(G, not args.keep_top_lists)
|
||||||
elif args.cmd=="competence":
|
elif args.cmd=="competence":
|
||||||
|
Loading…
Reference in New Issue
Block a user