Chapter 5 STL Tutor Architecture and Development
5.8 XML Syntax Parser and Student Model Update Algorithm
5.8.1 XML Syntax Parser
In the authoring of the tutorials, the answers are represented in a simple XML-based format. The data type definition for the format is displayed below:
<?xml version='1.0' encoding='UTF-8'?> <!ELEMENT syntax (eval)*>
<!ELEMENT eval (#PCDATA|eval)*> <!ATTLIST eval
join (and|or) #IMPLIED
allow (string|number) #IMPLIED ignorecase (true|false) #IMPLIED>
The XML elements used are syntax and eval. The element syntax defines the start of the answer syntax using the tags <syntax> and </syntax>. The element eval represents the actual C++ syntax to be evaluated, within the tags <eval> and </eval>. Blank spaces will be trimmed. The attributes consist of join, allow and ignorecase. The valid join values are and and or. The allowed values are string and number. The third attribute is used to indicate whether a statement or variable is case sensitive or not.
An example is shown in Figure 5.7. The example shows the XML describing the answer to populate a vector from the keyboard using a for loop. Each element of the C++ syntax is entered with the <eval> and </eval> tags on a new line to allow blank spaces to be trimmed during the syntax validation process. Some special characters are also required within the syntax. Table 5.5 lists the allowable special characters used within the eval tags. The characters are <, > and &.
Table 5.5 Special Characters SPECIAL CHARACTER ACTUAL CHARACTER < < > > & & <syntax> <eval>for</eval> <eval>(</eval> <eval>i</eval> <eval>=</eval> <eval allow="number">0</eval> <eval>;</eval> <eval>i</eval> <eval><</eval> <eval allow="number">10</eval> <eval>;</eval> <eval>i++</eval> <eval>)</eval> <eval>{</eval> <eval>cin</eval> <eval>>></eval> <eval>aVector</eval> <eval>[</eval> <eval>i</eval> <eval>]</eval> <eval>;</eval> <eval>}</eval> </syntax>
Figure 5.7 XML-based format describing the answer to populate a vector from keyboard.
Figure 5.8 illustrates the three main phases in the XML Syntax Parser to validate the student’s answer during the tutorial session. The phases are Validate Sub-Tutorial
Figure 5.8 Phases in the XML Syntax Parser
In the first phase, two parameters are required – student’s answer and XML syntax answer. The purpose of this phase is to extract the elements in the XML syntax answer required for a particular sub-tutorial that the student is solving. The elements are fed into the second phase to build a list recursively forming the syntax model. Allowable elements are checked within this phase. The list is then recursively validated in the third phase against the required answers, matching element by element. The code is furnished in Appendix I.
Validate Sub-Tutorial Answer
Build ITS Syntax Models
5.8.2 Student Model Update Algorithm
The student model update is handled by a class called TutorialTrxnSBBean in the Tutorial Module. The update is based on the algorithm outlined in Table 4.4 discussed in Chapter 4. Figure 5.9 provides a clearer flow of the algorithm using a flowchart and supplemented with pseudocodes in Figure 5.10 and Figure 5.11.
Obtain Number of Attempts Find Prerequisite Conditional Probability Find Tutorial Track Records of Sub-Tutorial Check Attempts Check conditional probability = 0 = 1 Demote Conditiona1 Probability > 1 Check conditional probability
The initial conditional probabilities for each topic were obtained from the Pre-Test results. Each tutorial is linked to a set of prerequisite topics with conditional probabilities attached to the topics. An average of these conditional probabilities is calculated and checked against the various thresholds. Table 5.6 shows the prerequisite topics and their respective initial conditional probabilities achieved by a student, for a tutorial question entitled “vector – populate using push_back()”. The average of 0.88 is obtained. Therefore, the first hint displayed for the student will be Brief Explanation. These conditional probabilities are then updated during the tutorial session. Generally, the update is performed according to the number of attempts to solve the problem and type of hint presented to the students. Brief explanation, Pre-Test Review, Pre-Tutoring and Demonstration are the various hints or teaching strategies offered to the students during the tutorial session.
Table 5.6 Example of Conditional Probabilities Achieved by a Student PREREQUISITE TOPIC CONDITIONAL PROBABILITY Class Template 0.57 Constructor 0.89 Class 0.94 Array 1.00 Iteration 0.89 Input-Output 1.00 AVERAGE 0.88
Figure 5.10 Update Pseudocode for Number of Attempts = 0 // Number of attempts = 0
If current conditional probability > 0.8 Then If from Pre-Tutoring or from Demo Then
Demote conditional probability Else If from Pre-Test Review
Set new conditional probability to 0.6 End if
Else If 0.6 <= current conditional probability <= 0.8 If from Demo Then
Demote conditional probability Else If from Pre-Tutoring
Set new conditional probability to 0.6 End If
Else
If from Demo Then
Set new conditional probability to 0.1 End If
Figure 5.11 Update Pseudocode for Number of Attempts = 1
The flowchart and the pseudocode above are for the updateCP ( ) function in the class TutorialTrxnSBBean. The function takes in two arguments: sub-tutorial and student data objects. It is invoked after the student has submitted the answer for a sub-tutorial.
The entire code for the class TutorialTrxnSBBean is furnished in Appendix I. // Number of attempts = 1
If current conditional probability > 0.8 Then
If not from Brief Explanation and not from Pre-Test Review
and not from Pre-Tutoring and not from Demo Then Set new conditional probability to 1.0
Else If from Pre-Test Review or from Pre-Tutoring or from Demo Demote conditional probability
Else If from Brief Explanation
Set new conditional probability to 0.6 End If
Else If 0.6 <= current conditional probability <= 0.8 If from Pre-Tutoring or from Demo Then
Demote conditional probability Else If from Pre-Test Review
Set new conditional probability to 0.6 End If
Else
If from Demo Then
Demote conditional probability Else If from Pre-Tutoring
Set new conditional probability to 0.6 End If
5.9
Fuzzy Expert System
The purpose of the Fuzzy Expert System is to categorize students by a stereotype based on their interactions with the C++ STL ITS and performance during the tutoring sessions. The system shall be called the Fuzzy Stereotyping of Students (FSS).
A typical process in developing the FSS incorporates the following steps (Negnevitsky, 2005) :
i) Specify the problem and define linguistic variables.
The objective here is to categorize the students understanding of the C++ STL into novice, beginner, intermediate and advanced.
The linguistic variables are defined in Table 5.7.
ii) Determine fuzzy sets.
The Gaussian fuzzy membership function which produces a very smooth output has been selected to represent the fuzzy sets. Figures 5.12 to Figures 5.15 show the fuzzy sets for all the linguistic variables defined for this problem. Figure 5.12 depicts the membership function plots for the input variable Conditional Probabilities from very low to high. The key point is to ensure sufficient overlap between neighbouring fuzzy sets for the fuzzy system to respond smoothly.
iii) Derive and construct fuzzy rules.
For this problem, there are four input and one output variables. A detailed analysis of the tutorial session produces 128 rules that represent complex relationships between the variable used in the FSS. The output was elicited from an expert’s knowledge. These rules are listed in Appendix J.
iv) Encode the fuzzy sets, fuzzy rules and procedures to perform fuzzy inference into the FSS.
This process is described below using the MATLAB Fuzzy Logic Toolbox.
v) Evaluate and tune the system.
This last step is the most tedious tasks. The objective is to determine whether FSS meets the requirements specified at the beginning. The evaluation details are discussed in section 6.6.
Figure 5.13 Fuzzy Sets of Time
For rapid development of FSS, one of the most popular tools, the MATLAB Fuzzy Logic Toolbox from the MathWorks is used. The toolbox provides graphical interactive tools to create and edit fuzzy inference systems within the framework of MATLAB. There are five main integrated Graphical User Interface (GUI) tools for building, editing, and observing fuzzy inference systems in the Fuzzy Logic Toolbox: the Fuzzy Inference System or FIS Editor, the Membership Function Editor, the Rule Editor, the Rule Viewer, and the Surface Viewer. The tools are easy to use and reduce the laborious tasks to tune the expert system to meet the desired performance.
The FIS Editor handles the specification of the input and output parameters. In FSS, there are four input variables or parameters and one output, known as the linguistic variables. See Table 5.7 for the list of the linguistic variables with their corresponding linguistic values and numerical range. These values were obtained from the Tutorial Performance Report described in section 6.4.
The Membership Function Editor is used to define the shapes of all the membership functions associated with each variable. Some of the membership functions provided include Triangular, Trapezoidal, Gaussian, Bell, S and Z membership functions. The membership functions chosen for FSS are Gaussian for the input variables, and Linear for the output variables. Both functions provide an adequate representation of the expert knowledge.
Table 5.7 Linguistic variables, values, range and membership function Linguistic Variable: Conditional Probabilities, ConditionalProbabilities (Type: Input)
Membership Function: Gaussian
LINGUISTIC VALUE NOTATION NUMERICAL RANGE
Very Low VL [0, 0.01]
Low L [0.4, 0.6]
Medium M [0.62, 0.8]
High H [0.84, 1]
Linguistic Variable: Time taken, Time (Type: Input) Membership Function: Gaussian
LINGUISTIC VALUE NOTATION NUMERICAL RANGE
Very Short VS [1, 10]
Short S [11, 20]
Medium M [21, 30]
Long L [31, 40]
Linguistic Variable: Number of Attempts, Attempts (Type: Input) Membership Function: Gaussian
LINGUISTIC VALUE NOTATION NUMERICAL RANGE
Very Low VL [1, 3]
Low L [4, 6]
Medium M [7, 10]
High H [11, 15]
Linguistic Variable: Number of Hints, Hints (Type: Input) Membership Function: Gaussian
LINGUISTIC VALUE NOTATION NUMERICAL RANGE
Very Low VL [0, 1]
Low L [2, 4]
Medium M [5, 6]
High H [7, 8]
Linguistic Variable: Stereotype of Understanding, Understanding (Type: Output) Membership Function: Linear
LINGUISTIC VALUE NOTATION NUMERICAL RANGE
Very Low VL [0, 0.01]
Low L [0.4, 0.6]
Medium M [0.62, 0.8]
The Rule Editor allows the construction of the fuzzy rules in FSS using the fuzzy linguistic variables specified previously. The fuzzy rules defined in FSS are found in Appendix J.
The Rule Viewer and the Surface Viewer are used for viewing the FIS results. The Rule Viewer is used as a diagnostic tool to show which rules are active and how individual membership function shapes are influencing the results. The Surface Viewer is used to display the dependency of one of the outputs on any one or two of the inputs — that is, it generates and plots a three-dimensional output surface map for the FSS. Both views allow the FSS to be evaluated and tuned to meet the specified requirements.
5.10 Development Tools
The development tools used for the C++ STL ITS project are listed below:
Apache Tomcat (part of JBoss application server) serves as the platform for the JSP and Java Servlet implementation.
Apache Ant provides the framework that enables rapid processes configuration for all phases of the software life cycle. An Ant build process is described in an XML file, called a buildfile (Appendix K).
JBoss Application Server is a J2EE certified platform for developing and deploying the application.
The NetBeans Integrated Development Environment (IDE) together with the Java 2 Platform Standard Edition Development Kit (JDK) provides the environment for writing, compiling, testing, and debugging the web application.