In [1]:
%run prelude.ipy
In [17]:
def common_errors(base, version=None, threshold=2):
ts = util.filter_program(trials, base, version)
ts = ts[-ts.grade_correct]
clusters = util.grading.cluster_responses(ts.pred_output.values)
return [c for c in clusters if c[1] > threshold]
In [46]:
x = programs[["base", "version"]]
x["output"] = x.apply(lambda r: data.hansen_2012.program_output(r["base"], r["version"]), axis=1)
x["count"] = x.apply(lambda r: len(util.filter_program(trials, r["base"], r["version"])), axis=1)
x["base_count"] = x.apply(lambda r: len(util.filter_program(trials, r["base"])), axis=1)
x
Out[46]:
In [18]:
common_errors("between")
Out[18]:
In [21]:
common_errors("counting")
Out[21]:
In [22]:
common_errors("funcall")
Out[22]:
In [26]:
for v in programs[programs.base == "initvar"].version:
print v, common_errors("initvar", v)
In [27]:
common_errors("order")
Out[27]:
In [28]:
for v in programs[programs.base == "overload"].version:
print v, common_errors("overload", v)
In [30]:
for v in programs[programs.base == "partition"].version:
print v, common_errors("partition", v)
In [33]:
common_errors("rectangle")
Out[33]:
In [36]:
trials[(trials.base == "rectangle") & -trials.grade_correct].pred_output
Out[36]:
In [38]:
common_errors("scope")
Out[38]:
In [39]:
common_errors("whitespace")
Out[39]: