# A Cognitive Diagnosis Model Using Convolutional Neural Networks to Predict Student Scores
## 3 Materials and Methods
### CNNCD Model
#### 3.2.1 Attention Module  
The good effect of the previous model often depends on having sufficient data, such as the students' answers and the relationship matrix between the questions and the knowledge points. However, in an actual situation, these data may be insufficient, and the relationship between students, test questions and knowledge points will also affect students' problem-solving. In this paper, the attention mechanism is used to explore the interrelationship among students, questions and knowledge points.  
In exploring the intra-layer relationship between students, the linear change in students' usual grade \(R_{usual}\) is determined first.  
\[Q_{1}=R_{usual}\cdot W^{Q}_{1}, \tag{1}\]  
\[K_{1}=R_{usual}\cdot W^{K}_{1}, \tag{2}\]  
\[V_{1}=R_{usual}\cdot W^{V}_{1}, \tag{3}\]  
where \(W^{Q}_{1}\), \(W^{K}_{1}\) and \(W^{V}_{1}\) are the weight matrix coefficients of the linear change in the student's scores on the usual quizzes \(R_{usual}\).  
The relationship between students is  
\[C(S,S)=softmax(\frac{Q_{1}K^{T}_{1}}{\sqrt{d_{K_{1}}}}), \tag{4}\]  
where \(d_{K_{1}}\) is a scale factor and also a dimension of \(K_{1}\).  
After the relationship between students is obtained, the usual quizzes answering factor integrating the relationship between students is expressed as  
\[R^{\prime}_{usual}=C(S,S)\cdot V_{1}, \tag{5}\]According to the above formula, the relationship between students can be calculated, so as to obtain the usual quizzes answering factor \(R^{\prime}_{usual}\), which integrates the relationship between students. In the same way, the relationship \(\mathrm{C}(K,K)\) between knowledge points can be calculated based on the correlation matrix \(q_{1}\) between usual quizzes and knowledge points, so as to obtain the usual quizzes and knowledge points association matrix \(q^{\prime}_{1}\) integrating the relationship between knowledge points.  
Since the final goal of the model is to predict the scores of the final exam questions, it is also necessary to calculate the relationship between the usual quizzes and the final exam questions \(\mathrm{C}(E_{1},E_{2})\), so as to obtain the final exam questions and knowledge points correlation matrix \(q^{\prime}_{2}\) integrating the relationship between the usual quizzes and the final exam questions. The calculation process is as follows.  
First, \(q_{1}\) and \(q_{2}\) are linearly transformed, respectively.  
\[Q_{2} =q_{2}\cdot W^{Q}_{2}, \tag{6}\] \[K_{2} =q_{1}\cdot W^{K}_{2},\] (7) \[V_{2} =q_{1}\cdot W^{V}_{2}, \tag{8}\]  
where \(W^{Q}_{2}\) is the weight matrix coefficient of the linear change in the correlation matrix \(q_{2}\) between the final exam questions and the knowledge points, and \(W^{K}_{2}\) and \(W^{V}_{2}\) are the weight matrix coefficients of the linear change in the correlation matrix \(q_{1}\) between the usual quizzes and the knowledge points.  
The relationship between the usual quizzes and the final exam questions is  
\[\mathrm{C}(E_{1},E_{2})=soft\mathrm{max}(\frac{Q_{2}K^{T}_{2}}{\sqrt{d_{k_{2} }}}), \tag{9}\]  
where \(d_{k_{2}}\) is a scale factor and a dimension of \(K_{2}\).  
The final exam questions and knowledge points correlation matrix integrating the relationship between the usual quizzes and the final exam questions is  
\[q^{\prime}_{2}=\mathrm{C}(E_{1},E_{2})\cdot V_{2}, \tag{10}\]