# Feature Selection Model Based on Gorilla Troops Optimizer for Intrusion Detection Systems

Authors: Ibrahim Ahmed; Abdelghani Dahou; Samia Allaoua Chelloug; Mohammed A. A. Al-qaness; Mohamed Abd Elaziz
Journal: Journal of Sensors
 (2022)

---

## Abstract

Cyber security is a fundamental challenge to the Internet of things (IoT) and smart home environments .This paper presents a modified method to ystem (IDS).setection dntrusion ienhance the performance of the This modification is achieved by introducing an alternative feature selection (FS) . ptimizer (GTO) algorithm.oroops torilla gmodel based on the Recently, FS has played a significant role in increasing the detection of anomalies in IDSs. To evaluate the efficiency of the developed method, a set of experimental conducted using three datasets, including NSL-KDD, CICIDS2017, and Bot-IoT datasets.asresults w xtraction (FE) model to reduce the dimensions of these datasets as a first step.Teeature f used as a areetworks (CNN) neural nonvolutional cThe hen, the extracted features are passed to the FS model for detection. The results of the developed method are compared with the well-known IDS technique. The results show the superiority of the developed method over all other methods according to the performance metrics.


---

## Body

## 1. Introduction

Intrusion detection systems (IDSs) have grown in glory in recent years as a result of their sturdiness. In 1980, James and Anderson [1] offered a definition of an IDS for the first time. IDSs are designed to detect intruders in a certain area. An IDS has three primary components: first, an agent oversees gathering data of monitoring events’ data flow; second, an analysis engine detects evidence of intrusion and delivers alarms; and third, a return module doing with the analysis engine’s results. IDSs have improved reliability and efficiency over time, but more diverse attack tactics have evolved to circumvent these detection systems. Furthermore, typical IDSs are incapable of dealing with the IoT’s numerous network layers [2].There are several works that have been urged to use distributed IDSs to work with machine learning (ML) processes, including artificial neural networks (ANN), reinforcement learning, and deep learning (DL). Due to recent advances in intelligent systems, ordinary ANNs are limited in their ability to deal with the intricacy of IDSs. So, trying to develop the technology by addressing those flaws is a prerequisite for fulfilling the potential of IDSs in the applications [3].The dimension of information has grown dramatically since the dawn of the Age of Big Data. There are large amounts of high-dimensional data that are becoming challenging to handle in several domains, including ML, text mining, and data analysis [4]. Irrelevant and redundant characteristics add to the dimension’s complexity and obstruct proper classification outcomes, leading to bad algorithm results. In the same context, the IDS [5] is based on significant data and performs network transmission controls as well as detecting and processing illegal usage resources. Improving the qualifications of IDS, however, maintaining high accuracy in the detection process has become a pressing issue that must be addressed.Feature selection (FS) is becoming more popular as a means of reducing data dimensionality [6]. It decreases data complexity by removing extraneous elements, which is extremely important to IDS. FS techniques minimize the dimensions of network data by filtering out redundant data. In addition, IDS’ computing payload has been reduced and detection speed has increased. As a result, FS is one of the most important aspects of data preparation in IDS, as it affects the accuracy of the detection. The FS can be divided into 4 sections: the search phase, the evaluation phase, the examining case and investigation, and the results [7–11]. The search phase provides a strategy and a starting point. Following the processing of the initial feature set by the corresponding feature subset is generated by the search module. To evaluate the feature subsets, appropriate evaluation criteria are created. The final selected feature subset is output when the FS process reaches its termination condition. Meanwhile, it is being tested to see how good the feature picking algorithm is. Using FS methods in IDS increased the accuracy rate and performance of IDSs with different classifiers.Recently, several FS methods based on metaheuristics (MH) techniques have been adopted for addressing IDS. The MH algorithms applied to IDS are particle swarm optimization (PSO) [12], genetic algorithm [13–15], grey wolf optimizer (GWO) [16, 17], crow search algorithm (CSA) [18], random harmony search (RHS) [19], improved cat swarm optimization algorithm [20], a chaotic teaching-learning algorithm [21], and Aquila Optimizer algorithm [22]. These algorithms increased the performance of IDSs in detection. However, these algorithms have drawbacks, such that they cannot get rid of local optima and this leads to a high false-positive rate in IDSs.This paper proposed using CNN to extract features from the datasets, then applying the nature-inspired GTO algorithm as a new FS model. The GTO has a small number of parameters to set and is easy to use in solving problems. It consists of three phases for exploration, traveling to an unknown area, social interaction with other gorillas, and traveling to a known area. Moreover, there are two phases for exploitation: following the silverback leaders and catching females. GTO is used to solve mathematical and engineering problems [23] and electrical models of photovoltaic modules [24]. The main advantage of GTO is that it finds the best solution in a short time compared to state-of-the-art algorithms. The GTO algorithm is described later in this paper. The main contribution of this paper can be summarized as follows: using the CNN algorithm to extract features from the input datasets, adopting the GTO algorithm as a new FS technique, and evaluating the performance of the proposed model and comparing the results with state-of-the-art methods on large datasets.The rest of the paper is organized as follows. Section2 presents the related work of this study. The GTO algorithm description is presented in Section 3. Section 4 explains the proposed model. Section 5 introduces dataset descriptions and the results obtained in the study with deep discussion. The conclusion and future work are summarized in Section 6.


## 2. Related Work

There are several FS methods that have been proposed to enhance the IDSs. For example, authors in [25] created an FS model combining the ID3 classifier method with the bees algorithm. The ID3-BA method is intended to optimize the selection of the necessary characteristics of IDS. The bees method was utilized to create the necessary set of features in this model; however, the ID3 method was applied to build the classifier. For training and testing, the ID3-BA method uses the KDD Cup99 [26] dataset, which includes 41 features.Three criteria are used to assess the suggested approach: false alarm rate (FAR), accuracy, and detection rate (DR). ID3-BA generates high DR 91.02% and AR 92.002%, while reducing FAR levels, according to the findings of the experiments (3.917%). Furthermore, the findings show that utilizing a subset of characteristics rather than all features leads to superior classifications terms such as DR, AR, and reduced FAR.For IDSs, Ahmad et al. [27] created an FS model by using multilayer perception (MLP). The main idea of the model implies a generalized additive modeling (GA) with principal component analysis (PCA). PCA was used by Ahmad et al. to arrange the feature set into the primary feature set. The model chose the characteristics that match with the greatest eigenvalues. The characteristics used by PCA may not be able to identify the classifier well enough. As a result, they used GA to search the main feature space for a subset with the best sensitivity. The MLP classifier was trained using feature subsets chosen using PCA and GA. The KDDCup’99 dataset was utilized to test the suggested technique. The number of characteristics chosen was decreased from 41 to only 12. The best characteristics improved the accuracy of detection. The latter’s precision increased to 99%.SVM and GA were used in a hybrid model for IDSs created by Aslahi-Shahri et al. in [28]. This model has the potential to reduce the number of selected criteria from 41 to 10. The selected qualities were split into three categories based on their significance using GA. Prioritization is given to the essential qualities. The third priority is given to the least significant qualities. The decision was made for sharing the features. The positive DR of the hybrid model was found to be 0.973. The FAR was found to be 0.017.An FS model was created by using a hybrid learning method [29]. FS and clustering are combined in the IDS process. The former employs the support vector machine (SVM), whereas the latter employs the K-medoids clustering method. The naive Bayes classifier was employed in this method for the assessment procedure using the KDD CUP99 dataset. Three key performance measures are used to assess the proposed model: accuracy, detection rate, and alert rate. True positives, true negatives, false positives, and false negatives are used to create performance measures. Three additional FS techniques were compared to the experimental findings [29]. The suggested hybrid normalization method provides higher accuracy (91.5%), DR (90.1%), and FAR (90.1%), according to the experimental findings (6.36%).Authors in [30] created an FS method based on binary grey wolf optimization concepts. The mechanism’s primary goal, as its name implies, is to determine the best location for important characteristics throughout the categorization process. For calculating the updated grey wolf location, the system employs two methods: stochastic crossover and a sigmoidal function. The advantages of combining the two methods are that the classification process is more accurate and the number of chosen characteristics is reduced. The framework makes use of a dataset collected from the UCI (UC Irvine) warehouse [31], and the results were compared with those produced by the GA and PSO algorithms. The average chosen features, accuracy values, and objective values are used to determine the evaluation criteria. With respect to search capacity, objective values, and accuracy values, the suggested approach beats GA and PSO, according to the findings.Ghanem and Jantan [32] adopted an FS model based on the artificial bee colony (ABC) for IDS divided into two main steps. Step 1 used the Pareto front to generate the features. Step 2 takes the output of step 1 (features) as input for evaluation by the feed forward neural network (FFNN) with the ABC algorithm. This model is named multiobjective ABC (MO-ABC). This model introduced a new objective function to minimize the feature set of network traffic by using a hybrid ABC-PSO algorithm. The MO-ABC model classifies the output features from step 1 by FFNN.In the following paper [33], the authors devised a technique for IDS FS that combines a clustering algorithm with filter and wrapper approaches. In the wrapper technique, they used the linear correlation coefficient algorithm (FGLCC), and in the filter technique, they used the cuttlefish algorithm [34]. The suggested approach builds the classifier using a decision tree, and the performance is measured by training the approach on the KDD CUP 99 dataset. The accuracy, detection rate, false positives, and fitness function were used to evaluate the performance throughout the experiment. The suggested FGLCC-CFA combined approach has better results according to the assessment findings.Chen et al. [35] developed an IDS that selects features using an ensemble classifier. The system integrates the bat algorithm (BA) with FS based on correlation (CFS). In addition, random forest and forest-based penalizing attributes are used to construct the ensemble classifier. The CIC-IDS2017 dataset was used to generate the findings of the experiment. The experiment’s findings were compared to those obtained using a comparable method that did not include an FS element. The CFSBA combination method has a high accuracy equal to 96.76%, with a high DR reaching 94.04% and a good level of FAR of down to 2.38%, according to the findings.For IDS FS, [36] devised a new method based on the intelligence water drops (IWD) algorithm. IWD is a bioinspired method that builds classifiers using SVM. IWD is known as an MH-based swarm intelligence optimization method. The KDD CUP99 dataset was used to assess this method. The outcomes of the trials are also compared to current bioinspired methods. The IWD based on the FS method provides a high DR (91.35%), increased accuracy (93.12%), and a low number of FAR, according to the testing findings (3.35%).The method proposed in [37] combines the differential evolution algorithm with the ABC algorithm in a hybrid manner. The assessment and classification procedures are carried out with the use of fifteen datasets from the UCI library. The findings of the hybrid method were also compared to those of other FS approaches as part of the assessment process. The chi-square, information gain, and CFS were all utilized in the FS comparison (correlation FS). According to the simulation findings, the proposed method was able to achieve significant performance and high accuracy.For IDS, a new FS method was suggested by [38]. The suggested method presents simplified swarm optimization (SSO), a new simple variant of PSO that uses a local search method to speed up the FS method by finding the global best nearby solution. This method lowers the features required to describe network traffic behavior from KDDCUP99 from 41 to just 6 features and achieves a 93.3% accuracy over the conventional PSO.Finally, the principles of the firefly algorithm inspire [39] work. The filter and wrapper used in the FS process are deployed using the firefly algorithm. The firefly algorithm is a metaheuristic optimization method inspired by the behavior of fireflies in this context. By using the KDDCUP99 datasets, the experimental method is tested and assessed, as well as the Bayesian network and C4.5 features [39]. The F-measure derived from utilizing 10 and 4 characteristics was used in the experimental comparison. The experimental findings from a simulation of a denial of service (DoS) assault indicate a 99.98% accuracy increase and a 0.01% FAR.


## 3. Background

### 3.1. Gorilla Troops Optimizer (GTO)

Gorilla troops optimization (GTO) is inspired by gorilla swarm behavior, and it simulates five different methods [23]. Migrating to an anonymous place, migrating for other gorillas, they move towards a known region, keep tracking the silverback; next, competing for mature females is some of these tactics. They are imitated and shown to illustrate the optimization process’ exploration and exploitation. Three methods are employed during the exploration stage: moving toward an anonymous region, migrating to the remaining members, and migrating toward a known region. In the exploitation stage, two tactics are used: keeping track of the silverback and then competing for mature females.


#### 3.1.1. Exploration Phase

In GTO, all members can be solutions and the best solution can be designated to be a silverback gorilla at each optimization operation step. For the exploration stage, the following different strategies were applied: moving toward an anonymous region for the purpose of increasing the ability of GTO exploration, decreasing the search area by distressing the spaces between gorillas to make a balance between exploitation and exploration, and finally moving toward a known region for the purpose of increasing the ability of GTO for inspection of the region.The migration to an undetermined location technique is selected whenrand<p such that p is a parameter. Furthermore, if rand≥0.5, a strategy of mobility to other gorillas is selected, while if rand<0.5, a strategy of moving toward a specified region is selected. In the exploration phase, these three methods may be expressed numerically as in equation (1).
(1)GXt+1=UL−LL×r1+LL,rand<pr2−C×Xrt+L×H,rand≥0.5Xi−L×L×Xt−GXrt+r3×Xt−GXrt,rand<0.5,such that Xt and GXt+1 denote the actual gorilla position and the candidate gorilla position in the next t iteration, respectively. The rand,r1,r2, and r3 denote a value in 01. Before any optimization process, the parameter p must be provided in 01 to show the likelihood of election of the movement strategy to an unidentified region. The parameter Xr is one gorilla chosen from gorilla swarm while GXr is only one group from gorillas in the selected region which may be assigned at random. The lowest and highest bounds of the variables are denoted by LL and UL, respectively. Equations (2), (4), and (5), respectively, may be used to express the variables C,L, and H numerically.
(2)C=F×1−,(3)F=coscos2×r4+1,(4)L=C×l,(5)H=Z×Xt,(6)Z=−C,C,where t and MaxIt indicate the actual iteration and max number of iterations, respectively. r4is the random value inside the interval 0,1. In addition, the characters l stand for the random value in the interval −1,1. In conclusion of the exploration stage, the objective value of GX is determined; if the objective value of GXt is lower than the cost of Xt, the GXt shall supplant the Xt solution as the bestead option (silverback).


#### 3.1.2. Exploitation Phase

In the exploitation stage, two methods are used, keep tracking the silverback and then competing for mature females. One of the two methods may be selected according to the results of comparisonC (equation (2)) with W (its value initialized from the starting). The silverback is considered as the commander of a swarm of gorillas that make choices and drive the swarm to food sources. If C≥W, this approach is chosen. Equation (7) may be used to describe this behavior numerically.
(7)GXt+1=L×M×Xt−Xsilverback+Xt.The gorilla position vector is represented byXt, whereas the silverback position is represented by the Xsilverback vector. And M in equation r4 is represented as follows:
(8)M=1N∑i=1NGXitg1/g,g=2l,where the location of each candidate gorilla’s vector at iteration t is shown by GX_it and N denotes the number of gorillas.IfC<W is used, the second tactic for the exploitation stage is competition for mature females. When childish gorillas reach puberty, they fight ferociously with males for mature females. Equation (9) may be used to describe this behavior numerically.
(9)GXi=Xsilverback−Xsilverback×Q−Xt×Q×A,where
(10)Q=2×r5−1,(11)A=β×E,(12)E=N1rand≥0.5N2rand<0.5.Q represents the impact force, as defined by equation (10), whereas the symbol r5 represents random values in the interval 0,1. Equation (7) may be used to evaluate the parameter A, which reflects the fighting stage. β is preset at the start of the algorithm. E is responsible for mimicking the violent impact on the solutions in equation (12).In conclusion of the exploitation stage, the objective value ofGX is evaluated, and if the objective value of GXt is less thanXt, then GXt will replace theXt as the best solution (silverback).


## 3.1. Gorilla Troops Optimizer (GTO)

Gorilla troops optimization (GTO) is inspired by gorilla swarm behavior, and it simulates five different methods [23]. Migrating to an anonymous place, migrating for other gorillas, they move towards a known region, keep tracking the silverback; next, competing for mature females is some of these tactics. They are imitated and shown to illustrate the optimization process’ exploration and exploitation. Three methods are employed during the exploration stage: moving toward an anonymous region, migrating to the remaining members, and migrating toward a known region. In the exploitation stage, two tactics are used: keeping track of the silverback and then competing for mature females.


### 3.1.1. Exploration Phase

In GTO, all members can be solutions and the best solution can be designated to be a silverback gorilla at each optimization operation step. For the exploration stage, the following different strategies were applied: moving toward an anonymous region for the purpose of increasing the ability of GTO exploration, decreasing the search area by distressing the spaces between gorillas to make a balance between exploitation and exploration, and finally moving toward a known region for the purpose of increasing the ability of GTO for inspection of the region.The migration to an undetermined location technique is selected whenrand<p such that p is a parameter. Furthermore, if rand≥0.5, a strategy of mobility to other gorillas is selected, while if rand<0.5, a strategy of moving toward a specified region is selected. In the exploration phase, these three methods may be expressed numerically as in equation (1).
(1)GXt+1=UL−LL×r1+LL,rand<pr2−C×Xrt+L×H,rand≥0.5Xi−L×L×Xt−GXrt+r3×Xt−GXrt,rand<0.5,such that Xt and GXt+1 denote the actual gorilla position and the candidate gorilla position in the next t iteration, respectively. The rand,r1,r2, and r3 denote a value in 01. Before any optimization process, the parameter p must be provided in 01 to show the likelihood of election of the movement strategy to an unidentified region. The parameter Xr is one gorilla chosen from gorilla swarm while GXr is only one group from gorillas in the selected region which may be assigned at random. The lowest and highest bounds of the variables are denoted by LL and UL, respectively. Equations (2), (4), and (5), respectively, may be used to express the variables C,L, and H numerically.
(2)C=F×1−,(3)F=coscos2×r4+1,(4)L=C×l,(5)H=Z×Xt,(6)Z=−C,C,where t and MaxIt indicate the actual iteration and max number of iterations, respectively. r4is the random value inside the interval 0,1. In addition, the characters l stand for the random value in the interval −1,1. In conclusion of the exploration stage, the objective value of GX is determined; if the objective value of GXt is lower than the cost of Xt, the GXt shall supplant the Xt solution as the bestead option (silverback).


### 3.1.2. Exploitation Phase

In the exploitation stage, two methods are used, keep tracking the silverback and then competing for mature females. One of the two methods may be selected according to the results of comparisonC (equation (2)) with W (its value initialized from the starting). The silverback is considered as the commander of a swarm of gorillas that make choices and drive the swarm to food sources. If C≥W, this approach is chosen. Equation (7) may be used to describe this behavior numerically.
(7)GXt+1=L×M×Xt−Xsilverback+Xt.The gorilla position vector is represented byXt, whereas the silverback position is represented by the Xsilverback vector. And M in equation r4 is represented as follows:
(8)M=1N∑i=1NGXitg1/g,g=2l,where the location of each candidate gorilla’s vector at iteration t is shown by GX_it and N denotes the number of gorillas.IfC<W is used, the second tactic for the exploitation stage is competition for mature females. When childish gorillas reach puberty, they fight ferociously with males for mature females. Equation (9) may be used to describe this behavior numerically.
(9)GXi=Xsilverback−Xsilverback×Q−Xt×Q×A,where
(10)Q=2×r5−1,(11)A=β×E,(12)E=N1rand≥0.5N2rand<0.5.Q represents the impact force, as defined by equation (10), whereas the symbol r5 represents random values in the interval 0,1. Equation (7) may be used to evaluate the parameter A, which reflects the fighting stage. β is preset at the start of the algorithm. E is responsible for mimicking the violent impact on the solutions in equation (12).In conclusion of the exploitation stage, the objective value ofGX is evaluated, and if the objective value of GXt is less thanXt, then GXt will replace theXt as the best solution (silverback).


## 3.1.1. Exploration Phase

In GTO, all members can be solutions and the best solution can be designated to be a silverback gorilla at each optimization operation step. For the exploration stage, the following different strategies were applied: moving toward an anonymous region for the purpose of increasing the ability of GTO exploration, decreasing the search area by distressing the spaces between gorillas to make a balance between exploitation and exploration, and finally moving toward a known region for the purpose of increasing the ability of GTO for inspection of the region.The migration to an undetermined location technique is selected whenrand<p such that p is a parameter. Furthermore, if rand≥0.5, a strategy of mobility to other gorillas is selected, while if rand<0.5, a strategy of moving toward a specified region is selected. In the exploration phase, these three methods may be expressed numerically as in equation (1).
(1)GXt+1=UL−LL×r1+LL,rand<pr2−C×Xrt+L×H,rand≥0.5Xi−L×L×Xt−GXrt+r3×Xt−GXrt,rand<0.5,such that Xt and GXt+1 denote the actual gorilla position and the candidate gorilla position in the next t iteration, respectively. The rand,r1,r2, and r3 denote a value in 01. Before any optimization process, the parameter p must be provided in 01 to show the likelihood of election of the movement strategy to an unidentified region. The parameter Xr is one gorilla chosen from gorilla swarm while GXr is only one group from gorillas in the selected region which may be assigned at random. The lowest and highest bounds of the variables are denoted by LL and UL, respectively. Equations (2), (4), and (5), respectively, may be used to express the variables C,L, and H numerically.
(2)C=F×1−,(3)F=coscos2×r4+1,(4)L=C×l,(5)H=Z×Xt,(6)Z=−C,C,where t and MaxIt indicate the actual iteration and max number of iterations, respectively. r4is the random value inside the interval 0,1. In addition, the characters l stand for the random value in the interval −1,1. In conclusion of the exploration stage, the objective value of GX is determined; if the objective value of GXt is lower than the cost of Xt, the GXt shall supplant the Xt solution as the bestead option (silverback).


## 3.1.2. Exploitation Phase

In the exploitation stage, two methods are used, keep tracking the silverback and then competing for mature females. One of the two methods may be selected according to the results of comparisonC (equation (2)) with W (its value initialized from the starting). The silverback is considered as the commander of a swarm of gorillas that make choices and drive the swarm to food sources. If C≥W, this approach is chosen. Equation (7) may be used to describe this behavior numerically.
(7)GXt+1=L×M×Xt−Xsilverback+Xt.The gorilla position vector is represented byXt, whereas the silverback position is represented by the Xsilverback vector. And M in equation r4 is represented as follows:
(8)M=1N∑i=1NGXitg1/g,g=2l,where the location of each candidate gorilla’s vector at iteration t is shown by GX_it and N denotes the number of gorillas.IfC<W is used, the second tactic for the exploitation stage is competition for mature females. When childish gorillas reach puberty, they fight ferociously with males for mature females. Equation (9) may be used to describe this behavior numerically.
(9)GXi=Xsilverback−Xsilverback×Q−Xt×Q×A,where
(10)Q=2×r5−1,(11)A=β×E,(12)E=N1rand≥0.5N2rand<0.5.Q represents the impact force, as defined by equation (10), whereas the symbol r5 represents random values in the interval 0,1. Equation (7) may be used to evaluate the parameter A, which reflects the fighting stage. β is preset at the start of the algorithm. E is responsible for mimicking the violent impact on the solutions in equation (12).In conclusion of the exploitation stage, the objective value ofGX is evaluated, and if the objective value of GXt is less thanXt, then GXt will replace theXt as the best solution (silverback).


## 4. The Proposed Model

This paper is proposed using the GTO algorithm as an FS model aiming at improving the performance and the efficiency of IDS systems. Several papers have used data mining and machine learning methods to address issues and improve system performance in recent years. To improve the effectiveness of NIDSs, this paper utilized the latter approach and decreased the number of features. The architecture of the suggested model is shown in Figure1. The steps of the proposed model are described deeply in the next sections.Figure 1
The proposed model flowchart.


### 4.1. Feature Extraction Phase

Convolutional neural networks (CNN) have shown to be very effective at extracting features from raw data in various applications such as image and text classification, speech and object detection, and image segmentation. CNN’s ordinarily applied in the computer vision field as the framework feature extractor core. However, the CNN can be structured and designed to fit other applications from other fields as well, including natural language processing (NLP) and human activity recognition (HAR) [40–42]. The CNNs are well known for automatically learning and extracting features from raw data rather than relying on handcrafted features or human intervention. Compared to traditional machine learning models, CNNs are flexible with regard to the number of convolution layers, amount of filters, size of filters, the activation function, and the pooling size and operation. In addition, the CNN can share weights in all used layers to decrease the complexity of the used model and learn more complex representations [43]. Thus, various CNN architectures with different building blocks can be designed to fit various applications. Now, we will report the proposed CNN architecture to build a feature extraction core for our framework to improve the performance of the studied problem.The designed CNN model is used to learn meaningful representations of the raw data signals representing different network attacks. The objective is to better train the CNN model to perform network attack-type classification and extract the learned features representing each attack sample. Later, we fed the extracted features to an FS module to select only the most important features to maximize the framework recognition performance and reduce the computational cost. The proposed CNN is structured as follows:(13)Conv1−1×3@64⟶Conv2−1×3@64⟶FC1−128⟶FC2−128⟶FC3−64⟶BN−64⟶FC4−64.For instance, theConv1−1×3@64 block represents a convolutional layer with 64 filters; each filter has 1×3 sizes and astride of size 1, and the input data is 1 dimensional. The convolution operation at each block is used to learn the activation maps from the raw data, which can be expressed as in equation (14).
(14)Xjl=∑i∈Mjxjl−1kijl+bjl,where xjl−1 represents the previous activation map of the precedent layer l−1. kijl is the kernel weight, and bjl is the bias value. Meanwhile, the CNN is collected from two convolution layers, where each of them is continued with a pooling layer alongside four completely linked layers. The rectified linear unit (ReLU) [44] is applied in the CNN model as the default activation function. In the convolution block, the ReLU function may be applied accordingly in equation (15).
(15)xjl=ReLUXjl,where xjl is the output activation map of the l layer and j channel. The ReLU function is defined according to the following equation:
(16)ReLUz=max0,z.A batch normalization and dropout rate equal to 0.5 are used to reduce the overfitting problem. The Conv1 block uses a max-pooling operation of size two, whereas the Conv2 block uses an adaptive average pooling layer [45]. The fully connected layers named FC1, FC2, FC3, and FC4 are used to extract the features from the CNN model with the following sizes (number of neurons) 128, 128, 64, and 64, respectively. In our experiment, we extract feature representations from FC3 while the final output of FC4 is the classification result of the network attack type. A softmax function follows the FC4 layer to produce the classification probabilities of each sample to be classified to a particular attack type. The Adam optimizer [46] is used to minimize the cross-entropy loss with a 0.005 learning rate. The CNN method tested for 100 epochs with a batch size of 2024. The model with the highest testing accuracy on each dataset from the training process is selected for feature extraction.


### 4.2. Feature Selection Phase

The number of variables generated by the GTO algorithm is equivalent to the feature number in the dataset. All variables are restricted to the range0,1, with values reaching 1 indicating that the relevant characteristic is a candidate for classification selection. In calculating single fitness, the variable must be the threshold, which is used to determine the exact attributes to be assessed, as shown in equation (17):
(17)BXij=1ifXij>0.50,otherwise,where the dimension value for search agent i at dimension j is Xij. We employed a simple truncation rule to assure variable limits while updating each search agent’s location at particular dimensions because the new value might break the limiting constraints 0,1. Next, the algorithm calculates the fitness for each gorilla in equation (18) as follows.
(18)Fitnessi=α×1−Ci+1−α×BXiD,where α is in the range 0,1 and Ci represents the accuracy obtained by the KNN classifier. D is the input training dataset dimension. The best solution will be determined as the smallest fitness value. Thereafter, the agents will be updated using the steps of the GTO algorithm, which are detailed in Section 3.1. The updating stage repeated until it reached the terminal condition. Finally, the GTO algorithm returns the best solution which contains the feature set and is used as the next step to reduce the testing dataset by removing nonrelevant features. In the final step, our model is predestined by applying it to the reduced test set.


## 4.1. Feature Extraction Phase

Convolutional neural networks (CNN) have shown to be very effective at extracting features from raw data in various applications such as image and text classification, speech and object detection, and image segmentation. CNN’s ordinarily applied in the computer vision field as the framework feature extractor core. However, the CNN can be structured and designed to fit other applications from other fields as well, including natural language processing (NLP) and human activity recognition (HAR) [40–42]. The CNNs are well known for automatically learning and extracting features from raw data rather than relying on handcrafted features or human intervention. Compared to traditional machine learning models, CNNs are flexible with regard to the number of convolution layers, amount of filters, size of filters, the activation function, and the pooling size and operation. In addition, the CNN can share weights in all used layers to decrease the complexity of the used model and learn more complex representations [43]. Thus, various CNN architectures with different building blocks can be designed to fit various applications. Now, we will report the proposed CNN architecture to build a feature extraction core for our framework to improve the performance of the studied problem.The designed CNN model is used to learn meaningful representations of the raw data signals representing different network attacks. The objective is to better train the CNN model to perform network attack-type classification and extract the learned features representing each attack sample. Later, we fed the extracted features to an FS module to select only the most important features to maximize the framework recognition performance and reduce the computational cost. The proposed CNN is structured as follows:(13)Conv1−1×3@64⟶Conv2−1×3@64⟶FC1−128⟶FC2−128⟶FC3−64⟶BN−64⟶FC4−64.For instance, theConv1−1×3@64 block represents a convolutional layer with 64 filters; each filter has 1×3 sizes and astride of size 1, and the input data is 1 dimensional. The convolution operation at each block is used to learn the activation maps from the raw data, which can be expressed as in equation (14).
(14)Xjl=∑i∈Mjxjl−1kijl+bjl,where xjl−1 represents the previous activation map of the precedent layer l−1. kijl is the kernel weight, and bjl is the bias value. Meanwhile, the CNN is collected from two convolution layers, where each of them is continued with a pooling layer alongside four completely linked layers. The rectified linear unit (ReLU) [44] is applied in the CNN model as the default activation function. In the convolution block, the ReLU function may be applied accordingly in equation (15).
(15)xjl=ReLUXjl,where xjl is the output activation map of the l layer and j channel. The ReLU function is defined according to the following equation:
(16)ReLUz=max0,z.A batch normalization and dropout rate equal to 0.5 are used to reduce the overfitting problem. The Conv1 block uses a max-pooling operation of size two, whereas the Conv2 block uses an adaptive average pooling layer [45]. The fully connected layers named FC1, FC2, FC3, and FC4 are used to extract the features from the CNN model with the following sizes (number of neurons) 128, 128, 64, and 64, respectively. In our experiment, we extract feature representations from FC3 while the final output of FC4 is the classification result of the network attack type. A softmax function follows the FC4 layer to produce the classification probabilities of each sample to be classified to a particular attack type. The Adam optimizer [46] is used to minimize the cross-entropy loss with a 0.005 learning rate. The CNN method tested for 100 epochs with a batch size of 2024. The model with the highest testing accuracy on each dataset from the training process is selected for feature extraction.


## 4.2. Feature Selection Phase

The number of variables generated by the GTO algorithm is equivalent to the feature number in the dataset. All variables are restricted to the range0,1, with values reaching 1 indicating that the relevant characteristic is a candidate for classification selection. In calculating single fitness, the variable must be the threshold, which is used to determine the exact attributes to be assessed, as shown in equation (17):
(17)BXij=1ifXij>0.50,otherwise,where the dimension value for search agent i at dimension j is Xij. We employed a simple truncation rule to assure variable limits while updating each search agent’s location at particular dimensions because the new value might break the limiting constraints 0,1. Next, the algorithm calculates the fitness for each gorilla in equation (18) as follows.
(18)Fitnessi=α×1−Ci+1−α×BXiD,where α is in the range 0,1 and Ci represents the accuracy obtained by the KNN classifier. D is the input training dataset dimension. The best solution will be determined as the smallest fitness value. Thereafter, the agents will be updated using the steps of the GTO algorithm, which are detailed in Section 3.1. The updating stage repeated until it reached the terminal condition. Finally, the GTO algorithm returns the best solution which contains the feature set and is used as the next step to reduce the testing dataset by removing nonrelevant features. In the final step, our model is predestined by applying it to the reduced test set.


## 5. Experimental Results

To prove the performance of the GTO in FS, we tested the model on the NSL-KDD, CICIDS2017, and BoT-IoT datasets for experiments locally by the anaconda environment.


### 5.1. Dataset Description

NSL-KDD is described in Figure2 with its statistics and the collection process described in [7]. It is well known in the IDS area and considered the most dependable dataset. The NSL-KDD removes duplicate data; thus, it includes fewer redundant entries when compared to the KDD-CUP-99 data. It consists of 41 features with5 attack types.Figure 2
Data distribution of NSL-KDD training and testing sets.The Canadian Institute for Cybersecurity (CIC) published (CICIDS2017). The data was gathered during a five-day period in real time byCICFlowMeter software. It consists of 78 features with a label for attack types. After one-hot encoding, the number of features becomes 129. The dataset is described in Figure 3 with its statistics and the collection process described in [47].Figure 3
Data distribution of CICIDS2017 training and testing sets.BoT-IoT is utilized for effective FS and accurate detection in IoT environments. The dataset contains traffic flows from the Internet of things, as well as traffic flows from botnets and other cyber-attacks. The actual testbed is utilized for the creation of this data with known characteristics in order to track the correct traffic and create an effective dataset. Only 5% of the full BoT-IoT dataset was used in this experiment. The dataset is described in Figure4 with its statistics and the collection process described in [48].Figure 4
Data distribution of Bot-IoT training and testing sets.


### 5.2. Performance Metrics

There are a number of measures that may be used to assess FS models. These measures are according to the application’s nature. The true positive rate (TPR) and FPR performance indicators were used by the majority of studies to evaluate their IDS. We describe the set of performance measures that will be utilized to assess the proposed strategy in this section. The confusion matrix output may be used to calculate all of the chosen metrics. Four primary parameters make up a confusion matrix [49, 50]: true positive (TP)—the number of attack occurrences accurately categorized; true negative (TN)—number of accurately categorized normal occurrences; false positive (FP)—the number of normal occurrences that have been incorrectly categorized as an assault; and false negative (FN)—the number of attack occurrences that have been incorrectly categorized as normal.According to the confusion matrix [51], performance metric definition and formulae are as follows: sensitivity—as in equation (19), this variable represents the fraction of real assaults that are accurately detected.
(19)TPR=TPTP+FN,accuracy—this metric represents the proportion of correctly categorized labels to all quantities of classifications.
(20)Accuracy=TP+TNTP+TN+FP+FN,F-score (F-measure)—calculate the model’s accuracy by taking into account together precision and recall, as in
(21)F−score=2∗TP2∗TP+FP+FN,recall—the number of examples is labeled as assaults among all invasive examples, also known as sensitivity and true positive rate (TPR).
(22)Recall=TPTP+FN.


### 5.3. Results and Discussion

The ability of an IDS to categorize network traffic into the correct category is used to evaluate its performance. All performance findings presented in this work are the medium value of outputs from 10 epochs. We predestined the performance of the proposed approach with several state-of-the-art techniques such as PSO [52], MVO [53], GWO [54], MFO [55], WOA [56], FFA [57], and BAT [58] algorithms with respect to many detection metrics, including accuracy, precision, F-score, and recall. All of the employed FS algorithms are predestined using the KNN classifier from the scikit-learn library in python [59].As noticed in Table1, the GTO algorithm obtained a higher value in accuracy, precision, F1-score, recall, and lower number of selected features. The other methods also performed poorly in relation to all metrics; all best values are highlighted. As can be observed, the GTO algorithm applied in the NSL KDD dataset obtained a mean accuracy of 99.61% overall of other algorithms. The best mean precision rate (99.60%) obtained by GTO was greater than all compared algorithms. The GTO obtained the lowest number of selected features (11), which improved the performance for other results. The GWO algorithm comes in second place after GTO; it obtained the best results over the remaining algorithms in all metric terms. At the same time, the FFA algorithm obtained the worst values in terms of all metrics.Table 1
Results of the NSL-KDD dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO98.6298.2398.4398.4354MVO99.0299.0299.0299.0251GWO99.0399.0399.1399.1318MFO98.1198.1198.0198.4154WOA99.0299.0299.0499.0220FFA97.2297.9298.0297.9450BAT98.3398.0398.1398.0756GTO99.6199.6099.6199.6512The results of the CICIDS2017 dataset are presented in Table2; the GTO algorithm obtained the highest value in all metrics. The other methods also performed poorly in relation to all metrics. As can be noticed, the GTO algorithm obtained the best mean accuracy of 99.93%, mean precision rate of 99.94%, mean F1-score rate of 99.95%, and mean recall rate of 99.94% which are greater than all compared algorithms. The GTO obtained the lowest number of selected features (30), which improved the performance for other results. The PSO algorithm obtained the worst values in terms of all metrics.Table 2
Results of the CICIDS2017 dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO97.8497.9397.9497.9352MVO98.1298.9698.9798.9447GWO98.1498.4398.4498.4635MFO98.2198.3498.4398.3451WOA99.2099.2599.2499.2656FFA98.8098.9498.9598.9640BAT98.4898.5798.5298.5755GTO99.9399.9499.9599.9430In Table3, the GTO algorithm obtained the best mean accuracy of 99.03%, best mean precision rate of 99.04%, best mean F1-score rate of 99.03%, and mean recall rate of 99.04%, which is greater than all compared algorithms. The GTO obtained the lowest number of selected features (9), which increased the performance for other results. The WOA algorithm has accuracy and precision value nearly 99.03% and 99.04%, respectively, which are equivalent to GTO. But, the values of WOA in terms of the Fs score and recall are 99.01% and 99.03%, respectively, and these values are less than the values obtained by GTO. The PSO algorithm obtained the worst values in terms of all metrics.Table 3
Results of the Bot-IoT dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO97.8398.0197.8398.0125MVO98.2398.5798.5798.7726GWO98.6998.7598.2998.4523MFO98.7898.8998.9998.5925WOA99.0399.0499.0199.0315FFA98.6998.5798.4998.7726BAT98.9098.2398.2398.2324GTO99.0399.0499.0399.0410The Friedman test rates the algorithms independently for the three datasets [60]. Such that the best algorithm receives the highest rank and the lowest algorithm receives the lowest rank. As observed in Table 3, the GTO obtained the highest value in accuracy, precision, F1-score, and recall. WOA algorithm comes in second place after GTO, while the PSO algorithm comes in the last place in terms of all metrics. Figures 5, 6, 7, and 8 show the average values for all algorithms in the three datasets. The figures prove the superiority of the GTO algorithm.Figure 5
The average of accuracy for the three datasets.Figure 6
The average ofF1-score for the three datasets.Figure 7
The average of precision for the three datasets.Figure 8
The average of recall for the three datasets.


## 5.1. Dataset Description

NSL-KDD is described in Figure2 with its statistics and the collection process described in [7]. It is well known in the IDS area and considered the most dependable dataset. The NSL-KDD removes duplicate data; thus, it includes fewer redundant entries when compared to the KDD-CUP-99 data. It consists of 41 features with5 attack types.Figure 2
Data distribution of NSL-KDD training and testing sets.The Canadian Institute for Cybersecurity (CIC) published (CICIDS2017). The data was gathered during a five-day period in real time byCICFlowMeter software. It consists of 78 features with a label for attack types. After one-hot encoding, the number of features becomes 129. The dataset is described in Figure 3 with its statistics and the collection process described in [47].Figure 3
Data distribution of CICIDS2017 training and testing sets.BoT-IoT is utilized for effective FS and accurate detection in IoT environments. The dataset contains traffic flows from the Internet of things, as well as traffic flows from botnets and other cyber-attacks. The actual testbed is utilized for the creation of this data with known characteristics in order to track the correct traffic and create an effective dataset. Only 5% of the full BoT-IoT dataset was used in this experiment. The dataset is described in Figure4 with its statistics and the collection process described in [48].Figure 4
Data distribution of Bot-IoT training and testing sets.


## 5.2. Performance Metrics

There are a number of measures that may be used to assess FS models. These measures are according to the application’s nature. The true positive rate (TPR) and FPR performance indicators were used by the majority of studies to evaluate their IDS. We describe the set of performance measures that will be utilized to assess the proposed strategy in this section. The confusion matrix output may be used to calculate all of the chosen metrics. Four primary parameters make up a confusion matrix [49, 50]: true positive (TP)—the number of attack occurrences accurately categorized; true negative (TN)—number of accurately categorized normal occurrences; false positive (FP)—the number of normal occurrences that have been incorrectly categorized as an assault; and false negative (FN)—the number of attack occurrences that have been incorrectly categorized as normal.According to the confusion matrix [51], performance metric definition and formulae are as follows: sensitivity—as in equation (19), this variable represents the fraction of real assaults that are accurately detected.
(19)TPR=TPTP+FN,accuracy—this metric represents the proportion of correctly categorized labels to all quantities of classifications.
(20)Accuracy=TP+TNTP+TN+FP+FN,F-score (F-measure)—calculate the model’s accuracy by taking into account together precision and recall, as in
(21)F−score=2∗TP2∗TP+FP+FN,recall—the number of examples is labeled as assaults among all invasive examples, also known as sensitivity and true positive rate (TPR).
(22)Recall=TPTP+FN.


## 5.3. Results and Discussion

The ability of an IDS to categorize network traffic into the correct category is used to evaluate its performance. All performance findings presented in this work are the medium value of outputs from 10 epochs. We predestined the performance of the proposed approach with several state-of-the-art techniques such as PSO [52], MVO [53], GWO [54], MFO [55], WOA [56], FFA [57], and BAT [58] algorithms with respect to many detection metrics, including accuracy, precision, F-score, and recall. All of the employed FS algorithms are predestined using the KNN classifier from the scikit-learn library in python [59].As noticed in Table1, the GTO algorithm obtained a higher value in accuracy, precision, F1-score, recall, and lower number of selected features. The other methods also performed poorly in relation to all metrics; all best values are highlighted. As can be observed, the GTO algorithm applied in the NSL KDD dataset obtained a mean accuracy of 99.61% overall of other algorithms. The best mean precision rate (99.60%) obtained by GTO was greater than all compared algorithms. The GTO obtained the lowest number of selected features (11), which improved the performance for other results. The GWO algorithm comes in second place after GTO; it obtained the best results over the remaining algorithms in all metric terms. At the same time, the FFA algorithm obtained the worst values in terms of all metrics.Table 1
Results of the NSL-KDD dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO98.6298.2398.4398.4354MVO99.0299.0299.0299.0251GWO99.0399.0399.1399.1318MFO98.1198.1198.0198.4154WOA99.0299.0299.0499.0220FFA97.2297.9298.0297.9450BAT98.3398.0398.1398.0756GTO99.6199.6099.6199.6512The results of the CICIDS2017 dataset are presented in Table2; the GTO algorithm obtained the highest value in all metrics. The other methods also performed poorly in relation to all metrics. As can be noticed, the GTO algorithm obtained the best mean accuracy of 99.93%, mean precision rate of 99.94%, mean F1-score rate of 99.95%, and mean recall rate of 99.94% which are greater than all compared algorithms. The GTO obtained the lowest number of selected features (30), which improved the performance for other results. The PSO algorithm obtained the worst values in terms of all metrics.Table 2
Results of the CICIDS2017 dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO97.8497.9397.9497.9352MVO98.1298.9698.9798.9447GWO98.1498.4398.4498.4635MFO98.2198.3498.4398.3451WOA99.2099.2599.2499.2656FFA98.8098.9498.9598.9640BAT98.4898.5798.5298.5755GTO99.9399.9499.9599.9430In Table3, the GTO algorithm obtained the best mean accuracy of 99.03%, best mean precision rate of 99.04%, best mean F1-score rate of 99.03%, and mean recall rate of 99.04%, which is greater than all compared algorithms. The GTO obtained the lowest number of selected features (9), which increased the performance for other results. The WOA algorithm has accuracy and precision value nearly 99.03% and 99.04%, respectively, which are equivalent to GTO. But, the values of WOA in terms of the Fs score and recall are 99.01% and 99.03%, respectively, and these values are less than the values obtained by GTO. The PSO algorithm obtained the worst values in terms of all metrics.Table 3
Results of the Bot-IoT dataset.
OptimizerAccuracyPrecisionF1-scoreRecall# of featuresPSO97.8398.0197.8398.0125MVO98.2398.5798.5798.7726GWO98.6998.7598.2998.4523MFO98.7898.8998.9998.5925WOA99.0399.0499.0199.0315FFA98.6998.5798.4998.7726BAT98.9098.2398.2398.2324GTO99.0399.0499.0399.0410The Friedman test rates the algorithms independently for the three datasets [60]. Such that the best algorithm receives the highest rank and the lowest algorithm receives the lowest rank. As observed in Table 3, the GTO obtained the highest value in accuracy, precision, F1-score, and recall. WOA algorithm comes in second place after GTO, while the PSO algorithm comes in the last place in terms of all metrics. Figures 5, 6, 7, and 8 show the average values for all algorithms in the three datasets. The figures prove the superiority of the GTO algorithm.Figure 5
The average of accuracy for the three datasets.Figure 6
The average ofF1-score for the three datasets.Figure 7
The average of precision for the three datasets.Figure 8
The average of recall for the three datasets.


## 6. Conclusion

This work proposed a feature extraction technique by the CNN method and a modified version of the GTO algorithm as an FS approach to increase the detection accuracy in IDSs. The model has been tested on three datasets and evaluated by using the KNN classifier. In terms of accuracy, precision,F1-score, and recall, the results proved that the proposed model could be used in IDS due to its higher performance compared to other models. It is worth mentioning that the limitation of this work was the long time that the model the results.took to getWe propose the reason was by our limited hardware resources. As a future recommendation for this work, the developed method can be applied to other fields, including medical image classification, 5G network communication, and agriculture.



---

*Source: 6131463-2022-03-25.xml*