From 3d73ab2b861f0178001071a7e35c726be46f82ce Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 25 Feb 2015 18:20:47 +0100 Subject: Don't store solution-line frequencies This is currently unused. --- monkey/edits.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'monkey/edits.py') diff --git a/monkey/edits.py b/monkey/edits.py index c625946..e522964 100644 --- a/monkey/edits.py +++ b/monkey/edits.py @@ -12,9 +12,9 @@ from .util import get_line, avg, logistic # representing development history. Each node represents a particular version # of some line, and each edge represents a "line edit" (contiguous sequence of # inserts/removes within a single line). -# Return a list of nodes (first element is the root), and sets of submissions -# (program versions tested by the user) and queries in this attempt. -def trace_graph(trace, debug=False): +# Return a list of nodes with root as the first element. Also return sets of +# submissions (user-tested program versions) and queries in this attempt. +def trace_graph(trace): # Return values. nodes = [Node([0, 0, ()])] # Node data: rank (Y), line no. (X), and tokens. submissions = set() # Program versions at 'test' actions. @@ -211,9 +211,7 @@ def get_edits_from_traces(traces): for edit, p in edits.items(): edits[edit] = logistic(p, k=3, x_0=avg_p) - lines = dict(n_leaf) - - return edits, lines, submissions, queries + return edits, submissions, queries def classify_edits(edits): inserts = {} @@ -240,13 +238,12 @@ if __name__ == '__main__': from tutor.models import Attempt, Problem edits = {} - lines = {} submissions = {} queries = {} for problem in Problem.objects.all(): print(problem.name) pid = problem.pk traces = [a.trace for a in Attempt.objects.filter(problem=problem, done=True)] - edits[pid], lines[pid], submissions[pid], queries[pid] = get_edits_from_traces(traces) + edits[pid], submissions[pid], queries[pid] = get_edits_from_traces(traces) - pickle.dump((edits, lines, submissions, queries), open('edits.pickle', 'wb')) + pickle.dump((edits, submissions, queries), open('edits.pickle', 'wb')) -- cgit v1.2.1