Generalizing a Behavior Graph - CMUCTAT/CTAT GitHub Wiki

This page continues a tutorial on building an example-tracing tutor for a very simple math problem.

Table of Contents

  1. [Let input values vary--flexible input matching[(#let-input-values-vary--flexible-input-matching)
  2. [Let order of steps vary--ordered and unordered groups](#let-order-of-steps-vary--ordered-and-unordered-groups

Let input values vary--flexible input matching

You can take a look at how to allow the students to enter flexible values here: Mass production of answers - SAI matchers.mp4

In this section, we introduce the concept and use of "formulas", powerful expressions that define the way CTAT example-tracing tutors match student input.

A formula is an expression you write for a step in an example-tracing tutor that enables the tutor to calculate a value (or set of values) it should use to test against the student's input.

Formula matching is an extension of existing matching methods. An example-tracing tutor works by comparing student-entered input to the input recorded in the steps of a behavior graph, which you create by demonstration. With the Edit Student Input Matching window, you can change this "exact" match to be more flexible; you can specify:

  • a range match (e.g., "1-10", which matches "6") - an "any" match (i.e., any input value will match)- a wildcard match (e.g., "car*", which matches "cars" and "car")- a regular expression match (e.g., "[THK]im", which matches "Tim", "Him", and "Kim") To learn more about formula matches watch the video here: How to use formula to define answers - SAI formula match.mp4

To learn more about regular expression matches watch the video here: How to use regular expression match to define answers - SAI regular expression match.mp4

With a formula match, the comparison is between the student-entered input and the evaluation of a formula, such as "link1.authorInput+5" (this equates to the value the author entered on Link 1 of the graph, plus 5).

A formula matcher is the most powerful type of matcher in CTAT because it can combine the values of inputs on other links, student-entered input, and the contents of interface components (such as text fields). Whenever you would like to evaluate correctness based on these characteristics, consider writing a formula.

Formulas are particularly useful in a few cases. When you want the tutor to be more general, with a logic that works across similar problems (much like a cognitive tutor). In the case of the Math Challenge tutor, the formula for the links in that path of the graph would specify the addition/subtraction of the given numbers, which can be looked up by using variables that hold the value of components in the interface. Since the formula specifies a general logic, not hard-coded numbers, this graph is then on the way to becoming general enough to use with mass production.

Let’s see an example, Go to Link Editor > SAI Match for link 4 and change the following values in the Input Section:

  • Demonstrated Value: Delete 9 and leave it blank- Matcher Settings: Change Exact Match to Formula Match in the dropdown- Matcher Settings: Change 9 to n1+n2 in open-ended box See how the behavior graph link 4 is only "4. result" instead of "4. result, 9" If you do this for links 7 and 9 too then next time when you are defining the behavior graph for the same interface you just need to change the start state values. Like if you enter them as 9 and 6 then the formula match will expect 15 in link 4 as it is matching n1+n2 values from the interface.

Another benefit of formulas is when you need to specify a test (against a student action) that can only be determined at the time the student uses the tutor, a formula allows you to do so. For example, in the domain of fraction addition, you may have a set of common denominators that are valid for the current problem; but once the student uses one of those denominators in a converted fraction, he or she should use that same denominator in the other converted fractions and the unsimplified sum fraction. With a formula, you can check that the student chose a common denominator; then you can require the student to use that denominator in the other fractions.

You can call any JavaScript function that is available in the global scope in your formulas. For documentation on the additional functions implemented in CTAT, see Formula Functions.

To use the value of a variable in a hint or feedback message, use the following syntax in the hint message: <%=variableName%>

For example, to reference component variables in a hint message in Math Challenge tutor:

How much is <%=n1%> + <%=n2%>?

You can use this same syntax to insert the result of a formula in a hint or feedback message. The following example uses the + operator to find the sum of two numbers, and prints the result:

Please enter <%=n1 + n2%> in the highlighted field.

Let order of steps vary--ordered and unordered groups

You can make a group of steps ordered or unordered depending on how you want the students to approach the problem. To watch the video click here: How to set ordered or unordered steps.mp4

Enabling the ordered mode will require students to work through the problem in the same order as demonstrated. Disabling it will allow students to work in any order they choose.

For the online CTAT, right now we are only supporting toggling the ordered mode globally which means that except for the Done button step we can make all of the other steps to be performed in order or any order. By default, all steps are unordered.

For example, if we look at the math challenge tutor, it might be that you don’t care if the student selects the operator first before doing the calculation or calculate the final answer before selecting what operation they performed. We only want the tutor to accept clicking on the done button when you have completed both of the previous steps.

In this case, since the default mode is unordered, it should allow you to test the tutor by entering the answer first before selecting the operator.

 For more fine-grained definitions of required step order (e.g., if some, but not all, steps should be done in order), you may create ordered or unordered groups of links within your behavior graph. A student must follow the order of an unordered group but is free to do the steps of an unordered group in any order.

To create a group, select a link in the behavior graph, right-click, and select “Create new group.” Give the group a short but meaningful name. To add a link to a group or remove a link from a group, right-click on the link and select the corresponding command. Groups must be formed one link at a time.

Groups can be nested, which is sometimes useful.

⚠️ **GitHub.com Fallback** ⚠️