# Cognitive Diagnosis Method via Q-Matrix-Embedded Neural Networks
## 2 Materials and Methods
### Q-Matrix Constraint-Based Neural Network  
Deep feedforward neural networks, also known as multilayer perceptions (MLPs; [20]), were first proposed by [PERSON] in 1957. However, it was not until 1986 that the backpropagation (BP) algorithm was introduced by [PERSON] [21], which successfully solved the weight adjustment problem for multilayer neural networks and greatly advanced the research on neural networks. In the introduction, we discussed that some researchers have attempted to use artificial neural networks for cognitive diagnosis. In this article, we designed a deep neural network model for cognitive diagnosis, named the Dual Q-netcognitive diagnosis model, with a Q-matrix \(\mathbf{Q}\) and interactive Q-matrix \(\mathbf{Q}^{*}\) as constraints. The network architecture is shown in Figure 2.  
Before introducing Dual Q-Net, let us first review the GDINA model [7], whose core computational method is shown in Equation (8). \[P(\mathbf{\alpha}_{ij}^{*})=\delta_{j0}+\sum_{k=1}^{K_{j}^{*}}\delta_{jk}\alpha_{lk }+\sum_{k^{\prime}=k+1}^{K_{j}^{*}}\sum_{k=1}^{k_{j}^{*}-1}\delta_{jk^{\prime} }\alpha_{lk}\alpha_{lk^{\prime}}+\ldots+\delta_{j12\ldots K_{j}^{*}}\prod_{k=1} ^{K_{j}^{*}}\alpha_{lk} \tag{8}\]  
where \(K^{*}j\) denotes the number of attributes actually assessed by item \(j\), \(\delta_{j0}\) serves as the intercept for item \(j\), \(\delta_{jk}\) represents the main effect due to \(\alpha_{k}\), and \(\delta_{j12,\ldots,Kj}\) indicates the interaction effect due to \(\alpha_{1},\ldots,\alpha_{K_{j}^{*}}\). According to the GDINA calculation, the probability of correctly answering item \(j\) for a given skill mastery pattern \(\mathbf{\alpha}_{ij}^{*}\) consists of three parts. They are the first part in the Equation (8) (i.e., \(\delta_{j0}\)), which can be interpreted as the guessing rate or the intercept; the second part (i.e., \(\sum_{k=1}^{K_{j}^{*}}\delta_{jk}\alpha_{lk}\)) that represents the direct contribution of skills to the correct answer; and the residual terms that represent the contribution of skill interactions to the correct answer. Inspired by the GDINA model, the core computation process of Dual Q-Net is designed to consist of three parts, where the orange line represents the main effect, and the green line represents the interaction effect. The combined contribution of the orange and green lines to the mastery status of skills is represented by the central purple line. In addition, we introduced a Q-matrix inside the network structure to constrain the number of neurons in each layer and the connections between layers. In Figure 2, the orange line consists of an input layer and a hidden layer. The dimension of the input layer is \(J\), and the dimension of the hidden layer is \(K\). Each neuron in the input layer represents an item, while each neuron in the hidden layer represents a skill. A connection between the input layer and the hidden layer only exists  
Figure 2: The neural network architecture of the Dual Q-Net cognitive diagnostic model. Note, the orange line (i.e., the orange computational flow with a vertical striped background) indicates that the main effect is constrained by the Q matrix. The green line (i.e., the green computational flow with a horizontal striped background) indicates that the secondary effect between skills is constrained by the interactive Q matrix. The purple line (i.e., the purple computational flow with a diagonal striped background) represents the combination of the main effect with the secondary effect. The blue neuron (i.e., the blue computational flow with a plain, unstriped background) represents the loss function used to calculate the loss value. The cyan \(\mathbf{X}\)-blocks and the green \(\mathbf{A}\)-blocks represent the student response data and skill mastery patterns, respectively. Both are considered external data, with the former serving as input data for the model and the latter as supervision data. when item \(j\) examined skill \(k\), which is implemented by the Q-matrix, e.g., Equation (1).