MITx Grading Library: An Overview #

The mitxgraders Python library provides a number of configurable Python classes that can be used as graders in edX custom response problems.

Why use MITxGraders #

Use MITxGraders because it:

Two Typical Examples #

Typical usage in an edX course looks like:

<script type="text/python">
from mitxgraders import *
grader = FormulaGrader(
    # allows students to use generic functions f and f' in their input
    user_functions={"f": RandomFunction(), "f'": RandomFunction()}

  <p>Enter the derivative of \(g(x) = e^{f(x^2)} \).</p>
  <!-- answer is provided to the grader when using single inputs -->
  <customresponse cfn="grader" answer="e^(f(x)) * f'(x^2) * 2*x">
    <textline math="true" />


The resulting problem would be similar to an edX <formularesponse /> problem, but allows students to use additional generic functions f(x) and f'(x) in their submissions.

The next example grader would grade an unordered list of mathematical expressions.

<script type="text/python">
from mitxgraders import *
grader = ListGrader(
    answers=['x-2', 'x+2'],

  <p>What are the linear factors of \((x^2 - 4)\)? Enter your answers in any order.</p>
  <customresponse cfn="grader">
    <!-- correct_answer is shown to student when they press [Show Answer].
         Its value is not used for grading purposes -->
    <textline math="true" correct_answer="x - 2" />
    <textline math="true" correct_answer="x + 2" />


Loading in edX #

Download and place it in your static folder (XML workflow) or upload it as a file asset (Studio workflow). If you already have a, you'll need to merge ours with yours and re-zip. If you want to use our AsciiMath renderer definitions (if you have math problems, you'll really want this!), place the MJxPrep.js file in your static folder (XML) or upload the file to your course assets (Studio).

The basic idea of this library is that it contains a number of classes that can be used as the check function for an edX custom response problem. Different classes of grader are used for different inputs. We begin by presenting a brief overview on how the grading classes are used in general.

Grading Classes #

Grading classes generally fall into two categories: single-input graders and multi-input graders.

Single-input graders grade a single input. All single-input graders are built on a framework we call an ItemGrader. We recommend understanding how ItemGraders work before diving into more specifics.

Multi-input graders are for grading multiple input boxes at once. They are composed of single-input graders working in concert, handled by the general ListGrader class. ListGrader is the only multi-input grader included in the library, but is incredibly general.

Specialized graders are used to grade very specific situations. The only specialized grader we presently have is IntegralGrader, although plugins can be used to construct further examples.

Questions? Bugs? Issues? Suggestions? #

Please contact us by making an issue on github.