# Comparison of ML/DL Approaches for Detecting DDoS Attacks in SDN
## 4 Measures of Performance  
The four major metrics for measuring the effectiveness of an ML/DL system are TruePositive (TP), TrueNegative (TN), FalsePositive (FP), and FalseNegative (FN). Positive in our test relates to attack states, whereas negative denotes normal states. The performance of each ML/DL approach is evaluated using these measures to derive the following indicators [29]:  
* Accuracy (A) measures how well it predicts the future, encompassing both positive and negative outcomes: \[\text{Accuracy (A) }=\left(\frac{TP+TN}{TP+TN+FP+FN}\right)\times 100\%\] (3)
* Precision (P) is the proportion of all normal state predictions that are right for a given network state: \[\text{Precision (P)}=\left(\frac{TP}{TP+FN}\right)\times 100\%\] (4)
* The accuracy and recall levels are measured using the F-Measure (F): \[\text{F-Measure (F)}=\frac{2\times\left(Precision\times Recall\right)}{\left( Precision+Recall\right)}\] (5)
* The Matthews correlation coefficient (MCC) is a contingency matrix technique of generating the Pearson product-moment correlation coefficient between actual and expected values. This alternative measure is unaffected by the problem of imbalanced datasets: \[\text{MCC}=\frac{\left(TP*TN\right)-\left(FP*FN\right)}{\sqrt{\left(TP+FN \right)\times\left(TN+FP\right)\times\left(TN+FN\right)\times\left(TP+FP \right)}}\] (6)  
Figure 4: CNN classification sequence [[https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3](https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3) bd2b116 ta53]([https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3](https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3) bd2b116 ta53), accessed on 1 December 2022.  
Figure 5: Non-image data to images [[https://www.nature.com/articles/s41598-019-47/65-6](https://www.nature.com/articles/s41598-019-47/65-6)]([https://www.nature.com/articles/s41598-019-47/65-6](https://www.nature.com/articles/s41598-019-47/65-6)), accessed on 1 December 2022. (**a**) An example of the conversion of a feature vector to a feature matrix (**b**) An example of the DeepInsight process for converting a feature vector to picture pixels.  
The confusion matrix (CM) is a highly well-liked metric for classifying issues. Both binary classification and multiclass classification issues may be solved with it [30]. The CM estimates from actual and expected values. The \"TN\" finding counts the set of accurately detected negatively classified instances. Related to it, \"TP\" signifies the rate of accurately detected positive instances. The letter \"P\" stand for the ratio of genuine negative instances which have been misclassified as positive, while \"FN\" stands for the ratio of genuine positive samples which have been misclassified as negative. An important metric most frequently employed in categorization is accuracy. Alternative measures focused on CM are also relevant for evaluating because accuracy may be deceiving once implemented to imbalanced ds. To obtain the CM, use the \"confusion matrix 0\" function from the Py \"sklearn\" package ([[https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusionmatrix.html](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusionmatrix.html)]([https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusionmatrix.html](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusionmatrix.html)), accessed on 5 Novemebr 2022). Import this function into Python by typing \"from sklearn.metrics import confusion matrix\". To produce the CM, it must run the function with both the real and predictable values [31].  
In this study, the CM was used to assess how well the procedures were employed after the categorization was performed. Figure 6 depicts the confusion matrix's layout for binary classification.