## 3 Genetic Algorithm-Based Optimization of Adversarial Samples
### Optimization Based on Genetic Algorithm  
In our study, we modified the adversarial sample generation with GA and then utilized the generated dataset against RF and XGBoost. We leverage the capabilities of GAs for optimizing hyperparameters, particularly when dealing with complex network datasets. XGBoost, while highly effective, depends on hyperparameter tuning, such as learning rate,tree depth, and the number of estimators. Manually optimizing these can be challenging, especially for large, interconnected datasets, such as social networks or traffic systems, which exhibit nonlinear relationships and high feature dimensions. The adoption of GA constitutes an heuristic optimization strategy inspired by the principles of natural selection, in place of conventional wrapper methodologies for feature selection [78], which carries significant implications. In this scenario, the natural selection principles are well-suited for complex, high-dimensional situations, such as detecting perturbations in dynamic and large-scale communication networks; it optimizes multi-instance trade-offs in the dataset with the assumption of limited prior knowledge about attack patterns. Conversely, wrapper methodologies are more effective for well-defined, lower-dimensional communication network problems, such as selecting specific features for rule-based detection. Although both methodologies strive to identify the optimal subset of features, they exhibit considerable divergence in their frameworks, computational efficiency, and resultant performance. Thereafter, GA enhances this process by treating the hyperparameters as a population of candidate solutions. Each set of hyperparameters is encoded as a chromosome, which undergoes genetic operations of selection, crossover, and mutation. These operations iteratively improve the population by selecting high-performing individual hyperparameter sets that lead to better XGBoost performance on the dataset. Over successive generations, GA converges towards an optimal or near-optimal set of hyperparameters. This approach addresses two critical challenges:  
* Search space complexity: GAs excel in exploring large, non-convex search spaces, which is essential when dealing with high-dimensional data in network structures, where interdependencies between nodes and edges may lead to local optima than the sequential feature selection (SFS) adopted in A2 PM. It makes local optimal decisions by adding or removing one feature at a time, while GAs investigate multiple feature subsets concurrently. This characteristic amplifies the probability of identifying a globally optimal subset of features, thereby circumventing the entrapment in local optima, which an attacker can leverage in this era of prevalent adoption of AI and automation. * Efficiency: Traditional methods, like grid or random search, can be computationally prohibitive on large datasets. Conversely, GA is more efficient, as it guides the search process through evolutionary principles, reducing the need for exhaustive searches, while still finding high-quality solutions. It reduces the algorithm's tendency to overfit the training data to the same extent as wrapper methods might. Wrapper methodologies are more susceptible to overfitting, particularly in the context of small datasets, due to their direct optimization of performance metrics on training data. It is worth noting that the network dataset is characterized by high volume; for example, 5G-NIDD [79] has more than 1 million instances. Nevertheless, it remains imperative to apply cross-validation [80] throughout the GA's process to diminish the risks associated with overfitting. The essence is to achieve more efficient, effective hyperparameter optimization by leveraging the search capabilities of GA and the predictive power of XGBoost using the CIC-IDS2019 dataset to achieve a better model performance, faster convergence, and more accurate insights in complex data environments.