Better pruning of tags and recommenders
This commit is contained in:
parent
9d03b37e16
commit
06a0461e93
11
caliGraph.py
11
caliGraph.py
@ -169,7 +169,7 @@ def removeTags(G):
|
||||
|
||||
|
||||
def pruneTags(G, minCons=2):
|
||||
for n in list(G.nodes):
|
||||
for n in sorted(list(G.nodes), key=lambda i: G.nodes[i]['score'] + len(G.nodes[i]['feedbacks'])/5 if 'score' in G.nodes[i] and 'feedbacks' in G.nodes[i] else 0):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'tag':
|
||||
foundCon = 0
|
||||
@ -188,7 +188,7 @@ def pruneTags(G, minCons=2):
|
||||
|
||||
|
||||
def pruneRecommenders(G, minCons=2):
|
||||
for n in list(G.nodes):
|
||||
for n in sorted(list(G.nodes), key=lambda i: G.nodes[i]['score'] if 'score' in G.nodes[i] else 0):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'recommender':
|
||||
foundCon = 0
|
||||
@ -638,11 +638,12 @@ def recommendNBooksTagBased(G, mu, std, n, removeTopListsB=True):
|
||||
|
||||
def recommendNBooks(G, mu, std, n, removeTopListsB=True, removeUselessRecommenders=True):
|
||||
removeRestOfSeries(G)
|
||||
removeBad(G, mu-std-1)
|
||||
removeBad(G, mu-std-0.5)
|
||||
removeBad(G, mu+std/2, groups=['recommender'])
|
||||
removeKeepBest(G, int(n*2) + 5, maxDistForRead=2)
|
||||
removeEdge(G)
|
||||
removeHighSpanTags(G, 12)
|
||||
removeHighSpanReadBooks(G, 6)
|
||||
removeHighSpanTags(G, 10)
|
||||
removeHighSpanReadBooks(G, 10)
|
||||
removeDangling(G, alsoBooks=False)
|
||||
pruneRecommenders(G, 13)
|
||||
pruneTags(G, 13)
|
||||
|
Loading…
Reference in New Issue
Block a user