# Machine Learning: Models, Challenges, and Research Directions
## 4 Machine Learning Processes
### Evaluation Metrics
#### 4.3.1 Evaluation Metrics for Supervised Learning  
Accuracy: This represents the correct predictions made by an ML model. It is calculated, as presented in Equation (6), where \(T_{P}\) presents the true positive, \(T_{N}\) denotes the true negative, \(F_{P}\) is the false positive, and \(F_{N}\) is the false negative.  
\[\text{Accuracy}=\frac{T_{P}+T_{N}}{T_{P}+T_{N}+F_{P}+F_{N}}\times 100 \tag{6}\]  
Precision: This shows the number of true positives divided by the total number of true positive and false positive. It can be calculated by:  
\[\text{Precision}=\frac{T_{P}}{T_{P}+F_{P}}\times 100 \tag{7}\]  
Recall (Detection Rate): This metric computes the number of the positive samples correctly classified to the total number of the positive samples. This metric, as shown in Equation (8), can indicate the model's ability to classify positive samples among other samples.  
\[\text{Recall}=\frac{T_{P}}{T_{P}+F_{N}} \tag{8}\]  
F1-Score: This metric is derived from the recall and the precision, where the precision is defined in Equation (7) and the recall is given by Equation (8). It is given by:  
\[\text{F1-Score}\;\frac{2T_{P}}{2T_{P}+F_{P}+F_{N}} \tag{9}\]  
Area under the receiver operating characteristics curve (AUC): The receiver operating characteristic (ROC) can visualize a tradeoff among sensitivity and specificity in an ML model. This curve is considered as a plot of the true positive rate (TPR) to the false positive rate (FPR). This metric is calculated using Equation (10), where x presents the varying AUC parameter.  
\[\text{Area Under Curve}=\int_{x=0}^{1}\frac{T_{P}}{T_{P}+F_{N}}\;\bigg{(}( \frac{F_{P}}{F_{P}+T_{N}})^{-1}(x)\bigg{)}dx \tag{10}\]  
False Alarm Rate: False alarm rate, false positive rate, is the probability of a false alarm being raised. This metric can be computed by:  
\[\text{False Alarm Rate}=\frac{F_{P}}{T_{N}+F_{P}} \tag{11}\]  
Misdetection Rate: It indicates the percentage of misclassified samples. It is given by:  
\[\text{Misdetection Rate}=\frac{F_{N}}{T_{P}+F_{N}} \tag{12}\]  
Mean Absolute Percentage Error: It is used to evaluate the accuracy of forecasting models. It calculates the average percentage difference between the predicted and the actual values.  
\[\text{Mean Absolute Percentage Error}=\frac{1}{n}\sum\
olimits_{t=1}^{n}\left| \frac{A_{t-F_{t}}}{A_{t}}\right| \tag{13}\]  
where, \(n\) is the number of the summation times that the iteration happens, \(A_{t}\) denotes the actual value at time \(t\), and \(F_{t}\) is the predicted value at time \(t\).  
Processing Time: This refers to time taken to train, test, and predict the results. It can represents the time required to predict or analyze malicious signals compared to non-malicious signals.  
Training Time per Sample: This refers to the time taken to train a model on a single sample of the dataset. It represents the amount of time required to process and learn from the features and labels of an individual sample during the training phase.  
Memory Usage: This is the amount of memory or storage space that is required by a model during its entire process. It represents the amount of memory resources utilized to store and process the model's parameters, intermediate computations, and other relevant data.