## 2 Architectures of 5G and 6G Networks
### ML Algorithms for Detection
#### 3.1.2 Optimized WIDAT-Based Algorithm  
Below is a simplified proposed algorithm (WIDA) that demonstrates a workflow aligning with the WIDAT concept. This example uses dummy data for illustration. In a real scenario, we would replace the data generation step with actual wireless traffic input (for instance, reading from PCAP files or a real-time capture interface). The synthetic dataset underpinning Algorithm 1 mimics the class imbalance (\(\approx\) 9% malicious flows) and feature dispersion of CICIDS2023 [23] and 5G-CIC-IDS2024. Side-by-side benchmarking of WIDA with the original CICIDS2023 and 5G-CIC-IDS2024 traces forms part of our near-term work plan. Below, we present an example of the kind of performance statistics you might see after running the demo Isolation Forest script (with synthetic data). The script uses 500 standard and 50 anomalous samples, then splits them into 80% training and 20% testing data. Because the dataset is randomly generated at runtime, results can vary slightly each time you run it. In Table 3 below, we can see the sample results of a typical outcome regarding detection accuracy and classification performance. Precision for anomalies is 57%, meaning that a little over half of the samples flagged as anomalous were truly anomalous. Recall for anomalies is 80%, indicating that the model detected 8 of the 10 anomalous samples in the test set. With an overall accuracy of roughly 93%, the Isolation-Forest still performs respectably, yet the balance between false positives and false negatives is less than ideal, highlighting scope for further tuning of the contamination factor, feature set, or ensemble size. The key observations are as follows:  
* **Moderate Accuracy (-93%):**  
Performance drops compared with earlier runs, underlining how sensitive results are to data splits and parameter choices. * **Contamination Mismatch:**  
Setting contamination = 0.15 (while the true anomaly rate is \(\approx\) 9%) improves recall but lowers precision, illustrating the trade-off. * **Precision vs. Recall:**  
The current setting favours catching more anomalies (80% recall) at the expense of extra false alarms (57% precision). * **Result Variability:**  
Larger swings (\(\pm\)5-10%) are observed between runs because anomalies are now closer to the normal cluster. * **Scalability and Real-World Data:**  
Real wireless data--containing noise, diverse protocols, and varying signal strengths--needs more sophisticated preprocessing, richer features, or deep learning methods for automated feature extraction. To further validate WIDA's detection capabilities, we conducted synthetic scenario tests with multiple contamination levels and model configurations. Table 4 below illustrates accuracy comparisons across three configurations: \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Scenario** & **Model** & **Contamination** & \begin{tabular}{c} **Precision** \\ **(Anomalies)** \\ \end{tabular} & \
\begin{tabular}{c} **Recall** \\ **(Anomalies)** \\ \end{tabular} &
\begin{tabular}{c} **Overall** \\ **Accuracy** \\ \end{tabular} \\ \hline A & Isolation Forest & 0.10 & 0.57 & 0.80 & 0.93 \\ \hline B & Autoencoder & N/A & 0.62 & 0.77 & 0.91 \\ \hline C & Random Forest & 0.05 & 0.85 & 0.72 & 0.94 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Performance comparison of ML models in simulated WIDA scenarios. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Metric** & \begin{tabular}{c} **Class (-1.0)** \\ **(Anomalies)** \\ \end{tabular} & \
\begin{tabular}{c} **Class (1.0)** \\ **(Normal)** \\ \end{tabular} & **Accuracy** & **Macro Avg.** &
\begin{tabular}{c} **Weighted** \\ **Avg.** \\ \end{tabular} \\ \hline \hline Precision & 0.57 & 0.98 & 0.93 & 0.78 & 0.94 \\ \hline Recall & 0.80 & 0.94 & 0.93 & 0.87 & 0.93 \\ \hline F1-Score & 0.67 & 0.96 & 0.93 & 0.81 & 0.93 \\ \hline Support & 10 & 100 & 110 & 110 & 110 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Classification report for Isolation Forest script.