# Calibrated Q-Matrix-Enhanced Deep Knowledge Tracing with Relational Attention Mechanism
## 4 Methods
### Calibrated Q-Matrix Relational Attention Knowledge Tracing Model
#### 4.2.1 Q-Matrix Generation and Validation  
If an exercise \(i\) contains a KC k, then Q\({}_{ik}\) = 1; Q\({}_{ik}\) = 0 otherwise. Each row of the Q-matrix presents a vector of knowledge points that can relate an exercise to the corresponding KCs. However, when considering that an exercise often relates several numbers of KCs and a KC is also contained in several exercises, a binary skill mastery vector cannot take the relationship between exercises and KCs into account and cannot reveal the hierarchical knowledge levels of KCs based on the knowledge graph. Therefore, a hierarchical knowledge-level-based Q-matrix calibration method (**HKLQC**) was designed to solve those problems using the following algorithm in Algorithm 1. A partial order \(>_{i}^{+}\) is defined as:  
\[a_{level:0}>_{i}^{+}b_{level:1}>_{i}^{+}c_{level:2} \tag{14}\]This means that KC: a has more knowledge importance than KC: b in exercise e\({}_{i}\) and KC: b is a more significant knowledge concept than KC: c in exercise e\({}_{i}\). a\({}_{level}\).o, b\({}_{level}\):1, and c\({}_{level}\):2 imply that KC: a, KC: b, and KC: c belong to hierarchical knowledge Levels 0, 1, and 2,respectively. For example, the real number is regarded as the parent node of the rational number, and the parent node of the fraction is the rational number. Therefore, in the knowledge map, the hierarchical knowledge level of the real number is 0, the hierarchical knowledge level of the rational number is 1, and the hierarchical knowledge level of the fraction is 2. The partial order set is defined as  
\[D_{HKLQC}=\{(i,a,b)|a>_{i}^{+}b,i=1,2,3...K_{n}\} \tag{15}\]  
Based on traditional Bayesian treatment, the calibrated Q-matrix, \(\hat{Q}\), follows a zero mean Gaussian prior with the standard deviation. To give the Q-matrix labels greater confidence, we define \(p(a>_{i}^{+}b|\hat{Q})\) with a pairwise logistic-like function:  
\[p(a>_{i}^{+}b)=\frac{1}{1+e^{\lambda(a_{level}-b_{level})}} \tag{16}\]  
where \(\lambda\), which is the hyper-parameter, controls the discrimination between different hierarchical knowledge levels. As a result, the posterior log probability over D\({}_{KHLQC}\) on \(\hat{Q}\) can be calculated as:  
\[ \begin{split} lnp(\hat{Q}|D_{KHLQC})=ln\prod_{(i,a,b)_{KHLQC}}p( a>_{i}^{+}b|\hat{Q}_{i})p(\hat{Q}_{i})\\ =\sum_{i=1}^{E}\sum_{a=1}^{k_{a}}\sum_{b=1}^{k_{a}}I(a>_{i}^{+}b) ln\frac{1}{1+e^{\lambda(a_{level}-b_{level})}}+C-\sum_{i=1}^{E}\sum_{j=1}^{k_{a}} \frac{\hat{Q}_{ij}^{2}}{2\sigma^{2}}\end{split}  \tag{17}\]  
where C is a constant and I(*) is used as an indicator that equals 1 when the condition * is met. Finally, a calibrated Q-matrix \(\hat{Q}\), which is estimated by the KHLQC approach, is obtained. To evaluate the performances of the RAKT model and its extension model, QRAKT, previous approaches are compared in the following part. The details of those approaches are as follows:  
1. DKT [8]: DKT was used as an implementation of LSTM, which incorporates a set of one-hot representations of exercises to predict the performance of students on the next interaction on certain exercises. 2. DKT+ [40]: DKT+ is an extension of DKT and addresses two problems in DKT, including the failure of the model to reconstruct the observed input and the lack of consistency in the performance of students across time steps. 3. DKVMN [41]: This model is based on a memory-augmented recurrent neural network, which combines the relationship between different KCs presented by the **key** matrix with the learner mastery matrix presented by the **value** matrix. 4. SAKT [23]: This model applies the self-attention mechanism [38], which assigns different attention weights for different exercises to predict the performance of learners on certain exercises. 5. EKT [10]: This model explores both student's exercise records and the textual information of corresponding exercises. This model also applies the knowledge state matrix to incorporate knowledge concept information. 6.