summaryrefslogtreecommitdiff
path: root/monkey/edits.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-02-25 18:20:47 +0100
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:02 +0200
commit3d73ab2b861f0178001071a7e35c726be46f82ce (patch)
tree29e92525539ebf780bcd75d637297f4ae21020e9 /monkey/edits.py
parent33f8ee41766a24df7b2755a09d1554342394ed93 (diff)
Don't store solution-line frequencies
This is currently unused.
Diffstat (limited to 'monkey/edits.py')
-rw-r--r--monkey/edits.py15
1 files changed, 6 insertions, 9 deletions
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'))