# Vulnerability Detection and Classification of Ethereum Smart Contracts Using Deep Learning
## 4 Results and Discussion
### Results of Binary Classification  
Table 2 presents the performance metrics of different algorithms based on binary classification to detect whether a vulnerability exists or not. The RF algorithm with RGB images achieves a high accuracy of 0.86666, an F1-score of 0.86666, a precision of 0.86635, and recall of 0.86671, indicating that it performs well in detecting a vulnerability. In addition, RF in Gray-scale images also performs well in detection tasks. However, it has a slightly lower accuracy and F1-score compared to RF with RGB. Specifically, it has an accuracy of 0.85641 and an F1-score of 0.85641. This shows that the RF algorithm, in general, is the best in terms of binary classification for smart contracts. Also, the ResNet50 algorithm achieves a high accuracy of 0.84102, F1-score 0.84102, precision of 0.84437, and recall of 0.83926, indicating strong performance in vulnerability detection using RGB images. However, the ResNet50 algorithm shows good performance in vulnerability detection with grayscale images, although slightly lower compared to its RGB counterpart. In the RF algorithm, which is considered the best algorithm in binary classification based on performance metrics, it took 9000 s in RGB images, while in grayscale images it took a longer time, reaching 9900 s, and achieved a lower F1-score accuracy of 0.01. \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Predicted Positive** & **Predicted Negative** \\ \hline \multirow{6}{*}{Actual Positive} & True Positive (TP) & False Negative (FN) \\  & TP: The model correctly predicted a positive label or vulnerability; the true label is also positive. Notably, the model correctly identified the presence of a particular vulnerability. & FN: The model incorrectly predicted a negative label or vulnerability; the true label is also positive. Notably, the model incorrectly identified the presence of a particular vulnerability that should be expected and found in the dataset used. \\ \hline \multirow{6}{*}{Actual Negative} & False Positive (FP) & True Negative (TN) \\  & FP: The model incorrectly predicted a positive label or vulnerability, and the true label is also negative. Notably, the model incorrectly identified the presence of a particular vulnerability that is not found in the dataset used. \\ \cline{1-1}  & & True Negative (TN) \\ \cline{1-1}  & FP: The model incorrectly predicted a positive label or vulnerability, and the true label is also negative. Notably, the model incorrectly identified the presence of a particular vulnerability. \\ \cline{1-1}  & & True Negative (TN) \\ \cline{1-1}  & & TN: The model correctly predicted a negative label or vulnerability; the true label is also negative. Notably, the model correctly identified the presence of a particular vulnerability. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Values of confusion matrix [58; 59]. The confusion matrices in Figures 15-24 show how well binary classification models are built using the various methods adopted. The model's predictions for true negatives (TN), false positives (FP), false negatives (FN), and true positives (TP) are broken down in each confusion matrix. In RF algorithm, the TP and TN in RGB images indicate that the model has detected correctly the largest number compared to other algorithm models, which reached 486 and 528, respectively, while TP and TN in grayscale images are 468 and 534, respectively. The reason for the superiority of the RF algorithm is that each RF tree calculates the importance of a particular feature according to its ability to increase the purity of the leaves while making classification trees. The greater the increase in the purity of the leaves, the greater the importance of the feature, which is well reflected in the classification results. The confusion matrix of the KNN algorithm did not achieve satisfactory results, as is clear in Figures 23 and 24, where the TP and TN for the RGB and grayscale images reached 362, 539, 365, and 560, respectively.