From 01d41f3a821fb24993e77132381387cd85273fd5 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Tue, 22 Feb 2022 15:03:51 +0100 Subject: [PATCH] Fixed bin accumulation; added perf-test --- caliGraph.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/caliGraph.py b/caliGraph.py index 703874d..b1929af 100755 --- a/caliGraph.py +++ b/caliGraph.py @@ -418,8 +418,8 @@ def scoreUnread(G, globMu, globStd): if 'score' in adjNode and adjNode['score'] != None: w = adjNode['t'] for fb in adjNode['feedbacks']: - neuralBins[w].append(fb) feedbacks.append(fb) + neuralBins[w].append(adjNode['score']) node['mean'], node['std'] = norm.fit(feedbacks) node['median'] = np.percentile(feedbacks, [50], method='linear')[0] node['se'] = globStd / math.sqrt(len(feedbacks)) @@ -1331,6 +1331,7 @@ def cliInterface(): parser.add_argument('--dark', action="store_true") parser.add_argument('--v3d', action="store_true") parser.add_argument('--imgs', action="store_true") + parser.add_argument('--perf-test', action="store_true") cmds = parser.add_subparsers(required=True, dest='cmd') p_rec = cmds.add_parser('recommend', description="TODO", aliases=['rec']) @@ -1370,6 +1371,24 @@ def cliInterface(): args = parser.parse_args() + if args.perfTest: + perfTestCLI(args) + else: + mainCLI(args) + +def perfTestCLI(args): + from pycallgraph import PyCallGraph + from pycallgraph import Config + from pycallgraph import GlobbingFilter + from pycallgraph.output import GraphvizOutput + config = Config() + config.trace_filter = GlobbingFilter(exclude=[ + "pycallgraph.*", + ]) + with PyCallGraph(output=GraphvizOutput(output_file='perfTests/serve_httpd_' + str(int(time.time())) + '.png'), config=config): + mainCLI(args) + +def mainCLI(args): if args.cmd=="train": train(args.g, args.full) exit()