Added 'competence' command (displays recommenders and justifications of
their scores)
This commit is contained in:
parent
aa95a9b16b
commit
da9569fd4c
31
caliGraph.py
Executable file → Normal file
31
caliGraph.py
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
#!./.venv/bin/python3.9
|
||||
#!./.venv/bin/python3.10
|
||||
import os
|
||||
import json
|
||||
import math
|
||||
@ -291,6 +291,17 @@ def removeRecommenders(G):
|
||||
if node['t'] == 'recommender':
|
||||
G.remove_node(n)
|
||||
|
||||
def removeAuthors(G):
|
||||
for n in list(G.nodes):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'author':
|
||||
G.remove_node(n)
|
||||
|
||||
def removeSeries(G):
|
||||
for n in list(G.nodes):
|
||||
node = G.nodes[n]
|
||||
if node['t'] == 'series':
|
||||
G.remove_node(n)
|
||||
|
||||
def removeRestOfSeries(G):
|
||||
for n in list(G.nodes):
|
||||
@ -703,6 +714,18 @@ def fullGraph(G, removeTopListsB=True):
|
||||
addScoreToLabels(G)
|
||||
|
||||
|
||||
def recommenderCompetence(G):
|
||||
#removeRead(G)
|
||||
removeUnread(G)
|
||||
removeTags(G)
|
||||
removeAuthors(G)
|
||||
removeSeries(G)
|
||||
removeTopLists(G)
|
||||
|
||||
scaleBooksByRating(G)
|
||||
scaleOpinionsByRating(G)
|
||||
addScoreToLabels(G)
|
||||
|
||||
def readBooksAnalysis(G, minRating=0, showAllTags=True, removeUnconnected=False, removeTopListsB=True):
|
||||
removeUnread(G)
|
||||
removeBad(G, minRating)
|
||||
@ -873,7 +896,7 @@ def train(initGamma, full=True):
|
||||
best_mse = mse
|
||||
stagLen = 0
|
||||
|
||||
while gamma > 3.0e-05 and delta > 3.0e-05 or best_mse > 3:
|
||||
while gamma > 3.0e-05 and delta > 5.0e-05 or best_mse > 10:
|
||||
last_mse = mse
|
||||
print({'mse': mse, 'gamma': gamma, 'delta': delta})
|
||||
delta = sum(gradient[g]**2 for g in gradient)
|
||||
@ -957,6 +980,8 @@ def cliInterface():
|
||||
p_prog = cmds.add_parser('progress', description="TODO", aliases=[])
|
||||
p_prog.add_argument('-m', type=float, default=7, help='Mimimum Score to read')
|
||||
|
||||
p_comp = cmds.add_parser('competence', description="TODO", aliases=[])
|
||||
|
||||
p_full = cmds.add_parser('full', description="TODO", aliases=[])
|
||||
|
||||
args = parser.parse_args()
|
||||
@ -988,6 +1013,8 @@ def cliInterface():
|
||||
analyze(G, args.type, args.name, args.d)
|
||||
elif args.cmd=="full":
|
||||
fullGraph(G, not args.keep_top_lists)
|
||||
elif args.cmd=="competence":
|
||||
recommenderCompetence(G)
|
||||
elif args.cmd=="progress":
|
||||
progress(G, args.m)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user