# SJBCD: A Java Code Clone Detection Method Based on
## 4 Experiment
### Word Vector Model Experiment  
In order to select the most suitable word vector model, a word vector comparison experiment was conducted using the CompiledBCB dataset. Various dimensions of the GloVe, Skip-gram [33], and CBOW [33] models were combined with Siamese neural networks. The evaluation was based on accuracy, recall, and F1 measurements as indicators. The CompiledBCB dataset contained a vast amount of data, which led to slow training times. To expedite the selection process for suitable word vector dimensions and models, we employed the Inject Mutatio [34] method using JDK 1.8 as input. This approach facilitated the generation of Opcode21K, a smaller dataset consisting of 21K instances. With its reduced size, the Opcode21K dataset enabled faster training and evaluation processes.  
Since the F1 metric combines accuracy and recall, the F1 metric was prioritized in the evaluation. If the F1 metric was equal, the accuracy and recall were then compared. Table 2 presents the test results of the three models at different word vector dimensions.  
To visually illustrate the changing trend of the detection effectiveness for the three models with word vector dimension, this study extracted the F1 metric values from Table 2 and generated Figure 7.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Clone Type** & **T1** & **T2** & **VST3** & **ST3** & **MT3** & **WT3/T4** \\ \hline Percent (\%) & 0.455 & 0.058 & 0.053 & 0.19 & 1.014 & 98.23 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Proportion of each clone type in the dataset used by TBCCD.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **Dimensions** & **Accuracy** & **Recall** & **F1** \\ \hline GloVe & 100 & 0.986 & 1 & 0.993 \\ GloVe & 150 & 0.989 & 1 & 0.994 \\ GloVe & 200 & 0.991 & 1 & **0.995** \\ GloVe & 250 & 0.99 & 1 & **0.995** \\ GloVe & 300 & 0.99 & 1 & **0.995** \\ Skip-gram & 100 & 0.983 & 1 & 0.992 \\ Skip-gram & 150 & 0.986 & 1 & 0.993 \\ Skip-gram & 200 & 0.99 & 1 & **0.995** \\ Skip-gram & 250 & 0.986 & 1 & 0.993 \\ Skip-gram & 300 & 0.986 & 1 & 0.993 \\ CBOW & 100 & 0.981 & 1 & 0.99 \\ CBOW & 150 & 0.985 & 1 & 0.992 \\ CBOW & 200 & 0.989 & 1 & 0.994 \\ CBOW & 250 & 0.985 & 1 & 0.992 \\ CBOW & 300 & 0.987 & 1 & 0.993 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Test results of three models in different word vector dimensions.  
It is evident from Figure 7 that both Skip-gram and CBOW models achieve their peak F1 metric values at a dimension of 200 VDS, which are 0.995 and 0.994, respectively. In contrast, the GloVe model reaches its highest F1 metric value at 200 VDS and remains stable at 0.995 for 250 and 300 dimensions. Table 2 indicates that the accuracy of the 200-dimension word vector is the highest at 0.991. Hence, it can be concluded that 200 dimensions are the optimal choice for the word vector dimension.  
Furthermore, Figure 7 reveals that when the word vector dimension is set to 200, the F1 metric values of the GloVe and Skip-gram models are equal. Further examination of Table 2 indicates that the accuracy of the GloVe model at this point is 0.991, which is higher than the accuracy of Skip-gram (0.99). Consequently, GloVe is selected as the pre-training model for word vectors in this study.