JS-Input Drawing
&
FormulaResponse Feedback
Chris Chudzicki, 8-17-2016


Drawing in physics
- Helpful to illustrate / understand concepts
- Helpful as step in solving complex problems
- Freebody diagrams: multiple choice vs drawing


more authentic
higher cognitive skill
Customresponse & JS-Input
- Customresponse: custom grading through python
- JS-Input: Custom input and display through HTML, Javascript, CSS
<script type="loncapa/python">
<![CDATA[
def check_function(expect, answer):
#Grading code here
]]>
</script>
<customresponse cfn="check_function">
<textline />
<textbox />
<formulaequationinput />
</customresponse><customresponse cfn="check_function">
<jsinput gradefn="getInput"
get_statefn="getState"
set_statefn="setState"
initial_state='{}'
width="660"
height="550"
html_file="/static/problem.html"
/>
</customresponse>- JS-Input: Authoring from scratch vs using existing library
VectorDraw Demo
VectorDraw Code
<problem display_name="Acceleration in Circular Motion">
<script type="loncapa/python">
import python_lib.vectordraw as vectordraw
custom_checks = {'sum_vec': vectordraw.custom.check_sum_vec,}
grader = vectordraw.Grader("Success Message", custom_checks)
cfn = grader.cfn
</script>
<!--Problem Description Here -->
<customresponse cfn="cfn">
<jsinput gradefn="getInput"
get_statefn="getState"
set_statefn="setState"
initial_state='{}'
width="800"
height="500"
html_file="/static/PROBLEM_FILE.html"
/>
</customresponse>
</problem>Problem XML File
VectorDraw Details
- Open-source project started by Daniel Seaton while at Davidson College
Many VectorDraw problems in Davidson Next's AP-support courses - Further development by OpenCraft and Chris (this summer)



VectorDraw Code
// Setup your vectors
vectors: [
{name: 'a_t', description: 'Tangential Acceleration'},
{name: 'a_r', description: 'Radial Acceleration'},
{name: 'a', description: 'Acceleration'},
],
//Convenient, built-in check functions
expected_result: {
'a_t': {tail: [-0.25,4.5], angle:180, angle_errmsg: "Is the particle up or slowing down?"},
'a_r': {tail: [-0.25,4.5], angle:270},
'a' : {tail: [-0.25,4.5], tail_tolerance:3 }
},
//Advanced: all the power of customresponse check functions
custom_checks: [
{
check: 'sum_vec',
vectors: ['a_r', 'a_t', 'a'],
coeffs: [1, 1, -1],
expected: {x:0, y:0},
errmsg: "The acceleration vector drawn is not consistent with its components."
}
]Problem HTML File
One more VectorDraw ...
Not that great for free body diagrams?
Free Body Draw
Better default feedback messages, too!
Drawing Summary
- VectorDraw, open source JS-Input drawing tool
- arrows, lines, line segments, points
- convenient and powerful grading!
- FreeBodyDraw good for free body diagrams
- TODO:
- Get my bug fixes and improvements merged into master
- UI improvements?
- Explore randomized vector problems
Interlude: Pretty Customresponse Feedback

import python_lib.cfn_tools as cfn_tools
# define or import old_check_function
pretty_check_function = pretty( old_check_function )# plus optional settingsWrong-Answer Feedback for <formularesponse/>

Physics courses (8.01, 8.05) have lots of <formularesponse/> problems
Grading FormulaResponse
<problem>
<formularesponse type='cs' answer='r*sin(theta)' samples='theta,r@ 0,4:1,9 #3'>
<!-- cs means case-sensitive -->
<!-- sample theta in range [0,1]-->
<!-- sample r in range [4,9]-->
<responseparam default='1%' type='tolerance'/>
<formulaequationinput inline='1'/>
</formularesponse>
</problem>- Numerically evaluate instructor answer
- Numerically evaluate student answer
- all eval agree (within tolerance) → mark correct
any eval disagree → mark incorrect
- Bad variable ranges can cause grading problems
- Most code in file calc.py
Authoring feedback
Obstacle 2: When should we give feedback?

ODL (Ike's) Dashboard
Obstacle 1: How to code formularesponse feedback?
Two options:
a) python hint function
b) XML <formulahint/> tag
<formularesponse answer="m*c^2" samples="...">
<formulaequationinput inline="1"/>
<hintgroup>
<formulahint answer="m*c^3" samples="..." name="cubed"/>
<hintpart on="cubed"><text>Some Hint</text></hintpart>
</hintgroup>
</formularesponse>Existing analytics tools don't group formularesponse submissions appropriately.
Give feedback for common wrong answers! But ...
Obstacle 3: For which problems is it worth writing feedback?
<problem>
<formularesponse type="cs" answer="m*c^2" samples="m,c@ 1,1:3,3 #5">
<responseparam default="0.01%" type="tolerance"/>
<formulaequationinput inline="1"/>
<hintgroup>
<formulahint answer="m*c^3" samples="m,c@ 1,1:3,3 #5" name="cubed"/>
<hintpart on="cubed"><text>Some Hint</text></hintpart>
</hintgroup>
</formularesponse>
</problem>Example <formulahint/>
FormulaResponse Analyzer


- Group submissions by equivalence:
1. Start with big CSV of student submissions, attempt number, correctness
2. Numerically evaluate submissions (using edX grading libraries)
3. Group submissions by approximate equivalence
- Note: Done (for now) without problem XML
Detect variables from submissions, guess sample ranges


Screenshot is:
file:///Users/cchudzicki/Documents/_dev-personal/FormulaResponseAnalysis/801r-2015/gui/problem/pset_pset7_2_2_1.html
FormulaResponse Analyzer

- Table of contents for problems in a course:
- Few, common wrong answers
→ better for feedback
weight_first_3: what fraction of wrong answers are
top 3 wrong answers?
- Grading issues:
- Graded Correct ... should be 1
How many equivalence groups (according to me) did edX mark as correct - Graded Inconsistent: ... should be zero
How many equivalence groups (according to me) did edX mark some submissions correct, some wrong
- Graded Correct ... should be 1
FormulaResponse Analyzer
- Inconsistent Grading
- Multiple Correct Answers


Automated feedback?

<formularesponse answer="m*c^2" samples="...">
<formulaequationinput inline="1"/>
<hintgroup>
<formulahint answer="m*c^3" samples="..." name="cubed"/>
<hintpart on="cubed"><text>Some Hint</text></hintpart>
</hintgroup>
</formularesponse>- Coding feedback for individual wrong answers is a lot of effort
- not all problems have just a few common wrong answers
Can we provide useful feedback automatically?
Checking Dimensions
- Dimensions = "Length", "Mass", "Time", "Length * Time^-2"
- Wrong answers often have wrong dimension





- Implemented as a hint function that borrows edX formularesponse grading function, but plugs in dimension-jul quantities instead of pure numbers
Checking Dimensions
- Code for
dimension checking
import python_lib.formularesponse_tools.check_dimensions as cd
import python_lib.hfn_tools as hfn_tools
expected = "sqrt(2*h/g)*v_0"
samples = "v_0,g,h@ 1,1,1:2,2,2 #3"
L = cd.Dimension({"Length":1})
T = cd.Dimension({"Time":1})
dims_dict = {'v_0': L/T, 'g': L/T**2,'h': L}
checker = cd.DimensionsChecker(expected, samples, dims_dict)
hint_fn = checker.hint_fn #get hint_fn from checker
hint_fn = hfn_tools.pretty(hint_fn) #make hint_fn pretty- Are dimension errors actually common?

- Is checking dimensions for students pedagogically sound?
complements specific wrong answer approach
import python_lib.formularesponse_tools.check_dimensions as cd
import python_lib.hfn_tools as hfn_tools
expected = "sqrt(2*h/g)*v_0"
samples = "v_0,g,h@ 1,1,1:2,2,2 #3"
L = cd.Dimension({"Length":1})
T = cd.Dimension({"Time":1})
dims_dict = {'v_0': L/T, 'g': L/T**2,'h': L}
checker = cd.DimensionsChecker(expected, samples, dims_dict)
hint_fn = checker.hint_fn #get hint_fn from checker
hint_fn = hfn_tools.pretty(hint_fn) #make hint_fn pretty<formularesponse expected="$expected" samples="$samples">
<!--etc -->
<hintgroup hintfn="hint_fn"/>
</formularesponse>What Next?
- Specific, targeted wrong-answer feedback:
- continue adding feedback to 8.01
-
AB Experiment with feedback?
attempts till correct, competition time, retention within problem
-
Automated Feedback
Augmenting formularesponse with standardized hint_fn seems powerful ...- allow multiple formularesponse correct answers (on purpose)
- sample with complex numbers, e.g., enforce
- Check submission?
- Check if submission is valid vector expression

Thanks!
https://github.com/ChristopherChudzicki/
- edX-author-tools
make hint_fn and check_fn pretty
check dimensions for formularesponse - edX-FormulaResponseAnalyzer
- jsinput-VectorDraw*
- jsinput-FreeBodyDraw
*or use OpenCraft version
JSInput-Drawing and Formularesponse Feedback (MITx Fellows 8-17-2016)
By Christopher Chudzicki
JSInput-Drawing and Formularesponse Feedback (MITx Fellows 8-17-2016)
- 1,002