# Mining on Students' Execution Logs and Repairing Compilation Errors Based on Deep Learning
## 3 Mining on Students' Execution Logs
\begin{table}
\begin{tabular}{c c c} \hline
**Error Type** & **Error Description** & **Compiler Feedback Example** \\ \hline E1 & Variable undefined & ’d’ unddeclared (first use in this function) \\ E2 & Missing delimiter & expected ’;’ before ’)’ token \\ E3 & Missing variables or special symbols & expected identifier before ’\&’ token \\  & & expected ’=’, ’, ’, ’, ’, ’, ’asm’ or ’\_attribute\_ ’ before ’b’ \\ E4 & Misuse of expressions & 1 value required as left operand of assignment \\  & & expected expression before ’=’ token \\ E5 & Illegal character error & stray ’346’ in program \\ E6 & Misuse of data types & invalid operands to binary \& (have ’int’ and ’int’) \\ E7 & Other errors & too few arguments to function ’reverse’ \\  & & ’else’ without a previous ’if’ \\ \hline \end{tabular}
\end{table} 
Table 2: Program error types and compiler feedback examples. ### Evaluation Metrics

We utilize three metrics to evaluate the effectiveness of the model. 1. LocalizeAcc: This represents the accuracy of the model in correctly predicting the erroneous line for a given error in the generated dataset. This metric assesses the model's ability to localize the error accurately. 2. SingleAcc: This metric measures the accuracy of the model in predicting the correct fix for a single line repair example in the generated dataset. It evaluates the model's capability to accurately generate the appropriate repair patch. 3. RepairAcc: This metric indicates the success rate of the model in producing fully compilable program fixes, as verified by the compiler, on a real dataset. It assesses the model's overall capability in generating program repairs that pass compilation integrity. Given an erroneous program set \(\mathbf{D}\), with corresponding real error positions \(i_{err}\) and the corresponding repair patches \(x_{i_{err}}\), along with a validator \(C\) that can determine if program \(p\) contains errors, we define \(d(p)\) as the model's prediction of the erroneous line number for the current program \(p\), \(f(p)\) as the model's prediction of the repair patch for the erroneous line in the current program \(p\), and \(g(p)\) as the final result after an iterative repair process by the model. The calculation methods for the three evaluation metrics are as follows:

\[\text{LocalizeAcc}= \frac{|\{p|p\in\mathbf{D},d(p)=i_{err}\}|}{|\mathbf{D}|} \tag{16}\] \[\text{SingleAcc}= \frac{|\{p|p\in\mathbf{D},f(p)=x_{i_{err}}\}|}{|\mathbf{D}|}\] (17) \[\text{RepairAcc}= \frac{|\{p|p\in\mathbf{D},C(g(p))=1\}|}{|\mathbf{D}|} \tag{18}\]

### Training Details

#### 6.4.1 Rookie Simulator

The model architecture of the RS was based on the encoder-decoder Transformer. The model consisted of four layers each for the encoder and decoder. The attention heads for multi-head attention were set to 8, and the vector dimension for the hidden layer states was 256. The feature dimension for the feedforward neural network was set to 1024. During the training phase, the model parameters were optimized using the Adam optimizer [27]. The batch size for model training was set to 13,500 tokens. The learning rate was set to 0.001 and adjusted using a warm-up strategy, with an initial learning rate of 0.0001. To prevent overfitting, a dropout rate of 0.2 was used. Label smoothing was applied with a smoothing factor of 0.1. Gradient clipping [28] was set to 1.0 to limit the magnitude of gradients. The model was trained for 20 epochs. During the predicting phase, we used beam search for generating predicted erroneous code statements. The beam size was set to 10, meaning the model predicts and outputs the top 10 sequences with the highest joint probabilities for the given input data. #### 6.4.2 Acnpr Model

The parameter configuration for the ACNPR model is as follows: the dimensions of the input vector and the intermediate local context in the model were set to 200. The number of layers in BiLSTM\({}^{(1)}\) was set to three, while the graph attention layer was set to two. BiLSTM\({}^{(2)}\) was set to one layer, and BiLSTM\({}^{(3)}\) was set to two layers.