## 8 Experiments and Result Analysis
### Result Analysis  
Tables 2-4 list the number of true positive instances, the number of false positive instances, and the number of false negative instances of design pattern detection in the three open-source projects by the three non-machine learning design pattern detection methods of [PERSON] et al. [9], [PERSON] et al. [7] and [PERSON] et al. [6] as well as the method in this paper, respectively; Tables 5-7 list the precisions and recalls of design pattern detection in the three open-source projects by the three non-machine learning design pattern detection methods as well as the method in this paper, respectively. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Design Pattern**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**Our Method**} \\ \cline{2-9}  & _Precision_ & _Recall_ & _Precision_ & _Recall_ & _Precision_ & _Recall_ & _Precision_ & _Recall_ \\ \hline \hline Adapter & & & & & & & & & \\ \hline Command & 100.0\% & 57.1\% & 77.8\% & 100.0\% & 75.0\% & 85.7\% & 85.7\% & 85.7\% \\ \hline Decorator & & 0.0\% & 100.0\% & 100.0\% & 100.0\% & 0.0\% & 100.0\% & 100.0\% \\ \hline Factory method & 100.0\% & 75.0\% & 100.0\% & 25.0\% & 66.7\% & 50.0\% & 100.0\% & 50.0\% \\ \hline Singleton & 100.0\% & 75.0\% & 85.7\% & 100.0\% & 90.9\% & 83.3\% & 92.3\% & 100.0\% \\ \hline State & & & & & & & & \\ \hline Template Method & 100.0\% & 91.7\% & 68.8\% & 91.7\% & 71.4\% & 83.3\% & 100.0\% & 91.7\% \\ \hline Strategy & & 100.0\% & 56.7\% & 100.0\% & 72.7\% & 94.1\% & 89.5\% & 100.0\% \\ \hline Visitor & 100.0\% & 100.0\% & 66.7\% & 100.0\% & 33.3\% & 50.0\% & 66.7\% & 100.0\% \\ \hline Average & 83.6\% & 71.3\% & 79.4\% & 88.1\% & 58.6\% & 63.8\% & 90.6\% & 89.6\% \\ \hline \hline \end{tabular}
\end{table} 
Table 6: The precisions and recalls in JRefactory 2.6.24. \begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline \hline \multirow{2}{*}{**Design Pattern**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**[PERSON] et al.’s Method**} & \multicolumn{2}{c}{**Our Method**} \\ \cline{2-11}  & _TP_ & _FP_ & _FN_ & _TP_ & _FP_ & _FN_ & _TP_ & _FP_ & _FN_ \\ \hline Adapter & & & & & & & & & & \\ \hline Command & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 \\ \hline Composite & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ \hline Decorator & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 0 \\ \hline Observer & 3 & 0 & 1 & 4 & 2 & 0 & 3 & 1 & 1 & 4 & 2 & 0 \\ \hline State & & & & & & & & & & & \\ \hline Strategy & 3 & 0 & 0 & 3 & 2 & 0 & 2 & 1 & 1 & 3 & 1 & 0 \\ \hline Template Method & 1 & 0 & 0 & 1 & 2 &As seen in Tables 5-7, the average precision/recall of JHotDraw 5.1 of [PERSON] et al. [9], [PERSON] et al. [7] and [PERSON] et al. [6] were 90.0%/80.6%, 74.9%/96.2%, and 73.0%/83.8%, respectively; the average precision/recall of JRefactory 2.6.24 were 83.6%/71.3%, 79.4%/88.1%, and 58.6%/63.8%, respectively; the average precision/recall of JUnit 3.7 were 100.0%/95.8%, 60.0%/100.0% and 61.1%/90.3%, respectively. It can be seen that [PERSON] et al. [9] achieved high precision in all three projects, but the recall of JHotDraw 5.1 and JRefactory 2.6.24 was not high. Contrary to [PERSON] et al. [9], [PERSON] et al. [7] achieved high recall in the three projects, however, the precision was low, especially the precision of JUnit 3.7 was only 60.0%. The reason lies in that the detection rules of these methods are all obtained from the theoretical description of design patterns, while the detection rules of design patterns are very complex and flexible. Improving the matching standard will increase the precision to a certain extent, but it will reduce the recall. Reducing the matching standard will improve the recall, but it will lead to low precision. [PERSON] et al. [6] tried to use the Prolog language to facilitate the addition and modification of rules to improve the detection effect.