# Rank and Wormhole Attack Detection Model for RPL-Based Internet of Things Using Machine Learning
## 4 Results and Discussion  
### Performance Evaluation Metrics  
In this research study, we have considered several factors in determining the performance evaluation metrics to assess the performance of the proposed model. These metrics are based on the confusion metrics results that form a solid foundation for examining the classification-based ML models. Furthermore, we have also considered the type of classification, which is multiclass in this case, and which requires further parameters to counter any accuracy-related bias. Therefore, we have adopted cross-entropy, Cohn's kappa, and Matthews correlation coefficient for extensive evaluation and validation. Fi  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**No.** & **Selected Features** & **Feature Name** \\ \hline
**9** & rerr & Rank error \\ \hline
**10** & diointervalmin & Minimum DIO interval \\ \hline
**11** & dioredconst & DIO redundancy constant \\ \hline
**12** & protocol & ICMPv6, UDP, and IEEE 802.15.4 protocols \\ \hline
**13** & rank & Rank value \\ \hline
**14** & lost & Lost packets \\ \hline
**15** & hopcount & Hop count \\ \hline
**16** & ipv@hoplim & Hop limit \\ \hline
**17** & wpanseq.no & 6 LoWPAN sequence number \\ \hline
**18** & dio.dst & DIO destination \\ \hline
**19** & messg & Message type \\ \hline
**20** & dis & DIS \\ \hline
**21** & diointervalmin & Minimum DIO interval \\ \hline \hline \end{tabular}
\end{table}
Table 3: _Cont._nally, the performance of the model is compared with the benchmark research works and related classifiers.  
Accuracy is the first evaluation metric used for the evaluation of the model's performance. It calculates the number of correct predictions among all the predictions made by the model. Equation (2) presents the accuracy where _TP, TN, FP_, and _FN_ denote true positive, true negative, false positive, and false negative, respectively.  
\[\frac{(TP+TN)}{(TP+TN+FP+FN)} \tag{2}\]  
The second metric used for model performance evaluation is precision. It calculates the accuracy of each class using the parameters from the confusion matrix. Equation (3) presents the precision.  
\[\frac{(TP)}{(TP+FP)} \tag{3}\]  
Recall, also known as the detection rate, is the ratio between the number of attacks detected by the system and the total number of attacks that are present in the dataset. Equation (4) calculates the detection rate.  
\[\frac{(TP)}{(TP+FN)} \tag{4}\]  
Cross-entropy measures the extent to which the predicted probabilities match the given data and is used to quantify the cost of inaccurate predictions. The terms log loss and cross-entropy are used interchangeably; the lower the log loss, the better the model has performed. [PERSON]'s kappa addresses potential bias towards the major class (if any) by statistically measuring the vicinity of the predicted classes to the actual classes when compared with a random classification. Matthews correlation coefficient computes the correlation coefficient between the observed and predicted classifications within a range of \(+1\), \(0\), and \(-1\), where \(+1\) indicates the ideal prediction model, \(0\) indicates random prediction, and \(-1\) depicts inverted or reverse prediction. In this paper, we have used these metrics for the evaluation of the proposed model in addition to classic ML-based performance evaluators.