# Empirical Evaluation of Noise Influence on Supervised Machine Learning Algorithms Using Intrusion Detection Datasets

Authors: Khalid M. Al-Gethami; Mousa T. Al-Akhras; Mohammed Alawairdhi
Journal: Security and Communication Networks
 (2021)

---

## Abstract

Optimizing the detection of intrusions is becoming more crucial due to the continuously rising rates and ferocity of cyber threats and attacks. One of the popular methods to optimize the accuracy of intrusion detection systems (IDSs) is by employing machine learning (ML) techniques. However, there are many factors that affect the accuracy of the ML-based IDSs. One of these factors is noise, which can be in the form of mislabelled instances, outliers, or extreme values. Determining the extent effect of noise helps to design and build more robust ML-based IDSs. This paper empirically examines the extent effect of noise on the accuracy of the ML-based IDSs by conducting a wide set of different experiments. The used ML algorithms are decision tree (DT), random forest (RF), support vector machine (SVM), artificial neural networks (ANNs), and Naïve Bayes (NB). In addition, the experiments are conducted on two widely used intrusion datasets, which are NSL-KDD and UNSW-NB15. Moreover, the paper also investigates the use of these ML algorithms as base classifiers with two ensembles of classifiers learning methods, which are bagging and boosting. The detailed results and findings are illustrated and discussed in this paper.


---

## Body

## 1. Introduction

The numbers of cyber threats facing individuals, organizations, and government agencies are increasing rapidly. In addition, the ferocity of such attacks has also increased to more destructive levels. High-level intruders such as the advanced persistent threat (APT) are utilizing stealthier methods to penetrate protected systems and networks. This emphasizes the urgent need to optimize intrusion detection systems (IDSs).IDSs are a form of technical security controls that can be used to detect different forms of intrusions, malicious patterns, probing attempts, and unauthorized activities.The accuracy of IDSs can be optimized using machine learning (ML) techniques which were used successfully in many fields such as image identification and pattern recognition. In addition, ML-based techniques are also widely deployed in the intrusion detection field. One of the biggest advantages of ML-based IDSs is that they can be utilized to detect both misuse and anomaly attacks. However, ML-based techniques are more suitable to detect anomalies which are extremely important to confront zero-day attacks.New intrusion detection techniques, whether they are based on ML techniques or not, are usually tested on intrusion-related datasets that contain normal traffic and activities injected with different forms of attacks. These datasets are widely used to evaluate the effectiveness of newly proposed IDSs. However, the presence of noise might influence the effectiveness and impacts the accuracy of ML-based IDSs, especially when implementing such systems in the real world, where noisy data are more likely to occur.In this paper, we will empirically investigate the effect of mislabelled instances that can influence the effectiveness of ML-based IDSs. Different levels of noise are injected, and the classification accuracy of the ML-based IDSs is studied. Furthermore, the effect of using noise filtering on the accuracy of ML-based IDSs is also analyzed. Noise will be filtered by excluding outliers and extreme value instances.The aim of analyzing noise with ML algorithm is to test the robustness of different ML algorithms in noisy situations. In other words, it will help to determine the most noise-resilient ML algorithm. In addition, the paper also investigates the employment of ensemble learning techniques with the IDSs.The rest of this paper is organized as follows: Section2 reviews IDS, relevant ML algorithms, ensemble of classifiers, noise filtering, and several works from the literature related to the use of ML in IDS. Section 3 presents the proposed methodology. Several datasets related to intrusion detection are reviewed. Also, the conducted experiments are described including noise injection, noise filtering, and the metrics used to compare the performance of different ML models. Section 4 discusses the results and analyses the outcomes of the conducted experiments. Finally, Section 5 concludes the paper and presents avenues for future work.


## 2. Literature Review

This section reviews intrusion detection, ML, and noise. It starts by demonstrating the types, components, and deployment of IDSs. ML categories, ML algorithms that are used in this paper, and the ensemble learning methods are also discussed. It also discusses noise filtering by removing the outliers and the extreme values. Finally, this section demonstrates previous research efforts that focus on ML-based IDSs.


### 2.1. Intrusion Detection System

IDS helps to detect many forms of attacks and sends alarms to the system or the security administrators. It is critical to develop an IDS that achieves high detection rates with no or minimum false alarms. IDS can be broadly categorized into misuse and anomaly detection.Elsayed et al. [1] gave credit to Anderson for the introduction of the concept of intrusion detection in his 1980 paper. That paper discussed the feasibility of detecting misuse by investigating the audit trails. Elsayed et al. [1] pointed out that the original IDS was based on expert systems.According to Rathore et al. [2], the concept of the IDS was initially introduced in 1986 [3] and 1987 [4] by Denning based on expert systems. The system was referred to as the intrusion detection expert system (IDES). However, Kumar and Venugopalan [5] gave a balanced credit; according to them, Anderson introduced the concept of the IDS while Denning formalized IDS by introducing a rule-based expert system that can detect malicious users’ activities in real time. An overview of the historical IDS milestones can be found in [5].


#### 2.1.1. Types of IDSs

The way the collected data are inspected defines how efficiently an IDS can detect different categories of probes and intrusions. Generally, the methods that an IDS analysis engine uses to inspect the collected data can be broadly categorized into either misuse detection or anomaly detection.Misuse detection approaches operate by matching the current behavior with known and previously defined attack patterns, signatures, or rules [6]. Therefore, it is critical to maintain an IDS up to date and inclusive of different known attack patterns, signatures, and rules to ensure the effectiveness of the misuse detection IDS. However, it is not feasible to use the misuse-based methods to detect zero-day attacks because no patterns, signatures, or rules are defined for zero-day attacks.On the other hand, anomaly detection techniques operate based on the ability to detect deviations from normal behavior or pattern [7]. It operates based on the principle that malicious behavior differs from normal behavior, which makes it feasible to detect it [6]. Defining normal behavior requires a period of time; consequently, anomaly-based IDS needs sometime after the installation to become active. Anomaly-based IDSs are more prone to errors producing high rates of false alarms.ML-based IDS can be used to detect both misuse and anomaly [5, 6]. In particular, the supervised ML can be used with misuse detection, whereas unsupervised ML-based techniques can be used to conduct anomaly detection. Table 1 highlights the main differences between the misuse and the anomaly intrusion detection methods [6].Table 1
The main differences between misuse and anomaly intrusion detection methods.
CriteriaMisuse detectionAnomaly detectionBasic principleUsing previously defined patterns/signatures/rules to detect intrusionEstablishes normal behavior profile and detects intrusion based on deviations from that profileDetecting unknown attacksNoYesDetecting known attacksVery goodGoodRates of false positiveVery lowModerate to high (depends on many factors)Constant update of the databaseYesNoSuitable ML approachSupervised MLUnsupervised MLBiggest challengeMaintaining an up-to-date database of all known attack signaturesDifferentiating normal from malicious behavior


#### 2.1.2. Components of IDSs

A typical network-based IDS consists of four components, which are a decoder, a preprocessor, a decision engine sensor, and a defense response. The decoder uses data collection tools to gather specific network traffic in raw format and passes these data to the second component. The preprocessor examines the set of protocols that are used in the transmission of the data and extracts certain features. After that, the decision engine sensor utilizes these features to differentiate normal traffic from malicious traffic. If malicious traffic were detected, it sends a signal to the defense response, which, in turn, sends an alert to the security administrators and logs the event in the database [8]. Figure 1 illustrates the typical components of an IDS.Figure 1
The typical components of an IDS.


#### 2.1.3. Deployment of IDSs

IDSs can be deployed either in the network or within the host. An IDS that is deployed across the network is typically called network-based IDS (NIDS) and an IDS that runs at a certain host is called host-based IDS (HIDS) [9]. NIDS can be used to monitor the traffic within the organization’s network, typically installed at the network choke points. On the other hand, HIDS can be installed on critical servers to detect potential intrusions or misuses. It can also be installed on the decoy systems (Honey pots) to detect potential intrusions.


### 2.2. Machine Learning

Machine learning (ML) is a branch of artificial intelligence (AI). The term “machine learning” was coined by Arthur Samuel back in 1959 when he was working at IBM [5]. Samuel defined ML as “the field of study that gives computers the ability to learn without being explicitly programmed” [5]. It is closely related to computational statistics [10]. The first ML algorithms emerged in the 1970s [11]; nowadays, ML is becoming a popular research area [12].ML algorithms can be classified into four distinct categories, supervised learning, semisupervised learning, unsupervised learning, and reinforcement learning [13]. Both supervised and unsupervised learning can be divided further into two different subcategories. The general classification of ML is presented in Figure 2.Figure 2
A general ML classification.


#### 2.2.1. Supervised Learning

In supervised learning, an algorithm is presented with a set of data that contains the input data and the corresponding output. The algorithm attempts to discover the underlying relation between the input and the output [11]. In supervised learning, data are labelled. Supervised learning can be typically used in two categories of problems [14]:(i)
Classification problems that aim to predict a discrete number of values(ii)
Regression problems that aim to predict a continuous-valued outputThis paper focuses on supervised learning. More specifically, to study the effect of noise on the classification models, each ML model will be trained on labelled instances of two different IDS datasets (described later). In the first dataset, each instance is labelled as either normal or anomaly. In the second dataset, instances are labelled as either 0 (normal) or 1 (malicious).


#### 2.2.2. Semisupervised Learning

Semisupervised learning algorithm is a combination of supervised and unsupervised algorithms that leverages a small percentage of labelled instances to generalize on a large percentage of unlabelled instances. This is very useful in certain cases such as searching for a particular person in an extremely large set of images. For instance, a certain person could be manually labelled in few images and the model will start mining for that person in the remaining large part of the images [13].


#### 2.2.3. Unsupervised Learning

Unsupervised learning attempts to deduce the hidden structure of the datasets. Typically, all data in unsupervised learning algorithms are unlabelled. Unsupervised learning problems can be categorized as follows [11]:(i)
Clustering problems that attempt to divide the data into clusters that satisfy certain criteria(ii)
Dimensionality reduction problems that attempt to reduce the dimensionality of the data while maintaining the fundamental aspects of the data, i.e., highest variability


#### 2.2.4. Reinforcement Learning

This form of learning is based on trial-and-error approach, in which a learning system gathers certain data and takes an action; if the action yielded a positive result, then a reward will be recorded. If that action resulted in an unwanted result, then the system will learn that this action in that context will not likely work well in future events. This form of learning is suitable for certain fields such as robotics. It can be utilized to learn robotics how to move, carry an object, or avoid physical obstacles [13].


### 2.3. ML Algorithms Used in This Paper

There are a large number of ML algorithms. The ML algorithms that are used in this paper are as follows.


#### 2.3.1. Decision Trees (DTs)

DT uses a set of rules to classify data based on the attributes’ values [10]. Classification is represented in a tree-structure format where branches represent the selection of the value of input features that lead to those classifications and leaves represent class labels. DTs are characterized by the high accuracy of the classification and the simplicity of implementation. However, decision trees are biased with multilevel features [15].In this paper, J48 flavor of decision trees is used. During the tree construction, the training dataset is recursively divided into several subsets. The best split is often based on children impurity such as the entropy which is defined as follows [16, 17]:(1)entropy=−∑0c−1pi|tlog2pi|t,where c is the number of classes and 0log20=0 in entropy calculations.


#### 2.3.2. Random Forest (RF)

RF combines multiple DTs where each DT is constructed based on the values of independent random vectors. The results of the RF can be controlled by the majority or weighted voting [15]. RF can be considered as one of the ensemble learning methods [2] because RF tends to combine the outcomes of several DTs [6]. When the number of trees is sufficiently large, the upper bound of the generalization error converges according to the following formula [16]:(2)generalization error≤ρ¯1−s2s2,where ρ¯ is the average correlation among the trees and s is a measure of strength of the tree classifiers. The strength refers to the average performance of the classifiers measured probabilistically as(3)margin,MX,Y=PY^θ=Y−maxZ≠YPY^θ=Z,where Y^θ is the predicted class of X according to a classifier built from some random vector θ. The higher the margin, the more likely the classifier correctly predicts an example X.


#### 2.3.3. Support Vector Machine (SVM)

SVM is a supervised learning algorithm that uses a hyperplane to classify the data. The hyperplane is used to separate the data into different classes based on the features’ space. SVM algorithm is among the most robust and accurate ML algorithms [10]. A linear SVM classifier differentiates between instances from two classes according to the following equation [13]:(4)y^=0,ifwTx+b<0,1,ifwTx+b≥0,where x represents an instance to be classified, w represents the weight vector, and b is the bias value.


#### 2.3.4. Artificial Neural Networks (ANNs)

ANN was inspired by the human brain. The implementation of the ANN in the computer realm consists of a number of artificial neurons that are distributed across different layers. An ANN typically consists of three layers [6, 18, 19], which are the input layer, the hidden layer, and the output layer. The dataset is passed to the input nodes and the output nodes are used to present the classification results. This paper uses multilayer perceptron (MLP) to implement ANN within the experiments. MLP is an ANN, usually trained using backpropagation algorithm [17, 20].The output of the hidden neuroni can be calculated as follows:(5)hi=f1bi+∑j=1nWijXi,where xi is the input data, xi, i = 1, …, n; Wij denotes the weight connecting input neuron j to hidden neuron i, bi is the bias for neuron i, and f1 is the used transfer function.The output of the output neuroni can be calculated as follows [17]:(6)Oi=f2bi+∑j=1nkVijhi,where nk is the number of hidden neurons and Vij denotes the weight connecting hidden neuron i to the output neuron j.The goal of ANN is to minimize the total sum of squared error between the predicted output and the true output (ground truth) [16]:(7)Ew=12∑i=1Nyi−y^i2.The weights of the network can be updated according to the gradient descent method as follows [16]:(8)wj←wj−λ∂Ew∂wj.


#### 2.3.5. Naïve Bayes (NB)

NB is called naïve because it relies on a simplifying assumption, which assumes that the attribute values are conditionally independent of each other. One of the main advantages of Naïve Bayes is the speed of training and testing. However, the attribute values of some intrusion detection datasets such as the KDD CUP 99 and the NSL-KDD are highly dependent on each other [7]. This means that the accuracy of NB is highly influenced by the degree of dependencies between the attribute values of the datasets [15]. When building an IDS classifier based on the NB algorithm, the classification is performed according to the following equation:(9)yf1,f2,…,fm=argmaxk∈1,…,KpCk∏i=1mpfi|Ck,where m represents the number of features, k represents the number of classes, fi stands for the i-th feature, Ck stands for the k-th class, p(Ck) is the prior probability of Ck, and pfi|Ck represents the conditional probability.


#### 2.3.6. Comparison of the ML Algorithms

A comparison between the above ML algorithms is illustrated in Table2 [15, 21]. More details about the differences between common ML algorithms can be found in [21].Table 2
A comprehensive comparison between different ML classification algorithms [15, 21].
ML algorithmAdvantagesDisadvantagesDT(i) Very simple and fast(i) Requires long time to train the model(ii) Not affected by the increase of the dimensionality of the data(ii) Requires larger amount of memory for analyzing large databases(iii) The model is easily understood (plausible)(iii) Not suitable for problems that require diagonal partitioning(iv) Generates good accuracy based on the quality of the data(iv) Can generate a complex representation for some concepts due to the replication(v) Support incremental learning(v) The order of the attributes affects the performanceRF(i) Can resist overfitting(i) Difficult to interpret the model(ii) Does not require attributes selection(ii) Correlated variables cause performance degradation(iii) Model variances decrease with the increase in the number of trees(iii) Reliance on the random generator of the implementation(iv) Increasing the number of trees does not affect the bias of the modelSVM(i) One of the most robust and accurate algorithms(i) Requires intensive computations to build the model(ii) Requires few data for training and is not affected by the dimensionality of the data(ii) Very slow in the learning phase(iii) Generate the best function to conduct binary classification(iii) Memory required doubles as the number of training instances increases(iv) Less prone to overfitting compared to other algorithms(iv) It is difficult to interpret the results of the modelANN(i) Tolerable to noise and able to predict new classes(i) Requires a long time to train a model(ii) Applicable even if the relation between attributes and classes is not well defined(ii) Very difficult to interpret how the model works(iii) Suitable for continuous values(iii) Requires empirical adjustment of different parameters such as the number of hidden layers and the number of nodes in each layer(iv) Computations can be accelerated due to ANN parallel nature(v) Applied successfully to different real-world issues such as handwritten character recognition and laboratory medicineNB(i) Requires short time for training and it is easy to construct the model(i) Theoretically, classifiers based on NB algorithms have a low error rate. However, in practice, this is not entirely true due to the assumption that different attributes are independent of each other(ii) Can be computationally optimized(ii) Yields low accuracy results compared to other ML algorithms(iii) Can be used with large datasets(iv) Outcomes are easily interpreted(v) It operates in a well and robust manner even though it might not be the best algorithm for a certain application


### 2.4. Ensemble of Classifiers

Ensemble learning consolidates several techniques to obtain better overall accuracy, which outperforms the accuracy of each single technique [8]. One of the main advantages of using ensemble learning is that it might solve the overfitting issues and improves the classification accuracy. On the other hand, the disadvantage of ensemble learning includes the increase in the required time and memory to build the model when compared to individual classifiers.Additionally, learning concepts might become more difficult to understand, i.e., less plausible. Popular methods for conducting ensemble learning are bagging, boosting, voting, and stacking [6]. This paper will utilize both bagging and boosting.Bagging, also called bootstrap aggregation, is an ensemble method that is used to improve accuracy and reduce overfitting. This is achieved by deploying a model-averaging technique. On the other hand, boosting operates by training multiple weak learners and aggregating the weighted results [15]. In this paper, we have used the AdaBoost method to implement boosting on the intrusion datasets.


### 2.5. Noise Filtering

Noisy data may affect the accuracy of different ML algorithms. This paper adopts an empirical approach to study the potential effect of noise. It discusses the removal of outliers and extreme values to filter noisy data. There is a wide set of different algorithms that can be used to conduct noise filtering. This paper uses interquartile range (IQR) filter for noise filtering. This filter detects outliers and extreme values from a given dataset. According to this filter, the outliers are defined according to the following equations [22]:(10)Q3+OF∗IQR<x≤Q3+EVF∗IQR,(11)Q1−EVF∗IQR≤x<Q1−OF∗IQR.On the other hand, the extreme values are located according to the following equations:(12)x>Q3+EVF∗IQR,(13)x<Q1−EVF∗IQR,where Q1 = 25% quartile, Q3 = 75% quartile, IQR is the interquartile range, which represents the difference between Q1 and Q3, OF is the outlier factor, and EVF is the extreme value factor.After applying this filter, outliers and extreme values will be labelled into two additional attributes. After that, all instances within these two attributes can be removed from the dataset. This means that outlier and extreme values will be excluded from the dataset, resulting in an instant reduction. Table3 illustrates the original number of instances and the new number of instances in the used datasets before and after applying noise filtering for both datasets.Table 3
The total number of instances before and after excluding the outliers and the extreme values.
DatasetData fileBefore filteringAfter filteringTotal no. of instancesNo. of benign instancesNo. of attack instancesTotal no. of instancesNo. of benign instancesNo. of attack instancesNSL-KDDKDDTrain+125,97367,34358,63045,33112,36032,971KDDTest+22,5449,71112,8332,6702,149521UNSW-NB15UNSW-NB15 training175,34156,000119,34154,7297,50347,226UNSW-NB15 testing82,33237,00045,33231,46810,04521,423After verifying that the removal of the noisy instances did not eliminate all the attack instances, it is also critical to ensure that benign and malicious traffic were not entirely eliminated. To accomplish that, the distribution of the different classes of network traffic before and after noise filtering for both the training and the testing portions of the UNSW-NB15 dataset was calculated and the results are illustrated in Table4, which illustrate that none of the network traffic classes were entirely eliminated after the noise filtering process. This was feasible to calculate because one of the UNSW-NB15 attributes, called the attack_cat attribute, was originally dedicated to illustrate the number of instances within each category. Unfortunately, it was unfeasible to calculate the distribution of the different categories of the network traffic for the NSL-KDD dataset because there was no attribute that distinguishes these categories from each other.Table 4
The distribution of the network traffic between different categories before and after noise filtering in both the training and the testing portion of the UNSW-NB15.
Traffic categoriesThe training portionThe testing portionBefore noise filteringAfter noise filteringBefore noise filteringAfter noise filteringNo. of instancesDistribution (%)No. of instancesDistribution (%)No. of instancesDistribution (%)No. of instancesDistribution (%)Normal56,00031.93777,50313.709337,00044.939910,04531.9213Analysis20001.14061,2752.32966770.82225341.6969Reconnaissance104915.98317,31313.36223,4964.24622,8018.9011Shellcode11330.64618011.46353780.45912920.9279Fuzzers1818410.37068,25315.07976,0627.36283,85112.2378Worm1300.0741100.0182440.0534110.0349Generic4000022.81265,65010.323518,87122.92067,05222.4100DoS122646.99438,86816.20344,0894.96642,4427.7602Exploits3339319.044613,67224.899011,13213.52083,98112.6509Backdoors17460.99571,3842.52885830.70814591.4586


### 2.6. Relevant Literature

Based on the authors’ research in the literature, there is a great lack of papers that empirically discuss the subject of using ML techniques on IDS-related datasets in the presence of noise.An empirical study between several classification algorithms on two intrusion-related datasets, namely, KDD CUP 99 and NSL-KDD, was conducted by Hussain and Lalmuanawma [23]. The noise was injected to a specific set of attributes by 10% and 20%. However, NSL-KDD is basically an enhanced version of the KDD CUP 99. The redundant instances that existed in the KDD CUP 99 dataset were removed in the NSL-KDD dataset. The ML algorithms, in this paper, achieved more realistic results with the NSL-KDD dataset in comparison with the KDD CUP 99. This was an expected outcome due to the absence of redundant records in the NSL-KDD dataset. However, in the current manuscript, we will investigate a different form of noise that could take place due to mislabelled instances, which is, in turn, injected only to a single attribute. Furthermore, in this paper, we will use two independent intrusion datasets.Other efforts such as [24, 25] investigated the effect of noise with regression tasks, which entails the attempts to predict a numerical value. However, in this paper, we are focusing on classification, which entails classifying different instances to one of two or more predefined categories.Wang [14] used deep learning (DL) IDS with adversaries. Different attack algorithms taken from the image processing field are used in the intrusion detection field mainly with the NSL-KDD dataset. DL techniques are vulnerable to adversarial imperceptible malicious examples in the image classification domain. Adversarial examples are noisy data specially crafted to attack the DL model. The Jacobian-based saliency map attack (JSMA) and fast-gradient sign method (FGSM) were used to inject noisy data. Furthermore, the paper injected noisy data in the most salient features, which are the features that have the most influence on the results.Table5 summarizes several recent journal articles from different publishers that discuss the subject of using ML methods in intrusion detection.Table 5
Summary of papers that discusses the use of ML with intrusion detection.
#ReferenceJournal/publisherTitleDescriptionML algorithmsDatasetsNoiseEvaluation metrics1[26]IEEE Access/IEEEPerformance comparison of support vector machine, random forest, and extreme learning machine for intrusion detectionA performance comparison between different ML algorithms(i) SVM (linear)NSL-KDDNo noise injection or filtering(i) Accuracy(ii) SVM radial basis function (RBF)(ii) Precision(iii) Random forest(iii) Recall(iv) Extreme learning machine (ELM)2[27]IEEE Transactions on Emerging Topics in Computational Intelligence/IEEEA deep learning approach to network intrusion detectionUtilizing a DL approach to optimize the intrusion detectionDL(i) KDD CUP 99No noise injection or filtering(i) Accuracy(ii) NSL-KDD(ii) Precision(iii) Recall(iv) False alarm(v)F-score3[28]IEEE Access/IEEEAn improved intrusion detection algorithm based on GA and SVMUsing a novel intrusion detection algorithm based on GA and SVM to optimize intrusion detection accuracy and detection rate while decreasing the false positive and the training time(i) SVMKDD CUP 99No noise injection or filtering(i) Detection rate (DR)(ii) GA(ii) False-positive rate (FPR)(iii) False-negative rate (FNR)4[29]IEEE Access/IEEEA deep learning approach for intrusion detection using recurrent neural networksUtilizing a DL-based approach for intrusion detection using RNN and compares the results with other ML algorithmsDeep learning (DL) using recurrent neural networks (RNNs)NSL-KDDNo noise injection or filtering(i) Accuracy(ii) True-positive rate (TPR)(iii) False-positive rate (FPR)5[30]Journal of Big Data/SpringerIntrusion detection model using machine learning algorithm on big data environmentThe high dimensionality of the big data complicates the process of conducting accurate classification. The paper introduced an IDS model based on ML for big data. ChiSqSelector is used for feature selection and SVMWithSGD is used to conduct the classification.SVMKDD CUP 99No noise injection or filtering(i) Area under curve (AUROC)(ii) Area under precision-recall curve (AUPR)6[31]Knowledge-Based Systems/Elsevier BVAn effective intrusion detection framework based on SVM with feature augmentationThe empirical results showed that feature augmentation helped to obtain more concise training data, which positively influenced the accuracy of the SVM algorithmSVMNSL-KDDNo noise injection or filtering(i) Accuracy(ii) Detection rate (DR)(iii) False alarm rate (FAR)7[32]Future Generation Computer Systems/Elsevier BVA novel statistical technique for intrusion detection systemsA statistical IDS based on least square SVM (LS-SVM)LS-SVMKDD CUP 99No noise injection or filtering(i) Precision(ii) Recall(iii)F-value8[33]International Journal of Network Management/WileyA deep learning method to detect network intrusion through flow-based featuresAn IDS based on DL designed to classify network traffic into normal and abnormal using a two-dimensional feature vectorDL(i) ISCX 2012No noise was injected during the experimentation(i) Precision(ii) CICIDS 2017(ii) Recall(iii)F1-score(iv) False alarm rate (FAR)(v) Accuracy9[14]IEEE Access/IEEEDeep learning-based intrusion detection with adversariesThe paper used different attack algorithms that were specifically developed to impact the classification accuracy within the image classification domain. The effectiveness of these attack algorithms tends to vary when applied on the intrusion detection dataset.DLNSL-KDDThe noise was injected using certain attacks such as JSMA(i) Accuracy(ii) Precision(iii) Recall(iv) False alarm(v)F-score10[34]Wireless Networks/Springer USA novel support vector machine-based intrusion detection system for mobile ad hoc networksAn IDS based on SVM that can effectively detect DoS attacks in MANETs. This is achieved by detecting malicious nodes, which highly affects the performance of MANETs.SVMNo dataset was used. The proposed solution was tested with three routing protocols: AODV, OLSR, and DSR.No noise injection or filtering(i) Detection rate (DR)(ii) Mean packet delivery ratio (PDR)(iii) Average end-to-end delay (EED)


## 2.1. Intrusion Detection System

IDS helps to detect many forms of attacks and sends alarms to the system or the security administrators. It is critical to develop an IDS that achieves high detection rates with no or minimum false alarms. IDS can be broadly categorized into misuse and anomaly detection.Elsayed et al. [1] gave credit to Anderson for the introduction of the concept of intrusion detection in his 1980 paper. That paper discussed the feasibility of detecting misuse by investigating the audit trails. Elsayed et al. [1] pointed out that the original IDS was based on expert systems.According to Rathore et al. [2], the concept of the IDS was initially introduced in 1986 [3] and 1987 [4] by Denning based on expert systems. The system was referred to as the intrusion detection expert system (IDES). However, Kumar and Venugopalan [5] gave a balanced credit; according to them, Anderson introduced the concept of the IDS while Denning formalized IDS by introducing a rule-based expert system that can detect malicious users’ activities in real time. An overview of the historical IDS milestones can be found in [5].


### 2.1.1. Types of IDSs

The way the collected data are inspected defines how efficiently an IDS can detect different categories of probes and intrusions. Generally, the methods that an IDS analysis engine uses to inspect the collected data can be broadly categorized into either misuse detection or anomaly detection.Misuse detection approaches operate by matching the current behavior with known and previously defined attack patterns, signatures, or rules [6]. Therefore, it is critical to maintain an IDS up to date and inclusive of different known attack patterns, signatures, and rules to ensure the effectiveness of the misuse detection IDS. However, it is not feasible to use the misuse-based methods to detect zero-day attacks because no patterns, signatures, or rules are defined for zero-day attacks.On the other hand, anomaly detection techniques operate based on the ability to detect deviations from normal behavior or pattern [7]. It operates based on the principle that malicious behavior differs from normal behavior, which makes it feasible to detect it [6]. Defining normal behavior requires a period of time; consequently, anomaly-based IDS needs sometime after the installation to become active. Anomaly-based IDSs are more prone to errors producing high rates of false alarms.ML-based IDS can be used to detect both misuse and anomaly [5, 6]. In particular, the supervised ML can be used with misuse detection, whereas unsupervised ML-based techniques can be used to conduct anomaly detection. Table 1 highlights the main differences between the misuse and the anomaly intrusion detection methods [6].Table 1
The main differences between misuse and anomaly intrusion detection methods.
CriteriaMisuse detectionAnomaly detectionBasic principleUsing previously defined patterns/signatures/rules to detect intrusionEstablishes normal behavior profile and detects intrusion based on deviations from that profileDetecting unknown attacksNoYesDetecting known attacksVery goodGoodRates of false positiveVery lowModerate to high (depends on many factors)Constant update of the databaseYesNoSuitable ML approachSupervised MLUnsupervised MLBiggest challengeMaintaining an up-to-date database of all known attack signaturesDifferentiating normal from malicious behavior


### 2.1.2. Components of IDSs

A typical network-based IDS consists of four components, which are a decoder, a preprocessor, a decision engine sensor, and a defense response. The decoder uses data collection tools to gather specific network traffic in raw format and passes these data to the second component. The preprocessor examines the set of protocols that are used in the transmission of the data and extracts certain features. After that, the decision engine sensor utilizes these features to differentiate normal traffic from malicious traffic. If malicious traffic were detected, it sends a signal to the defense response, which, in turn, sends an alert to the security administrators and logs the event in the database [8]. Figure 1 illustrates the typical components of an IDS.Figure 1
The typical components of an IDS.


### 2.1.3. Deployment of IDSs

IDSs can be deployed either in the network or within the host. An IDS that is deployed across the network is typically called network-based IDS (NIDS) and an IDS that runs at a certain host is called host-based IDS (HIDS) [9]. NIDS can be used to monitor the traffic within the organization’s network, typically installed at the network choke points. On the other hand, HIDS can be installed on critical servers to detect potential intrusions or misuses. It can also be installed on the decoy systems (Honey pots) to detect potential intrusions.


## 2.1.1. Types of IDSs

The way the collected data are inspected defines how efficiently an IDS can detect different categories of probes and intrusions. Generally, the methods that an IDS analysis engine uses to inspect the collected data can be broadly categorized into either misuse detection or anomaly detection.Misuse detection approaches operate by matching the current behavior with known and previously defined attack patterns, signatures, or rules [6]. Therefore, it is critical to maintain an IDS up to date and inclusive of different known attack patterns, signatures, and rules to ensure the effectiveness of the misuse detection IDS. However, it is not feasible to use the misuse-based methods to detect zero-day attacks because no patterns, signatures, or rules are defined for zero-day attacks.On the other hand, anomaly detection techniques operate based on the ability to detect deviations from normal behavior or pattern [7]. It operates based on the principle that malicious behavior differs from normal behavior, which makes it feasible to detect it [6]. Defining normal behavior requires a period of time; consequently, anomaly-based IDS needs sometime after the installation to become active. Anomaly-based IDSs are more prone to errors producing high rates of false alarms.ML-based IDS can be used to detect both misuse and anomaly [5, 6]. In particular, the supervised ML can be used with misuse detection, whereas unsupervised ML-based techniques can be used to conduct anomaly detection. Table 1 highlights the main differences between the misuse and the anomaly intrusion detection methods [6].Table 1
The main differences between misuse and anomaly intrusion detection methods.
CriteriaMisuse detectionAnomaly detectionBasic principleUsing previously defined patterns/signatures/rules to detect intrusionEstablishes normal behavior profile and detects intrusion based on deviations from that profileDetecting unknown attacksNoYesDetecting known attacksVery goodGoodRates of false positiveVery lowModerate to high (depends on many factors)Constant update of the databaseYesNoSuitable ML approachSupervised MLUnsupervised MLBiggest challengeMaintaining an up-to-date database of all known attack signaturesDifferentiating normal from malicious behavior


## 2.1.2. Components of IDSs

A typical network-based IDS consists of four components, which are a decoder, a preprocessor, a decision engine sensor, and a defense response. The decoder uses data collection tools to gather specific network traffic in raw format and passes these data to the second component. The preprocessor examines the set of protocols that are used in the transmission of the data and extracts certain features. After that, the decision engine sensor utilizes these features to differentiate normal traffic from malicious traffic. If malicious traffic were detected, it sends a signal to the defense response, which, in turn, sends an alert to the security administrators and logs the event in the database [8]. Figure 1 illustrates the typical components of an IDS.Figure 1
The typical components of an IDS.


## 2.1.3. Deployment of IDSs

IDSs can be deployed either in the network or within the host. An IDS that is deployed across the network is typically called network-based IDS (NIDS) and an IDS that runs at a certain host is called host-based IDS (HIDS) [9]. NIDS can be used to monitor the traffic within the organization’s network, typically installed at the network choke points. On the other hand, HIDS can be installed on critical servers to detect potential intrusions or misuses. It can also be installed on the decoy systems (Honey pots) to detect potential intrusions.


## 2.2. Machine Learning

Machine learning (ML) is a branch of artificial intelligence (AI). The term “machine learning” was coined by Arthur Samuel back in 1959 when he was working at IBM [5]. Samuel defined ML as “the field of study that gives computers the ability to learn without being explicitly programmed” [5]. It is closely related to computational statistics [10]. The first ML algorithms emerged in the 1970s [11]; nowadays, ML is becoming a popular research area [12].ML algorithms can be classified into four distinct categories, supervised learning, semisupervised learning, unsupervised learning, and reinforcement learning [13]. Both supervised and unsupervised learning can be divided further into two different subcategories. The general classification of ML is presented in Figure 2.Figure 2
A general ML classification.


### 2.2.1. Supervised Learning

In supervised learning, an algorithm is presented with a set of data that contains the input data and the corresponding output. The algorithm attempts to discover the underlying relation between the input and the output [11]. In supervised learning, data are labelled. Supervised learning can be typically used in two categories of problems [14]:(i)
Classification problems that aim to predict a discrete number of values(ii)
Regression problems that aim to predict a continuous-valued outputThis paper focuses on supervised learning. More specifically, to study the effect of noise on the classification models, each ML model will be trained on labelled instances of two different IDS datasets (described later). In the first dataset, each instance is labelled as either normal or anomaly. In the second dataset, instances are labelled as either 0 (normal) or 1 (malicious).


### 2.2.2. Semisupervised Learning

Semisupervised learning algorithm is a combination of supervised and unsupervised algorithms that leverages a small percentage of labelled instances to generalize on a large percentage of unlabelled instances. This is very useful in certain cases such as searching for a particular person in an extremely large set of images. For instance, a certain person could be manually labelled in few images and the model will start mining for that person in the remaining large part of the images [13].


### 2.2.3. Unsupervised Learning

Unsupervised learning attempts to deduce the hidden structure of the datasets. Typically, all data in unsupervised learning algorithms are unlabelled. Unsupervised learning problems can be categorized as follows [11]:(i)
Clustering problems that attempt to divide the data into clusters that satisfy certain criteria(ii)
Dimensionality reduction problems that attempt to reduce the dimensionality of the data while maintaining the fundamental aspects of the data, i.e., highest variability


### 2.2.4. Reinforcement Learning

This form of learning is based on trial-and-error approach, in which a learning system gathers certain data and takes an action; if the action yielded a positive result, then a reward will be recorded. If that action resulted in an unwanted result, then the system will learn that this action in that context will not likely work well in future events. This form of learning is suitable for certain fields such as robotics. It can be utilized to learn robotics how to move, carry an object, or avoid physical obstacles [13].


## 2.2.1. Supervised Learning

In supervised learning, an algorithm is presented with a set of data that contains the input data and the corresponding output. The algorithm attempts to discover the underlying relation between the input and the output [11]. In supervised learning, data are labelled. Supervised learning can be typically used in two categories of problems [14]:(i)
Classification problems that aim to predict a discrete number of values(ii)
Regression problems that aim to predict a continuous-valued outputThis paper focuses on supervised learning. More specifically, to study the effect of noise on the classification models, each ML model will be trained on labelled instances of two different IDS datasets (described later). In the first dataset, each instance is labelled as either normal or anomaly. In the second dataset, instances are labelled as either 0 (normal) or 1 (malicious).


## 2.2.2. Semisupervised Learning

Semisupervised learning algorithm is a combination of supervised and unsupervised algorithms that leverages a small percentage of labelled instances to generalize on a large percentage of unlabelled instances. This is very useful in certain cases such as searching for a particular person in an extremely large set of images. For instance, a certain person could be manually labelled in few images and the model will start mining for that person in the remaining large part of the images [13].


## 2.2.3. Unsupervised Learning

Unsupervised learning attempts to deduce the hidden structure of the datasets. Typically, all data in unsupervised learning algorithms are unlabelled. Unsupervised learning problems can be categorized as follows [11]:(i)
Clustering problems that attempt to divide the data into clusters that satisfy certain criteria(ii)
Dimensionality reduction problems that attempt to reduce the dimensionality of the data while maintaining the fundamental aspects of the data, i.e., highest variability


## 2.2.4. Reinforcement Learning

This form of learning is based on trial-and-error approach, in which a learning system gathers certain data and takes an action; if the action yielded a positive result, then a reward will be recorded. If that action resulted in an unwanted result, then the system will learn that this action in that context will not likely work well in future events. This form of learning is suitable for certain fields such as robotics. It can be utilized to learn robotics how to move, carry an object, or avoid physical obstacles [13].


## 2.3. ML Algorithms Used in This Paper

There are a large number of ML algorithms. The ML algorithms that are used in this paper are as follows.


### 2.3.1. Decision Trees (DTs)

DT uses a set of rules to classify data based on the attributes’ values [10]. Classification is represented in a tree-structure format where branches represent the selection of the value of input features that lead to those classifications and leaves represent class labels. DTs are characterized by the high accuracy of the classification and the simplicity of implementation. However, decision trees are biased with multilevel features [15].In this paper, J48 flavor of decision trees is used. During the tree construction, the training dataset is recursively divided into several subsets. The best split is often based on children impurity such as the entropy which is defined as follows [16, 17]:(1)entropy=−∑0c−1pi|tlog2pi|t,where c is the number of classes and 0log20=0 in entropy calculations.


### 2.3.2. Random Forest (RF)

RF combines multiple DTs where each DT is constructed based on the values of independent random vectors. The results of the RF can be controlled by the majority or weighted voting [15]. RF can be considered as one of the ensemble learning methods [2] because RF tends to combine the outcomes of several DTs [6]. When the number of trees is sufficiently large, the upper bound of the generalization error converges according to the following formula [16]:(2)generalization error≤ρ¯1−s2s2,where ρ¯ is the average correlation among the trees and s is a measure of strength of the tree classifiers. The strength refers to the average performance of the classifiers measured probabilistically as(3)margin,MX,Y=PY^θ=Y−maxZ≠YPY^θ=Z,where Y^θ is the predicted class of X according to a classifier built from some random vector θ. The higher the margin, the more likely the classifier correctly predicts an example X.


### 2.3.3. Support Vector Machine (SVM)

SVM is a supervised learning algorithm that uses a hyperplane to classify the data. The hyperplane is used to separate the data into different classes based on the features’ space. SVM algorithm is among the most robust and accurate ML algorithms [10]. A linear SVM classifier differentiates between instances from two classes according to the following equation [13]:(4)y^=0,ifwTx+b<0,1,ifwTx+b≥0,where x represents an instance to be classified, w represents the weight vector, and b is the bias value.


### 2.3.4. Artificial Neural Networks (ANNs)

ANN was inspired by the human brain. The implementation of the ANN in the computer realm consists of a number of artificial neurons that are distributed across different layers. An ANN typically consists of three layers [6, 18, 19], which are the input layer, the hidden layer, and the output layer. The dataset is passed to the input nodes and the output nodes are used to present the classification results. This paper uses multilayer perceptron (MLP) to implement ANN within the experiments. MLP is an ANN, usually trained using backpropagation algorithm [17, 20].The output of the hidden neuroni can be calculated as follows:(5)hi=f1bi+∑j=1nWijXi,where xi is the input data, xi, i = 1, …, n; Wij denotes the weight connecting input neuron j to hidden neuron i, bi is the bias for neuron i, and f1 is the used transfer function.The output of the output neuroni can be calculated as follows [17]:(6)Oi=f2bi+∑j=1nkVijhi,where nk is the number of hidden neurons and Vij denotes the weight connecting hidden neuron i to the output neuron j.The goal of ANN is to minimize the total sum of squared error between the predicted output and the true output (ground truth) [16]:(7)Ew=12∑i=1Nyi−y^i2.The weights of the network can be updated according to the gradient descent method as follows [16]:(8)wj←wj−λ∂Ew∂wj.


### 2.3.5. Naïve Bayes (NB)

NB is called naïve because it relies on a simplifying assumption, which assumes that the attribute values are conditionally independent of each other. One of the main advantages of Naïve Bayes is the speed of training and testing. However, the attribute values of some intrusion detection datasets such as the KDD CUP 99 and the NSL-KDD are highly dependent on each other [7]. This means that the accuracy of NB is highly influenced by the degree of dependencies between the attribute values of the datasets [15]. When building an IDS classifier based on the NB algorithm, the classification is performed according to the following equation:(9)yf1,f2,…,fm=argmaxk∈1,…,KpCk∏i=1mpfi|Ck,where m represents the number of features, k represents the number of classes, fi stands for the i-th feature, Ck stands for the k-th class, p(Ck) is the prior probability of Ck, and pfi|Ck represents the conditional probability.


### 2.3.6. Comparison of the ML Algorithms

A comparison between the above ML algorithms is illustrated in Table2 [15, 21]. More details about the differences between common ML algorithms can be found in [21].Table 2
A comprehensive comparison between different ML classification algorithms [15, 21].
ML algorithmAdvantagesDisadvantagesDT(i) Very simple and fast(i) Requires long time to train the model(ii) Not affected by the increase of the dimensionality of the data(ii) Requires larger amount of memory for analyzing large databases(iii) The model is easily understood (plausible)(iii) Not suitable for problems that require diagonal partitioning(iv) Generates good accuracy based on the quality of the data(iv) Can generate a complex representation for some concepts due to the replication(v) Support incremental learning(v) The order of the attributes affects the performanceRF(i) Can resist overfitting(i) Difficult to interpret the model(ii) Does not require attributes selection(ii) Correlated variables cause performance degradation(iii) Model variances decrease with the increase in the number of trees(iii) Reliance on the random generator of the implementation(iv) Increasing the number of trees does not affect the bias of the modelSVM(i) One of the most robust and accurate algorithms(i) Requires intensive computations to build the model(ii) Requires few data for training and is not affected by the dimensionality of the data(ii) Very slow in the learning phase(iii) Generate the best function to conduct binary classification(iii) Memory required doubles as the number of training instances increases(iv) Less prone to overfitting compared to other algorithms(iv) It is difficult to interpret the results of the modelANN(i) Tolerable to noise and able to predict new classes(i) Requires a long time to train a model(ii) Applicable even if the relation between attributes and classes is not well defined(ii) Very difficult to interpret how the model works(iii) Suitable for continuous values(iii) Requires empirical adjustment of different parameters such as the number of hidden layers and the number of nodes in each layer(iv) Computations can be accelerated due to ANN parallel nature(v) Applied successfully to different real-world issues such as handwritten character recognition and laboratory medicineNB(i) Requires short time for training and it is easy to construct the model(i) Theoretically, classifiers based on NB algorithms have a low error rate. However, in practice, this is not entirely true due to the assumption that different attributes are independent of each other(ii) Can be computationally optimized(ii) Yields low accuracy results compared to other ML algorithms(iii) Can be used with large datasets(iv) Outcomes are easily interpreted(v) It operates in a well and robust manner even though it might not be the best algorithm for a certain application


## 2.3.1. Decision Trees (DTs)

DT uses a set of rules to classify data based on the attributes’ values [10]. Classification is represented in a tree-structure format where branches represent the selection of the value of input features that lead to those classifications and leaves represent class labels. DTs are characterized by the high accuracy of the classification and the simplicity of implementation. However, decision trees are biased with multilevel features [15].In this paper, J48 flavor of decision trees is used. During the tree construction, the training dataset is recursively divided into several subsets. The best split is often based on children impurity such as the entropy which is defined as follows [16, 17]:(1)entropy=−∑0c−1pi|tlog2pi|t,where c is the number of classes and 0log20=0 in entropy calculations.


## 2.3.2. Random Forest (RF)

RF combines multiple DTs where each DT is constructed based on the values of independent random vectors. The results of the RF can be controlled by the majority or weighted voting [15]. RF can be considered as one of the ensemble learning methods [2] because RF tends to combine the outcomes of several DTs [6]. When the number of trees is sufficiently large, the upper bound of the generalization error converges according to the following formula [16]:(2)generalization error≤ρ¯1−s2s2,where ρ¯ is the average correlation among the trees and s is a measure of strength of the tree classifiers. The strength refers to the average performance of the classifiers measured probabilistically as(3)margin,MX,Y=PY^θ=Y−maxZ≠YPY^θ=Z,where Y^θ is the predicted class of X according to a classifier built from some random vector θ. The higher the margin, the more likely the classifier correctly predicts an example X.


## 2.3.3. Support Vector Machine (SVM)

SVM is a supervised learning algorithm that uses a hyperplane to classify the data. The hyperplane is used to separate the data into different classes based on the features’ space. SVM algorithm is among the most robust and accurate ML algorithms [10]. A linear SVM classifier differentiates between instances from two classes according to the following equation [13]:(4)y^=0,ifwTx+b<0,1,ifwTx+b≥0,where x represents an instance to be classified, w represents the weight vector, and b is the bias value.


## 2.3.4. Artificial Neural Networks (ANNs)

ANN was inspired by the human brain. The implementation of the ANN in the computer realm consists of a number of artificial neurons that are distributed across different layers. An ANN typically consists of three layers [6, 18, 19], which are the input layer, the hidden layer, and the output layer. The dataset is passed to the input nodes and the output nodes are used to present the classification results. This paper uses multilayer perceptron (MLP) to implement ANN within the experiments. MLP is an ANN, usually trained using backpropagation algorithm [17, 20].The output of the hidden neuroni can be calculated as follows:(5)hi=f1bi+∑j=1nWijXi,where xi is the input data, xi, i = 1, …, n; Wij denotes the weight connecting input neuron j to hidden neuron i, bi is the bias for neuron i, and f1 is the used transfer function.The output of the output neuroni can be calculated as follows [17]:(6)Oi=f2bi+∑j=1nkVijhi,where nk is the number of hidden neurons and Vij denotes the weight connecting hidden neuron i to the output neuron j.The goal of ANN is to minimize the total sum of squared error between the predicted output and the true output (ground truth) [16]:(7)Ew=12∑i=1Nyi−y^i2.The weights of the network can be updated according to the gradient descent method as follows [16]:(8)wj←wj−λ∂Ew∂wj.


## 2.3.5. Naïve Bayes (NB)

NB is called naïve because it relies on a simplifying assumption, which assumes that the attribute values are conditionally independent of each other. One of the main advantages of Naïve Bayes is the speed of training and testing. However, the attribute values of some intrusion detection datasets such as the KDD CUP 99 and the NSL-KDD are highly dependent on each other [7]. This means that the accuracy of NB is highly influenced by the degree of dependencies between the attribute values of the datasets [15]. When building an IDS classifier based on the NB algorithm, the classification is performed according to the following equation:(9)yf1,f2,…,fm=argmaxk∈1,…,KpCk∏i=1mpfi|Ck,where m represents the number of features, k represents the number of classes, fi stands for the i-th feature, Ck stands for the k-th class, p(Ck) is the prior probability of Ck, and pfi|Ck represents the conditional probability.


## 2.3.6. Comparison of the ML Algorithms

A comparison between the above ML algorithms is illustrated in Table2 [15, 21]. More details about the differences between common ML algorithms can be found in [21].Table 2
A comprehensive comparison between different ML classification algorithms [15, 21].
ML algorithmAdvantagesDisadvantagesDT(i) Very simple and fast(i) Requires long time to train the model(ii) Not affected by the increase of the dimensionality of the data(ii) Requires larger amount of memory for analyzing large databases(iii) The model is easily understood (plausible)(iii) Not suitable for problems that require diagonal partitioning(iv) Generates good accuracy based on the quality of the data(iv) Can generate a complex representation for some concepts due to the replication(v) Support incremental learning(v) The order of the attributes affects the performanceRF(i) Can resist overfitting(i) Difficult to interpret the model(ii) Does not require attributes selection(ii) Correlated variables cause performance degradation(iii) Model variances decrease with the increase in the number of trees(iii) Reliance on the random generator of the implementation(iv) Increasing the number of trees does not affect the bias of the modelSVM(i) One of the most robust and accurate algorithms(i) Requires intensive computations to build the model(ii) Requires few data for training and is not affected by the dimensionality of the data(ii) Very slow in the learning phase(iii) Generate the best function to conduct binary classification(iii) Memory required doubles as the number of training instances increases(iv) Less prone to overfitting compared to other algorithms(iv) It is difficult to interpret the results of the modelANN(i) Tolerable to noise and able to predict new classes(i) Requires a long time to train a model(ii) Applicable even if the relation between attributes and classes is not well defined(ii) Very difficult to interpret how the model works(iii) Suitable for continuous values(iii) Requires empirical adjustment of different parameters such as the number of hidden layers and the number of nodes in each layer(iv) Computations can be accelerated due to ANN parallel nature(v) Applied successfully to different real-world issues such as handwritten character recognition and laboratory medicineNB(i) Requires short time for training and it is easy to construct the model(i) Theoretically, classifiers based on NB algorithms have a low error rate. However, in practice, this is not entirely true due to the assumption that different attributes are independent of each other(ii) Can be computationally optimized(ii) Yields low accuracy results compared to other ML algorithms(iii) Can be used with large datasets(iv) Outcomes are easily interpreted(v) It operates in a well and robust manner even though it might not be the best algorithm for a certain application


## 2.4. Ensemble of Classifiers

Ensemble learning consolidates several techniques to obtain better overall accuracy, which outperforms the accuracy of each single technique [8]. One of the main advantages of using ensemble learning is that it might solve the overfitting issues and improves the classification accuracy. On the other hand, the disadvantage of ensemble learning includes the increase in the required time and memory to build the model when compared to individual classifiers.Additionally, learning concepts might become more difficult to understand, i.e., less plausible. Popular methods for conducting ensemble learning are bagging, boosting, voting, and stacking [6]. This paper will utilize both bagging and boosting.Bagging, also called bootstrap aggregation, is an ensemble method that is used to improve accuracy and reduce overfitting. This is achieved by deploying a model-averaging technique. On the other hand, boosting operates by training multiple weak learners and aggregating the weighted results [15]. In this paper, we have used the AdaBoost method to implement boosting on the intrusion datasets.


## 2.5. Noise Filtering

Noisy data may affect the accuracy of different ML algorithms. This paper adopts an empirical approach to study the potential effect of noise. It discusses the removal of outliers and extreme values to filter noisy data. There is a wide set of different algorithms that can be used to conduct noise filtering. This paper uses interquartile range (IQR) filter for noise filtering. This filter detects outliers and extreme values from a given dataset. According to this filter, the outliers are defined according to the following equations [22]:(10)Q3+OF∗IQR<x≤Q3+EVF∗IQR,(11)Q1−EVF∗IQR≤x<Q1−OF∗IQR.On the other hand, the extreme values are located according to the following equations:(12)x>Q3+EVF∗IQR,(13)x<Q1−EVF∗IQR,where Q1 = 25% quartile, Q3 = 75% quartile, IQR is the interquartile range, which represents the difference between Q1 and Q3, OF is the outlier factor, and EVF is the extreme value factor.After applying this filter, outliers and extreme values will be labelled into two additional attributes. After that, all instances within these two attributes can be removed from the dataset. This means that outlier and extreme values will be excluded from the dataset, resulting in an instant reduction. Table3 illustrates the original number of instances and the new number of instances in the used datasets before and after applying noise filtering for both datasets.Table 3
The total number of instances before and after excluding the outliers and the extreme values.
DatasetData fileBefore filteringAfter filteringTotal no. of instancesNo. of benign instancesNo. of attack instancesTotal no. of instancesNo. of benign instancesNo. of attack instancesNSL-KDDKDDTrain+125,97367,34358,63045,33112,36032,971KDDTest+22,5449,71112,8332,6702,149521UNSW-NB15UNSW-NB15 training175,34156,000119,34154,7297,50347,226UNSW-NB15 testing82,33237,00045,33231,46810,04521,423After verifying that the removal of the noisy instances did not eliminate all the attack instances, it is also critical to ensure that benign and malicious traffic were not entirely eliminated. To accomplish that, the distribution of the different classes of network traffic before and after noise filtering for both the training and the testing portions of the UNSW-NB15 dataset was calculated and the results are illustrated in Table4, which illustrate that none of the network traffic classes were entirely eliminated after the noise filtering process. This was feasible to calculate because one of the UNSW-NB15 attributes, called the attack_cat attribute, was originally dedicated to illustrate the number of instances within each category. Unfortunately, it was unfeasible to calculate the distribution of the different categories of the network traffic for the NSL-KDD dataset because there was no attribute that distinguishes these categories from each other.Table 4
The distribution of the network traffic between different categories before and after noise filtering in both the training and the testing portion of the UNSW-NB15.
Traffic categoriesThe training portionThe testing portionBefore noise filteringAfter noise filteringBefore noise filteringAfter noise filteringNo. of instancesDistribution (%)No. of instancesDistribution (%)No. of instancesDistribution (%)No. of instancesDistribution (%)Normal56,00031.93777,50313.709337,00044.939910,04531.9213Analysis20001.14061,2752.32966770.82225341.6969Reconnaissance104915.98317,31313.36223,4964.24622,8018.9011Shellcode11330.64618011.46353780.45912920.9279Fuzzers1818410.37068,25315.07976,0627.36283,85112.2378Worm1300.0741100.0182440.0534110.0349Generic4000022.81265,65010.323518,87122.92067,05222.4100DoS122646.99438,86816.20344,0894.96642,4427.7602Exploits3339319.044613,67224.899011,13213.52083,98112.6509Backdoors17460.99571,3842.52885830.70814591.4586


## 2.6. Relevant Literature

Based on the authors’ research in the literature, there is a great lack of papers that empirically discuss the subject of using ML techniques on IDS-related datasets in the presence of noise.An empirical study between several classification algorithms on two intrusion-related datasets, namely, KDD CUP 99 and NSL-KDD, was conducted by Hussain and Lalmuanawma [23]. The noise was injected to a specific set of attributes by 10% and 20%. However, NSL-KDD is basically an enhanced version of the KDD CUP 99. The redundant instances that existed in the KDD CUP 99 dataset were removed in the NSL-KDD dataset. The ML algorithms, in this paper, achieved more realistic results with the NSL-KDD dataset in comparison with the KDD CUP 99. This was an expected outcome due to the absence of redundant records in the NSL-KDD dataset. However, in the current manuscript, we will investigate a different form of noise that could take place due to mislabelled instances, which is, in turn, injected only to a single attribute. Furthermore, in this paper, we will use two independent intrusion datasets.Other efforts such as [24, 25] investigated the effect of noise with regression tasks, which entails the attempts to predict a numerical value. However, in this paper, we are focusing on classification, which entails classifying different instances to one of two or more predefined categories.Wang [14] used deep learning (DL) IDS with adversaries. Different attack algorithms taken from the image processing field are used in the intrusion detection field mainly with the NSL-KDD dataset. DL techniques are vulnerable to adversarial imperceptible malicious examples in the image classification domain. Adversarial examples are noisy data specially crafted to attack the DL model. The Jacobian-based saliency map attack (JSMA) and fast-gradient sign method (FGSM) were used to inject noisy data. Furthermore, the paper injected noisy data in the most salient features, which are the features that have the most influence on the results.Table5 summarizes several recent journal articles from different publishers that discuss the subject of using ML methods in intrusion detection.Table 5
Summary of papers that discusses the use of ML with intrusion detection.
#ReferenceJournal/publisherTitleDescriptionML algorithmsDatasetsNoiseEvaluation metrics1[26]IEEE Access/IEEEPerformance comparison of support vector machine, random forest, and extreme learning machine for intrusion detectionA performance comparison between different ML algorithms(i) SVM (linear)NSL-KDDNo noise injection or filtering(i) Accuracy(ii) SVM radial basis function (RBF)(ii) Precision(iii) Random forest(iii) Recall(iv) Extreme learning machine (ELM)2[27]IEEE Transactions on Emerging Topics in Computational Intelligence/IEEEA deep learning approach to network intrusion detectionUtilizing a DL approach to optimize the intrusion detectionDL(i) KDD CUP 99No noise injection or filtering(i) Accuracy(ii) NSL-KDD(ii) Precision(iii) Recall(iv) False alarm(v)F-score3[28]IEEE Access/IEEEAn improved intrusion detection algorithm based on GA and SVMUsing a novel intrusion detection algorithm based on GA and SVM to optimize intrusion detection accuracy and detection rate while decreasing the false positive and the training time(i) SVMKDD CUP 99No noise injection or filtering(i) Detection rate (DR)(ii) GA(ii) False-positive rate (FPR)(iii) False-negative rate (FNR)4[29]IEEE Access/IEEEA deep learning approach for intrusion detection using recurrent neural networksUtilizing a DL-based approach for intrusion detection using RNN and compares the results with other ML algorithmsDeep learning (DL) using recurrent neural networks (RNNs)NSL-KDDNo noise injection or filtering(i) Accuracy(ii) True-positive rate (TPR)(iii) False-positive rate (FPR)5[30]Journal of Big Data/SpringerIntrusion detection model using machine learning algorithm on big data environmentThe high dimensionality of the big data complicates the process of conducting accurate classification. The paper introduced an IDS model based on ML for big data. ChiSqSelector is used for feature selection and SVMWithSGD is used to conduct the classification.SVMKDD CUP 99No noise injection or filtering(i) Area under curve (AUROC)(ii) Area under precision-recall curve (AUPR)6[31]Knowledge-Based Systems/Elsevier BVAn effective intrusion detection framework based on SVM with feature augmentationThe empirical results showed that feature augmentation helped to obtain more concise training data, which positively influenced the accuracy of the SVM algorithmSVMNSL-KDDNo noise injection or filtering(i) Accuracy(ii) Detection rate (DR)(iii) False alarm rate (FAR)7[32]Future Generation Computer Systems/Elsevier BVA novel statistical technique for intrusion detection systemsA statistical IDS based on least square SVM (LS-SVM)LS-SVMKDD CUP 99No noise injection or filtering(i) Precision(ii) Recall(iii)F-value8[33]International Journal of Network Management/WileyA deep learning method to detect network intrusion through flow-based featuresAn IDS based on DL designed to classify network traffic into normal and abnormal using a two-dimensional feature vectorDL(i) ISCX 2012No noise was injected during the experimentation(i) Precision(ii) CICIDS 2017(ii) Recall(iii)F1-score(iv) False alarm rate (FAR)(v) Accuracy9[14]IEEE Access/IEEEDeep learning-based intrusion detection with adversariesThe paper used different attack algorithms that were specifically developed to impact the classification accuracy within the image classification domain. The effectiveness of these attack algorithms tends to vary when applied on the intrusion detection dataset.DLNSL-KDDThe noise was injected using certain attacks such as JSMA(i) Accuracy(ii) Precision(iii) Recall(iv) False alarm(v)F-score10[34]Wireless Networks/Springer USA novel support vector machine-based intrusion detection system for mobile ad hoc networksAn IDS based on SVM that can effectively detect DoS attacks in MANETs. This is achieved by detecting malicious nodes, which highly affects the performance of MANETs.SVMNo dataset was used. The proposed solution was tested with three routing protocols: AODV, OLSR, and DSR.No noise injection or filtering(i) Detection rate (DR)(ii) Mean packet delivery ratio (PDR)(iii) Average end-to-end delay (EED)


## 3. Proposed Methodology

This paper empirically investigates the robustness of ML algorithms on intrusion-related datasets with and without the presence of noise. The paper also examines the effectiveness of noise filtering algorithms with different ML algorithms. This section discusses several intrusion-related datasets with more focus on the datasets that are used in this paper, an explanation of the proposed set of experiments, noise injection, noise filtering, evaluation metrics, and the tool that is used to conduct the experiments.


### 3.1. Datasets

Intrusion-related datasets are used to train and test the proposed IDS models. KDD CUP 99 and NSL-KDD have been extensively used in intrusion detection-related research studies [27]. Table 6 compares the major datasets related to intrusion detection [6, 10, 27, 29, 35, 36].Table 6
Comparison between different datasets related to intrusion detection.
No.DatasetCreation dateBased onDeploymentAttack categoriesNo. of attributesNo. of records1DARPA 19981998—NIDSDoS41Not mentionedProbeR2LU2R2KDD CUP 991999DARPA 1998NIDSDoS414,898,431ProbeR2LU2R3NSL-KDD2009KDD CUP 99NIDSDoS41148,517ProbeR2LU2R4UNSW-NB152015—NIDSAnalysis Reconnaissance452,540,044ShellcodeFuzzersWormGenericDoSExploitsBackdoors5ADFA2013—HIDSHydra-FTPNot mentioned5,773 (Windows)Hydra-SSH5,800 (Linux)Add-userJava-MeterpreterWeb-shell


#### 3.1.1. DARPA 1998

The DARPA 1998 dataset was created within the Intrusion Detection Evaluation Project. It consists of two sets of data, one for training and the other for testing. The DARPA 1998 dataset is one of the early datasets that were publicly available [37].


#### 3.1.2. KDD CUP 99

Knowledge Discovery in Databases (KDD) CUP 99 was derived from the DARPA 1998 dataset. It was explicitly generated to develop ML, classification, and clustering algorithms with more focus on security issues [37]. KDD CUP 99 was described as a “de facto benchmark for evaluating the performance of intrusions detection algorithm” [32]. There is an issue associated with KDD CUP 99 dataset, which is redundancy.There are 78% redundant records in the training dataset and 75% redundant records in the testing dataset [38]. Redundant records in the KDD CUP 99 dataset negatively affect the performance of the classifiers, making it biased to the more frequently repeated records.


#### 3.1.3. NSL-KDD

The NSL-KDD was initially generated to overcome the drawbacks of the KDD CUP 99 dataset [27]. NSL-KDD was generated based on the KDD CUP 99, but NSL-KDD does not have redundant records [31]. This makes NSL-KDD more suitable to evaluate ML classifiers. NSL-KDD has the same 41 attributes from the KDD CUP 99 dataset. Table 7 lists the different data files of the NSL-KDD dataset.Table 7
The data files included in the NSL-KDD dataset.
No.NSL-KDD data filesDescriptionNo. of attributesNo. of instancesNo. of normal instancesNo. of anomaly instances1KDDTest+Contains the full testing set4222,5449,71112,8332KDDTest-21A subset of the KDDTest+, without records of difficulty level 21 out of 214211,8502,1529,6983KDDTrain+Contains the full training set42125,97367,34358,6304KDDTrain+_20PercentRepresents a 20% subset of the KDDTrain+4225,19213,44911,743It can be noticed from Table7 that the number of attributes for both KDD and NSL-KDD is 42. In Table 6, the number of attributes is 41 and this additional attribute is the class, also called the label attribute. Details about the NSL-KDD’s attributes such as the type and the description are illustrated in Table 8.Table 8
A list of the NSL-KDD attributes.
No.AttributeType1DurationNumeric2Protocol_typeNominal3ServiceNominal4FlagNominal5Src_bytesNumeric6Dst_bytesNumeric7LandNominal8Wrong_fragmentNumeric9UrgentNumeric10HotNumeric11Num_failed_loginsNumeric12Logged_inNominal13Num_compromisedNumeric14Root_shellNumeric15Su_attemptedNumeric16Num_rootNumeric17Num_file_creationsNumeric18Num_shellsNumeric19Num_access_filesNumeric20Num_outbound_cmdsNumeric21Is_host_loginNominal22Is_guest_loginNominal23CountNumeric24Srv_count_Numeric25Serror_rateNumeric26Srv_serror_rateNumeric27Rerror_rateNumeric28Srv_rerror_rateNumeric29Same_srv_rateNumeric30Diff_srv_rateNumeric31Srv_diff_host_rateNumeric32Dst_host_countNumeric33Dst_host_srv_countNumeric34Dst_host_same_srv_rateNumeric35Dst_host_diff_srv_rateNumeric36Dst_host_same_src_port_rateNumeric37Dst_host_srv_diff_host_rateNumeric38Dst_host_serror_rateNumeric39Dst_host_srv_serror_rateNumeric40Dst_host_rerror_rateNumeric41Dst_host_srv_rerror_rateNumeric42ClassNominal


#### 3.1.4. UNSW-NB15

The University of New South Wales created the UNSW-NB15 dataset for evaluating new NIDSs. 100 GB of raw network traffic was collected to build the UNSW-NB15 dataset. The UNSW-NB15 dataset consists of ten categories of traffic; one normal and nine categories represent different forms of attacks [8]. However, ML-based techniques perform better with both KDD CUP 99 and NSL-KDD. This is due to two reasons. Firstly, many values of normal and malicious instances are almost the same in the UNSW-NB15 dataset, whereas there is a relatively reasonable difference between the normal and the malicious values in both KDD CUP 99 and NSL-KDD. Secondly, the data distribution of the UNSW-NB15 dataset is nearly the same, while it is different in the KDD CUP 99 and NSL-KDD due to the existence of new attacks in the testing set, which helps to differentiate between normal and abnormal instances when running ML algorithms [8]. Tables 9 and 10 illustrate the number of attributes, the total number of instances, the number of normal instances, and the number of malicious instances. In addition, the attributes’ names and types are also illustrated.Table 9
The training and the testing datasets of the UNSW-NB15.
No.UNSW-NB15 data filesNo. of attributesNo. of instancesNo. of normal instancesNo. of attack instances1UNSW_NB15_training-set4582,33237,00045,3322UNSW_NB15_testing-set45175,34156,000119,341Table 10
List of UNSW-NB15 attributes.
No.AttributeType1IdNumeric2DurNumeric3ProtoNominal4ServiceNominal5StateNominal6SpktsNumeric7DpktsNumeric8SbytesNumeric9DbytesNumeric10RateNumeric11SttlNumeric12DttlNumeric13SloadNumeric14DloadNumeric15SlossNumeric16DlossNumeric17SinpktNumeric18DinpktNumeric19SjitNumeric20DjitNumeric21SwinNumeric22StcpbNumeric23DtcpbNumeric24DwinNumeric25TcprttNumeric26SynackNumeric27AckdatNumeric28SmeanNumeric29DmeanNumeric30Trans_depthNumeric31Response_body_lenNumeric32Ct_srv_srcNumeric33Ct_state_ttlNumeric34Ct_dst_Numeric35Ct_src_dport_ltmNumeric36Ct_dst_sport_ltmNumeric37Ct_dst_src_ltmNumeric38Is_ftp_loginNumeric39Ct_ftp_cmdNumeric40Ct_flw_http_mthdNumeric41Ct_src_ltmNumeric42Ct_srv_dstNumeric43Is_sm_ips_portsNumeric44Attack_catNominal45LabelNumeric


#### 3.1.5. ADFA

The ADFA dataset was generated to be tested for host-level intrusion detection. It was generated by the Australian Defense Academy (ADFA). The ADFA dataset encompasses two different platforms, Windows (ADFA-WD) and Linux (ADFA-LD) [10]. There are five categories of attacks within this dataset, which can be found in Table 6.


### 3.2. Dataset Preprocessing

This paper utilizes two intrusion detection datasets, which are the NSL-KDD dataset and the UNSW-NB15 dataset. The NSL-KDD dataset can be used directly in the experiments as the class value of the NSL-KDD is nominal, whereas the class value of the UNSW-NB15 dataset is numeric. Therefore, the class values of the UNSW-B15 dataset must be converted from numeric to nominal.WEKA data mining tool provides a numeric to nominal filter that can be used to convert numeric values to nominal values. Typically, the class is located as the last attribute in the dataset [20]. In the NSL-KDD dataset, the last attribute, which is attribute number 42, contains two distinct nominal values, called normal and anomaly. On the other hand, the class value of the UNSW-NB15 dataset, which is attribute number 45, consists of numeric values.


### 3.3. Proposed Experiments

Generally, the proposed methodology consists of six distinct sets of experiments illustrated in Figure3. Each set of experiments aims to empirically test a certain aspect of ML-based IDS performance in response to the noise.Figure 3
The overall methodology used in this paper.The first set of experiments involves generating the baseline, which will be needed to investigate the potential impact of noise and the effectiveness of noise filtering techniques on ML-based IDSs. Furthermore, it will be used to measure the influence of employing ensemble learning algorithms. The results of the subsequent stages will be compared with the results of this stage.In the second set of experiments, interquartile noise filtering algorithm will be applied to the datasets. This filter will help to identify outliers and extreme values from the datasets. The results of this phase will be compared with the baseline.In the third set of experiments, noise is injected into the intrusion datasets with the following percentages: 5%, 10%, 20%, and 30%. Then noisy data will be inserted into the ML models. The results will be compared with the baseline obtained from the first stage. This is useful to test the robustness of ML algorithms against noise.The fourth set of experiments entails conducting noise filtering by excluding noisy instances and then injecting different levels of noise, which are 5%, 10%, 20%, and 30%. This will help to study the influence of noise on the ML algorithms that run on intrusion datasets with the absence of outlier and extreme value instances.In the fifth set of experiments, noise injection is applied before noise filtering. In this experiment, noise is injected in the form of manipulating the labels of a given percentage of the training set. Noise filtering is conducted by removing outliers and extreme values.The sixth set of experiments studies the influence of using ensemble learning techniques on the accuracy of the ML algorithms when applying it to the intrusion datasets.A generic description of the conducted experiments is presented in the form of pseudocodes.Pseudocode 1:The first set of experiments (baseline experiment).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Train the ML algorithm on the training dataset(4)
Run the ML algorithm on the testing dataset(5)
Document the results(6)
Revert to step 3 using the other ML algorithmsPseudocode 2:The second set of experiments (noise filtering).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Conduct noise filtering by removing the outliers and the extreme values(4)
Train the ML algorithm on the training dataset(5)
Run the ML algorithm on the testing dataset(6)
Document the results(7)
Revert to step 4 using the other ML algorithmsPseudocode 3:The third set of experiments (noise injection).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(4)
Train the ML algorithm on the noisy training dataset(5)
Run the ML algorithm on the testing dataset(6)
Document the results(7)
Revert to step 3 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 4:The fourth set of experiments (noise filtering then injection).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise filtering by removing the outliers and the extreme values(4)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(5)
Train the ML algorithm on the noisy training dataset(6)
Run the ML algorithm on the testing dataset(7)
Document the results(8)
Revert to step 4 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 5:The fifth set of experiments (noise injection then filtering).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(4)
Conduct noise filtering by removing the outliers and the extreme values(5)
Train the ML algorithm on the noisy training dataset(6)
Run the ML algorithm on the testing dataset(7)
Document the results(8)
Revert to step 4 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 6:The sixth set of experiments (ensemble of classifiers).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Initialize the ensemble learning method (bagging-boosting)(4)
Use an ML algorithm as a base classifier(5)
Train the ensemble of classifiers on the dataset(6)
Test the ensemble of classifiers on the test dataset(7)
Document the results(8)
Revert to step 3 until each ML algorithms is used with both ensemble learning methods


### 3.4. Noise Injection

The presence of noise might negatively affect the accuracy of ML algorithms. Noise can take different forms such as mislabelled data or incorrectly classified instances.To obtain more accurate outcome, noisy data must be filtered first as working with noise-free data helps to avoid potential issues such as overfitting [36].Some experiments in this paper require injecting different levels of noise into the datasets. In WEKA, noise can be injected into the datasets via the AddNoise filter. AddNoise filter “changes a percentage of a given nominal attribute’s values” [20]. The default value of noise injection in the AddNoise filter is 10%. However, it can be adjusted to any other percentage.


### 3.5. Evaluation Metrics

It is critical to specify the adequate metrics that will be used to evaluate the ML algorithms with the intrusion detection datasets. However, the evaluation metrics should be relevant to the subject under examination. Ahmad et al. [26] used three evaluation metrics to compare the performance of SVM, RF, and EL for the IDSs. These evaluation metrics are accuracy, precision, and recall.In this paper, the authors will use the same evaluation metrics. The classification of each testing instance falls within four cases (usually referred collectively as the confusion matrix). The four cases are as follows:(i)
True positive (TP): malicious instances that were correctly classified as malicious by the IDS(ii)
True negative (TN): normal instances that were correctly classified as normal by the IDS(iii)
False positive (FP): normal instances that were incorrectly classified by the IDS as malicious(iv)
False negative (FN): malicious instances that were incorrectly classified by the IDS as normalThe above four values are used to calculate the evaluation metrics [37]. Accuracy represents the ratio of correctly classified instances to the total number of instances in the test dataset:(14)accuracy=TP+TNTP+TN+FP+FN.Precision represents the accuracy of the positive predictions:(15)precision=TPTP+FP.Recall is the ratio of positive instances that the classifier manages to classify correctly:(16)recall=TPTP+FN.Accuracy is the most relevant metric to the objective of this paper as it indicates the success percentage of the ML algorithm in classifying the testing instances. Classifying the testing instances involves determining whether it represents an intrusion or not. This will help to define the factors that can influence, either positively or negatively, the accuracy of the ML algorithms. Therefore, only the accuracy metric will be used to assess and compare the different ML algorithms from different experiments with the baseline, and the other metrics will be presented to provide a more holistic perspective on the effectiveness of the ML algorithm.


### 3.6. Tool Used in This Research (WEKA)

This paper utilizes Waikato Environment for Knowledge Analysis (WEKA) version 3.8.3 as the main tool to conduct empirical experiments. WEKA is an open-source tool written in Java and designed to run ML algorithms. It was developed by the University of Waikato, New Zealand [39]. WEKA provides the ability to run many ML algorithms such as J48 (a DT flavor), RF, and SVM on any dataset.


### 3.7. The ML Algorithms’ Parameters

Each ML algorithm has its own set of parameters that determines exactly how it operates. These parameters can be fine-tuned to enhance the performance of the ML-based classifiers. Table11 lists the assigned parameters for the ML algorithms as used in the conducted empirical experiments.Table 11
Used parameters values for each ML algorithm in WEKA.
ML algorithmParameter nameValueDTBatch size100Binary splitsFalseCollapse treeTrueConfidence factor0.25DebugFalseDo not check capabilitiesFalseDo not make split point actual valueFalseMin num obj2Num decimal places2Num folds3Reduced error pruningFalseSave instance dataFalseSeeds1Subtree raisingTrueUnprunedFalseUse LaplaceFalseUse MDL correctionTrueSVMBatch size100Build calibration modelsFalseC1CalibratorDefaultChecks turned offFalseDebugFalseDo not check capabilitiesFalseEpsilon1.0E − 12Filter typeNormalize training dataKernelDefaultNum decimal places2Num folds−1Random seed1Tolerance parameter0.001NBBatch size100DebugFalseDisplay model in old formatFalseDo not check capabilitiesFalseNum decimal places2Use kernel estimatorFalseUse supervised discretizationFalseRFBag size percent100Batch size100Break ties randomlyFalseCalc out of bagFalseCompute attribute importanceFalseDebugFalseDo not check capabilitiesFalseMax depth0Num decimal places2Num execution slots1Num features0Num iterations100Output out of bag complexity statisticsFalsePrint classifiersFalseSeed1Store out of bag predictionsFalseANNGUIFalseAuto buildTrueBatch size100DebugFalseDecayFalseDo not check capabilitiesFalseHidden layersALearning rate0.3Momentum0.2Nominal to binary filterTrueNormalize attributesTrueNormalize numeric classTrueNum decimal places2ResetTrueSeed0Training time500Validation set size0Validation threshold20


### 3.8. Device Specifications

The device that we have used to conduct all the experiments is Dell OptiPlex 9020 with Intel i7-4770 CPU, 12 GB of random access memory (RAM), 500 GB hard disk drive (HDD), and the operating system (OS) is Microsoft Windows 10 Pro.


## 3.1. Datasets

Intrusion-related datasets are used to train and test the proposed IDS models. KDD CUP 99 and NSL-KDD have been extensively used in intrusion detection-related research studies [27]. Table 6 compares the major datasets related to intrusion detection [6, 10, 27, 29, 35, 36].Table 6
Comparison between different datasets related to intrusion detection.
No.DatasetCreation dateBased onDeploymentAttack categoriesNo. of attributesNo. of records1DARPA 19981998—NIDSDoS41Not mentionedProbeR2LU2R2KDD CUP 991999DARPA 1998NIDSDoS414,898,431ProbeR2LU2R3NSL-KDD2009KDD CUP 99NIDSDoS41148,517ProbeR2LU2R4UNSW-NB152015—NIDSAnalysis Reconnaissance452,540,044ShellcodeFuzzersWormGenericDoSExploitsBackdoors5ADFA2013—HIDSHydra-FTPNot mentioned5,773 (Windows)Hydra-SSH5,800 (Linux)Add-userJava-MeterpreterWeb-shell


### 3.1.1. DARPA 1998

The DARPA 1998 dataset was created within the Intrusion Detection Evaluation Project. It consists of two sets of data, one for training and the other for testing. The DARPA 1998 dataset is one of the early datasets that were publicly available [37].


### 3.1.2. KDD CUP 99

Knowledge Discovery in Databases (KDD) CUP 99 was derived from the DARPA 1998 dataset. It was explicitly generated to develop ML, classification, and clustering algorithms with more focus on security issues [37]. KDD CUP 99 was described as a “de facto benchmark for evaluating the performance of intrusions detection algorithm” [32]. There is an issue associated with KDD CUP 99 dataset, which is redundancy.There are 78% redundant records in the training dataset and 75% redundant records in the testing dataset [38]. Redundant records in the KDD CUP 99 dataset negatively affect the performance of the classifiers, making it biased to the more frequently repeated records.


### 3.1.3. NSL-KDD

The NSL-KDD was initially generated to overcome the drawbacks of the KDD CUP 99 dataset [27]. NSL-KDD was generated based on the KDD CUP 99, but NSL-KDD does not have redundant records [31]. This makes NSL-KDD more suitable to evaluate ML classifiers. NSL-KDD has the same 41 attributes from the KDD CUP 99 dataset. Table 7 lists the different data files of the NSL-KDD dataset.Table 7
The data files included in the NSL-KDD dataset.
No.NSL-KDD data filesDescriptionNo. of attributesNo. of instancesNo. of normal instancesNo. of anomaly instances1KDDTest+Contains the full testing set4222,5449,71112,8332KDDTest-21A subset of the KDDTest+, without records of difficulty level 21 out of 214211,8502,1529,6983KDDTrain+Contains the full training set42125,97367,34358,6304KDDTrain+_20PercentRepresents a 20% subset of the KDDTrain+4225,19213,44911,743It can be noticed from Table7 that the number of attributes for both KDD and NSL-KDD is 42. In Table 6, the number of attributes is 41 and this additional attribute is the class, also called the label attribute. Details about the NSL-KDD’s attributes such as the type and the description are illustrated in Table 8.Table 8
A list of the NSL-KDD attributes.
No.AttributeType1DurationNumeric2Protocol_typeNominal3ServiceNominal4FlagNominal5Src_bytesNumeric6Dst_bytesNumeric7LandNominal8Wrong_fragmentNumeric9UrgentNumeric10HotNumeric11Num_failed_loginsNumeric12Logged_inNominal13Num_compromisedNumeric14Root_shellNumeric15Su_attemptedNumeric16Num_rootNumeric17Num_file_creationsNumeric18Num_shellsNumeric19Num_access_filesNumeric20Num_outbound_cmdsNumeric21Is_host_loginNominal22Is_guest_loginNominal23CountNumeric24Srv_count_Numeric25Serror_rateNumeric26Srv_serror_rateNumeric27Rerror_rateNumeric28Srv_rerror_rateNumeric29Same_srv_rateNumeric30Diff_srv_rateNumeric31Srv_diff_host_rateNumeric32Dst_host_countNumeric33Dst_host_srv_countNumeric34Dst_host_same_srv_rateNumeric35Dst_host_diff_srv_rateNumeric36Dst_host_same_src_port_rateNumeric37Dst_host_srv_diff_host_rateNumeric38Dst_host_serror_rateNumeric39Dst_host_srv_serror_rateNumeric40Dst_host_rerror_rateNumeric41Dst_host_srv_rerror_rateNumeric42ClassNominal


### 3.1.4. UNSW-NB15

The University of New South Wales created the UNSW-NB15 dataset for evaluating new NIDSs. 100 GB of raw network traffic was collected to build the UNSW-NB15 dataset. The UNSW-NB15 dataset consists of ten categories of traffic; one normal and nine categories represent different forms of attacks [8]. However, ML-based techniques perform better with both KDD CUP 99 and NSL-KDD. This is due to two reasons. Firstly, many values of normal and malicious instances are almost the same in the UNSW-NB15 dataset, whereas there is a relatively reasonable difference between the normal and the malicious values in both KDD CUP 99 and NSL-KDD. Secondly, the data distribution of the UNSW-NB15 dataset is nearly the same, while it is different in the KDD CUP 99 and NSL-KDD due to the existence of new attacks in the testing set, which helps to differentiate between normal and abnormal instances when running ML algorithms [8]. Tables 9 and 10 illustrate the number of attributes, the total number of instances, the number of normal instances, and the number of malicious instances. In addition, the attributes’ names and types are also illustrated.Table 9
The training and the testing datasets of the UNSW-NB15.
No.UNSW-NB15 data filesNo. of attributesNo. of instancesNo. of normal instancesNo. of attack instances1UNSW_NB15_training-set4582,33237,00045,3322UNSW_NB15_testing-set45175,34156,000119,341Table 10
List of UNSW-NB15 attributes.
No.AttributeType1IdNumeric2DurNumeric3ProtoNominal4ServiceNominal5StateNominal6SpktsNumeric7DpktsNumeric8SbytesNumeric9DbytesNumeric10RateNumeric11SttlNumeric12DttlNumeric13SloadNumeric14DloadNumeric15SlossNumeric16DlossNumeric17SinpktNumeric18DinpktNumeric19SjitNumeric20DjitNumeric21SwinNumeric22StcpbNumeric23DtcpbNumeric24DwinNumeric25TcprttNumeric26SynackNumeric27AckdatNumeric28SmeanNumeric29DmeanNumeric30Trans_depthNumeric31Response_body_lenNumeric32Ct_srv_srcNumeric33Ct_state_ttlNumeric34Ct_dst_Numeric35Ct_src_dport_ltmNumeric36Ct_dst_sport_ltmNumeric37Ct_dst_src_ltmNumeric38Is_ftp_loginNumeric39Ct_ftp_cmdNumeric40Ct_flw_http_mthdNumeric41Ct_src_ltmNumeric42Ct_srv_dstNumeric43Is_sm_ips_portsNumeric44Attack_catNominal45LabelNumeric


### 3.1.5. ADFA

The ADFA dataset was generated to be tested for host-level intrusion detection. It was generated by the Australian Defense Academy (ADFA). The ADFA dataset encompasses two different platforms, Windows (ADFA-WD) and Linux (ADFA-LD) [10]. There are five categories of attacks within this dataset, which can be found in Table 6.


## 3.1.1. DARPA 1998

The DARPA 1998 dataset was created within the Intrusion Detection Evaluation Project. It consists of two sets of data, one for training and the other for testing. The DARPA 1998 dataset is one of the early datasets that were publicly available [37].


## 3.1.2. KDD CUP 99

Knowledge Discovery in Databases (KDD) CUP 99 was derived from the DARPA 1998 dataset. It was explicitly generated to develop ML, classification, and clustering algorithms with more focus on security issues [37]. KDD CUP 99 was described as a “de facto benchmark for evaluating the performance of intrusions detection algorithm” [32]. There is an issue associated with KDD CUP 99 dataset, which is redundancy.There are 78% redundant records in the training dataset and 75% redundant records in the testing dataset [38]. Redundant records in the KDD CUP 99 dataset negatively affect the performance of the classifiers, making it biased to the more frequently repeated records.


## 3.1.3. NSL-KDD

The NSL-KDD was initially generated to overcome the drawbacks of the KDD CUP 99 dataset [27]. NSL-KDD was generated based on the KDD CUP 99, but NSL-KDD does not have redundant records [31]. This makes NSL-KDD more suitable to evaluate ML classifiers. NSL-KDD has the same 41 attributes from the KDD CUP 99 dataset. Table 7 lists the different data files of the NSL-KDD dataset.Table 7
The data files included in the NSL-KDD dataset.
No.NSL-KDD data filesDescriptionNo. of attributesNo. of instancesNo. of normal instancesNo. of anomaly instances1KDDTest+Contains the full testing set4222,5449,71112,8332KDDTest-21A subset of the KDDTest+, without records of difficulty level 21 out of 214211,8502,1529,6983KDDTrain+Contains the full training set42125,97367,34358,6304KDDTrain+_20PercentRepresents a 20% subset of the KDDTrain+4225,19213,44911,743It can be noticed from Table7 that the number of attributes for both KDD and NSL-KDD is 42. In Table 6, the number of attributes is 41 and this additional attribute is the class, also called the label attribute. Details about the NSL-KDD’s attributes such as the type and the description are illustrated in Table 8.Table 8
A list of the NSL-KDD attributes.
No.AttributeType1DurationNumeric2Protocol_typeNominal3ServiceNominal4FlagNominal5Src_bytesNumeric6Dst_bytesNumeric7LandNominal8Wrong_fragmentNumeric9UrgentNumeric10HotNumeric11Num_failed_loginsNumeric12Logged_inNominal13Num_compromisedNumeric14Root_shellNumeric15Su_attemptedNumeric16Num_rootNumeric17Num_file_creationsNumeric18Num_shellsNumeric19Num_access_filesNumeric20Num_outbound_cmdsNumeric21Is_host_loginNominal22Is_guest_loginNominal23CountNumeric24Srv_count_Numeric25Serror_rateNumeric26Srv_serror_rateNumeric27Rerror_rateNumeric28Srv_rerror_rateNumeric29Same_srv_rateNumeric30Diff_srv_rateNumeric31Srv_diff_host_rateNumeric32Dst_host_countNumeric33Dst_host_srv_countNumeric34Dst_host_same_srv_rateNumeric35Dst_host_diff_srv_rateNumeric36Dst_host_same_src_port_rateNumeric37Dst_host_srv_diff_host_rateNumeric38Dst_host_serror_rateNumeric39Dst_host_srv_serror_rateNumeric40Dst_host_rerror_rateNumeric41Dst_host_srv_rerror_rateNumeric42ClassNominal


## 3.1.4. UNSW-NB15

The University of New South Wales created the UNSW-NB15 dataset for evaluating new NIDSs. 100 GB of raw network traffic was collected to build the UNSW-NB15 dataset. The UNSW-NB15 dataset consists of ten categories of traffic; one normal and nine categories represent different forms of attacks [8]. However, ML-based techniques perform better with both KDD CUP 99 and NSL-KDD. This is due to two reasons. Firstly, many values of normal and malicious instances are almost the same in the UNSW-NB15 dataset, whereas there is a relatively reasonable difference between the normal and the malicious values in both KDD CUP 99 and NSL-KDD. Secondly, the data distribution of the UNSW-NB15 dataset is nearly the same, while it is different in the KDD CUP 99 and NSL-KDD due to the existence of new attacks in the testing set, which helps to differentiate between normal and abnormal instances when running ML algorithms [8]. Tables 9 and 10 illustrate the number of attributes, the total number of instances, the number of normal instances, and the number of malicious instances. In addition, the attributes’ names and types are also illustrated.Table 9
The training and the testing datasets of the UNSW-NB15.
No.UNSW-NB15 data filesNo. of attributesNo. of instancesNo. of normal instancesNo. of attack instances1UNSW_NB15_training-set4582,33237,00045,3322UNSW_NB15_testing-set45175,34156,000119,341Table 10
List of UNSW-NB15 attributes.
No.AttributeType1IdNumeric2DurNumeric3ProtoNominal4ServiceNominal5StateNominal6SpktsNumeric7DpktsNumeric8SbytesNumeric9DbytesNumeric10RateNumeric11SttlNumeric12DttlNumeric13SloadNumeric14DloadNumeric15SlossNumeric16DlossNumeric17SinpktNumeric18DinpktNumeric19SjitNumeric20DjitNumeric21SwinNumeric22StcpbNumeric23DtcpbNumeric24DwinNumeric25TcprttNumeric26SynackNumeric27AckdatNumeric28SmeanNumeric29DmeanNumeric30Trans_depthNumeric31Response_body_lenNumeric32Ct_srv_srcNumeric33Ct_state_ttlNumeric34Ct_dst_Numeric35Ct_src_dport_ltmNumeric36Ct_dst_sport_ltmNumeric37Ct_dst_src_ltmNumeric38Is_ftp_loginNumeric39Ct_ftp_cmdNumeric40Ct_flw_http_mthdNumeric41Ct_src_ltmNumeric42Ct_srv_dstNumeric43Is_sm_ips_portsNumeric44Attack_catNominal45LabelNumeric


## 3.1.5. ADFA

The ADFA dataset was generated to be tested for host-level intrusion detection. It was generated by the Australian Defense Academy (ADFA). The ADFA dataset encompasses two different platforms, Windows (ADFA-WD) and Linux (ADFA-LD) [10]. There are five categories of attacks within this dataset, which can be found in Table 6.


## 3.2. Dataset Preprocessing

This paper utilizes two intrusion detection datasets, which are the NSL-KDD dataset and the UNSW-NB15 dataset. The NSL-KDD dataset can be used directly in the experiments as the class value of the NSL-KDD is nominal, whereas the class value of the UNSW-NB15 dataset is numeric. Therefore, the class values of the UNSW-B15 dataset must be converted from numeric to nominal.WEKA data mining tool provides a numeric to nominal filter that can be used to convert numeric values to nominal values. Typically, the class is located as the last attribute in the dataset [20]. In the NSL-KDD dataset, the last attribute, which is attribute number 42, contains two distinct nominal values, called normal and anomaly. On the other hand, the class value of the UNSW-NB15 dataset, which is attribute number 45, consists of numeric values.


## 3.3. Proposed Experiments

Generally, the proposed methodology consists of six distinct sets of experiments illustrated in Figure3. Each set of experiments aims to empirically test a certain aspect of ML-based IDS performance in response to the noise.Figure 3
The overall methodology used in this paper.The first set of experiments involves generating the baseline, which will be needed to investigate the potential impact of noise and the effectiveness of noise filtering techniques on ML-based IDSs. Furthermore, it will be used to measure the influence of employing ensemble learning algorithms. The results of the subsequent stages will be compared with the results of this stage.In the second set of experiments, interquartile noise filtering algorithm will be applied to the datasets. This filter will help to identify outliers and extreme values from the datasets. The results of this phase will be compared with the baseline.In the third set of experiments, noise is injected into the intrusion datasets with the following percentages: 5%, 10%, 20%, and 30%. Then noisy data will be inserted into the ML models. The results will be compared with the baseline obtained from the first stage. This is useful to test the robustness of ML algorithms against noise.The fourth set of experiments entails conducting noise filtering by excluding noisy instances and then injecting different levels of noise, which are 5%, 10%, 20%, and 30%. This will help to study the influence of noise on the ML algorithms that run on intrusion datasets with the absence of outlier and extreme value instances.In the fifth set of experiments, noise injection is applied before noise filtering. In this experiment, noise is injected in the form of manipulating the labels of a given percentage of the training set. Noise filtering is conducted by removing outliers and extreme values.The sixth set of experiments studies the influence of using ensemble learning techniques on the accuracy of the ML algorithms when applying it to the intrusion datasets.A generic description of the conducted experiments is presented in the form of pseudocodes.Pseudocode 1:The first set of experiments (baseline experiment).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Train the ML algorithm on the training dataset(4)
Run the ML algorithm on the testing dataset(5)
Document the results(6)
Revert to step 3 using the other ML algorithmsPseudocode 2:The second set of experiments (noise filtering).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Conduct noise filtering by removing the outliers and the extreme values(4)
Train the ML algorithm on the training dataset(5)
Run the ML algorithm on the testing dataset(6)
Document the results(7)
Revert to step 4 using the other ML algorithmsPseudocode 3:The third set of experiments (noise injection).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(4)
Train the ML algorithm on the noisy training dataset(5)
Run the ML algorithm on the testing dataset(6)
Document the results(7)
Revert to step 3 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 4:The fourth set of experiments (noise filtering then injection).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise filtering by removing the outliers and the extreme values(4)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(5)
Train the ML algorithm on the noisy training dataset(6)
Run the ML algorithm on the testing dataset(7)
Document the results(8)
Revert to step 4 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 5:The fifth set of experiments (noise injection then filtering).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for UNSW-NB15)(3)
Conduct noise injection by manipulating the labels of the training instances (5, 10, 20, and 30%)(4)
Conduct noise filtering by removing the outliers and the extreme values(5)
Train the ML algorithm on the noisy training dataset(6)
Run the ML algorithm on the testing dataset(7)
Document the results(8)
Revert to step 4 until each of the ML algorithms is trained and tested with the different levels of noisePseudocode 6:The sixth set of experiments (ensemble of classifiers).
(1)
Load the training portion of the intrusion dataset(2)
Convert the label values from numeric to nominal (only for the UNSW-NB15)(3)
Initialize the ensemble learning method (bagging-boosting)(4)
Use an ML algorithm as a base classifier(5)
Train the ensemble of classifiers on the dataset(6)
Test the ensemble of classifiers on the test dataset(7)
Document the results(8)
Revert to step 3 until each ML algorithms is used with both ensemble learning methods


## 3.4. Noise Injection

The presence of noise might negatively affect the accuracy of ML algorithms. Noise can take different forms such as mislabelled data or incorrectly classified instances.To obtain more accurate outcome, noisy data must be filtered first as working with noise-free data helps to avoid potential issues such as overfitting [36].Some experiments in this paper require injecting different levels of noise into the datasets. In WEKA, noise can be injected into the datasets via the AddNoise filter. AddNoise filter “changes a percentage of a given nominal attribute’s values” [20]. The default value of noise injection in the AddNoise filter is 10%. However, it can be adjusted to any other percentage.


## 3.5. Evaluation Metrics

It is critical to specify the adequate metrics that will be used to evaluate the ML algorithms with the intrusion detection datasets. However, the evaluation metrics should be relevant to the subject under examination. Ahmad et al. [26] used three evaluation metrics to compare the performance of SVM, RF, and EL for the IDSs. These evaluation metrics are accuracy, precision, and recall.In this paper, the authors will use the same evaluation metrics. The classification of each testing instance falls within four cases (usually referred collectively as the confusion matrix). The four cases are as follows:(i)
True positive (TP): malicious instances that were correctly classified as malicious by the IDS(ii)
True negative (TN): normal instances that were correctly classified as normal by the IDS(iii)
False positive (FP): normal instances that were incorrectly classified by the IDS as malicious(iv)
False negative (FN): malicious instances that were incorrectly classified by the IDS as normalThe above four values are used to calculate the evaluation metrics [37]. Accuracy represents the ratio of correctly classified instances to the total number of instances in the test dataset:(14)accuracy=TP+TNTP+TN+FP+FN.Precision represents the accuracy of the positive predictions:(15)precision=TPTP+FP.Recall is the ratio of positive instances that the classifier manages to classify correctly:(16)recall=TPTP+FN.Accuracy is the most relevant metric to the objective of this paper as it indicates the success percentage of the ML algorithm in classifying the testing instances. Classifying the testing instances involves determining whether it represents an intrusion or not. This will help to define the factors that can influence, either positively or negatively, the accuracy of the ML algorithms. Therefore, only the accuracy metric will be used to assess and compare the different ML algorithms from different experiments with the baseline, and the other metrics will be presented to provide a more holistic perspective on the effectiveness of the ML algorithm.


## 3.6. Tool Used in This Research (WEKA)

This paper utilizes Waikato Environment for Knowledge Analysis (WEKA) version 3.8.3 as the main tool to conduct empirical experiments. WEKA is an open-source tool written in Java and designed to run ML algorithms. It was developed by the University of Waikato, New Zealand [39]. WEKA provides the ability to run many ML algorithms such as J48 (a DT flavor), RF, and SVM on any dataset.


## 3.7. The ML Algorithms’ Parameters

Each ML algorithm has its own set of parameters that determines exactly how it operates. These parameters can be fine-tuned to enhance the performance of the ML-based classifiers. Table11 lists the assigned parameters for the ML algorithms as used in the conducted empirical experiments.Table 11
Used parameters values for each ML algorithm in WEKA.
ML algorithmParameter nameValueDTBatch size100Binary splitsFalseCollapse treeTrueConfidence factor0.25DebugFalseDo not check capabilitiesFalseDo not make split point actual valueFalseMin num obj2Num decimal places2Num folds3Reduced error pruningFalseSave instance dataFalseSeeds1Subtree raisingTrueUnprunedFalseUse LaplaceFalseUse MDL correctionTrueSVMBatch size100Build calibration modelsFalseC1CalibratorDefaultChecks turned offFalseDebugFalseDo not check capabilitiesFalseEpsilon1.0E − 12Filter typeNormalize training dataKernelDefaultNum decimal places2Num folds−1Random seed1Tolerance parameter0.001NBBatch size100DebugFalseDisplay model in old formatFalseDo not check capabilitiesFalseNum decimal places2Use kernel estimatorFalseUse supervised discretizationFalseRFBag size percent100Batch size100Break ties randomlyFalseCalc out of bagFalseCompute attribute importanceFalseDebugFalseDo not check capabilitiesFalseMax depth0Num decimal places2Num execution slots1Num features0Num iterations100Output out of bag complexity statisticsFalsePrint classifiersFalseSeed1Store out of bag predictionsFalseANNGUIFalseAuto buildTrueBatch size100DebugFalseDecayFalseDo not check capabilitiesFalseHidden layersALearning rate0.3Momentum0.2Nominal to binary filterTrueNormalize attributesTrueNormalize numeric classTrueNum decimal places2ResetTrueSeed0Training time500Validation set size0Validation threshold20


## 3.8. Device Specifications

The device that we have used to conduct all the experiments is Dell OptiPlex 9020 with Intel i7-4770 CPU, 12 GB of random access memory (RAM), 500 GB hard disk drive (HDD), and the operating system (OS) is Microsoft Windows 10 Pro.


## 4. Results and Discussions

This section discusses the conducted experiments and the obtained results and analysis of the results.


### 4.1. Baseline Experiment

The main objective of this set of experiments is to determine the data that will be used in subsequent experiments and to establish a baseline to compare it with the results of subsequent experiments. Therefore, three baseline experiments are conducted. Each of these baselines will be constructed using the same ML algorithms. However, the only difference is in the method of using the dataset as the following:(i)
Training the model using the training dataset and testing it on a separate testing dataset.(ii)
Each dataset will be divided into three equal parts. Two-thirds will be used for training and one-third will be used for testing. This method is referred to as the percentage split. In this paper, all ML algorithms were trained on the same two-thirds of the datasets and all were tested on the same one-third that was dedicated for testing.(iii)
The entire training data of each dataset will be used for training and testing the constructed models. This will be achieved using an iterative manner called cross-validation, which entails dividing the dataset to a certain number of equal partitions (folds). All of these partitions have the same size. Then, the tests are performed by selecting one of these folds for testing and the remaining folds for training. This is achieved in an iterative manner. In this paper, we have divided the training portion to 10-folds.The results of the first set of experiments are aggregated in Table12 which includes details about the testing mode, the used ML methods, the names of the intrusion datasets, and the evaluation metrics. Figure 4(a) compares the results using different testing modes using the NSL-KDD dataset while Figure 4(b) compares the results using different testing modes using the UNSW-NB15 dataset.Table 12
Constructing the baseline experiments with different testing modes.
Test modeML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecessionRecallSupplied test setDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000Naïve Bayes76.11780.8090.76187.44350.8840.874Percentage splitDT (J48)99.72450.9970.9971001.0001.000RF99.90190.9990.9991001.0001.000SVM97.45740.9750.9751001.0001.000ANN98.60850.9860.9861001.0001.000Naïve Bayes90.59330.9070.90692.13970.9300.921Cross-validationDT (J48)99.78170.9980.9981001.0001.000RF99.91740.9990.9991001.0001.000SVM97.4050.9740.9741001.0001.000ANN98.53780.9850.9851001.0001.000Naïve Bayes90.38290.9050.90492.48090.9320.925Figure 4
The baseline classification accuracy results of the intrusion datasets. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)In the supplied test set, both KDDTrain+ and KDDTest+ from the NSL-KDD were used for training and testing, respectively. On the other hand, the UNSW_NB15_training-set and the UNSW_NB15_testing-set from UNSW-NB15 were used for training and testing, respectively. In percentage split and cross-validation, the KDDTrain+ from NSL-KDD and UNSW_NB15_training-set from UNSW-NB15 were used.With the NSL-KDD dataset, it can be noticed that the test mode highly affects the classification accuracy of the used ML algorithms. However, the observations are illustrated in the following points:(i)
The classification accuracy of the ML algorithms tends to degrade when a supplied test set is used, whereas the accuracy of the other test modes, which are percentage split and cross-validation, is high(ii)
With the supplied test set, DT (J48) achieved the highest accuracy (81.5339%), whereas RF achieved the highest accuracy with the percentage split (99.9019%) and cross-validation (99.9174%)(iii)
The NB scored the lowest accuracy in all test modes, especially with the supplied test mode (76.1178%).The observations from the accuracy results when the UNSW-NB15 dataset is used are as follows:(i)
DT, SVM, and ANN achieved the same accuracy results across all the experiments, which is 100%.(ii)
RF algorithm achieved less accuracy results with the supplied test set (98.4903%) and it achieved (100%) classification accuracy with both percentages split and cross-validation.(iii)
NB algorithm, similarly, achieved higher accuracy results with percentage split and cross-validation, which are 92.1397% and 92.4809%, respectively, whereas it achieved the lowest classification accuracy (87.4435%) with the supplied test set.(iv)
Typically, gaining a 100% accuracy means that the ML algorithm managed to correctly classify all instances within the testing dataset.(v)
Generally, the results seem to support the claim of Moustafa et al. [8], about the inadequacy of using ML algorithms with the UNSW-NB15 dataset. The reasons for this inadequacy are mentioned in Section 3.1.4.Subsequent experiments will be conducted using the supplied test set only rather than splitting a single dataset or cross-validation as this provides a better understanding of different factors that might affect the accuracy of the ML algorithms on the intrusion dataset. For the NSL-KDD dataset, KDDTrain+ and KDDTest+ will be used, to train and test the model, respectively. On the other hand, for the UNSW-NB15, UNSW_NB15_training-set and the UNSW_NB15_testing-set will also be used to train and test the model, respectively.


### 4.2. Noise Filtering Experiment

The second set of experiments includes using noise filtering by removing outliers and extreme values from the training and the testing datasets. The results from this set of experiments are listed in Table13. In addition, the classification accuracy results are compared with the baseline. Figures 5(a) and 5(b) show the results of using the filtered NSL-KDD dataset and the filtered UNSW-NB15 dataset, respectively.Table 13
Results after conducting the noise filtering.
Noise filteringML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874FilteredDT (J48)80.71160.8440.8071001.0001.000RF80.67420.8440.80799.93960.9990.999SVM80.63670.7960.8061001.0001.000ANN80.63670.7960.8061001.0001.000NB80.48690.7460.80575.46080.8000.755Figure 5
The classification accuracy results of the filtered datasets. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)The effects of removing the outliers and extreme instances on the accuracy of the filtered NSL-KDD dataset are as follows:(i)
Removing the outliers and the extreme value instances slightly decreased (−0.8223%) the classification accuracy of the DT (J48) algorithm in comparison with the baseline experiment(ii)
The accuracy of the RF slightly increased (+0.2226%) after removing the outliers and the extreme instances.(iii)
For SVM, ANN, and NB, the removal of outliers and noisy instances has a noticeable positive influence. The classification accuracy of the SVM algorithm increased by +5.2419%, whereas the accuracy of ANN increased by +2.922%, and for the NB, the accuracy increased by +4.3691%.The accuracy values of the UNSW-NB15 dataset after conducting the instance reduction by removing the outliers and extreme value instances are as follows:(i)
For DT (J48), SVM, and ANN, the accuracy values of the filtered dataset remained as the baseline (100%). This means that the removal of the outliers and the extreme value instances did not affect the classification accuracy of these ML algorithms when used with the UNSW-NB15 intrusion dataset.(ii)
The accuracy of the RF algorithm was slightly improved by +1.4493% due to the removal of the outliers and the extreme value instances.(iii)
On the other hand, the accuracy value of the NB algorithm was decreased by −11.9827% as a result of noise filtering. This means the NB algorithm performs better with the presence of the outliers and extreme values in the UNSW-NB15 dataset.


### 4.3. Noise Injection Experiment

The third set of experiments aims to investigate the extent of the effect of noise over the five considered ML algorithms when applying them over the intrusion-related datasets. In this set of experiments, different levels of noise (5%, 10%, 20%, and 30%) are added to each training dataset, and no noise will be injected into the testing dataset. The noise will be injected using WEKA’s AddNoise filter.The noise will be injected solely into the class attribute. This will help to investigate the classification accuracy of the ML algorithms on the testing dataset, knowing that it was trained on a noisy dataset. The results after injecting the different levels of noise are illustrated in Table14. Figures 6(a) and 6(b) show the results of using noise with the NSL-KDD dataset and the UNSW-NB15 dataset, respectively.Table 14
Injecting different levels of noise in the intrusion datasets.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaseline 0% noiseDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.8745% noise injectedDT (J48)80.78870.8510.8081001.0001.000RF79.32040.8440.79394.85380.9540.949SVM76.27310.8280.7631001.0001.000ANN79.22730.8260.79299.99881.0001.000NB74.98670.8050.75077.59920.8050.77610% noise injectedDT (J48)80.79760.8460.8081001.0001.000RF77.21790.8140.77293.98290.9470.940SVM76.23760.8280.7621001.0001.000ANN76.40610.8090.7641001.0001.000NB73.93540.8000.73977.58830.8010.77620% noise injectedDT (J48)79.80840.8260.7981001.0001.000RF72.32080.7770.72388.81480.9080.888SVM78.76150.8480.7881001.0001.000ANN77.43080.8130.77499.99881.0001.000NB71.67760.7910.71777.27130.8000.77330% noise injectedDT (J48)80.10110.8280.80166.94120.7780.669RF70.65740.7500.70784.47990.8710.845SVM78.72160.8470.7871001.0001.000ANN75.29280.8020.75399.98181.0001.000NB74.46770.8010.74577.75110.8010.778Figure 6
The classification accuracy with different levels of noise injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)Noise injection affected the accuracy of the ML algorithms tested on the NSL-KDD dataset. The accuracy of some algorithms decreases with the increase of noise, and the accuracy of certain algorithm increases with the increase of noise. The observations from this set of experiments are as follows:(i)
The accuracy of the DT (J48) algorithm is slightly influenced by the different levels of noise compared to the baseline, which is 81.5339%. DT (J48) achieved better accuracy with 10% noise compared to 5% noise and it also achieved better accuracy with 30% noise in comparison with 20% noise injection.(ii)
The accuracy of the RF algorithm continuously decreased with the increase of noise (79.3204%, 77.2179%, 72.3208%, and 70.6574%), respectively, when compared with the baseline (80.4516%).(iii)
Interestingly, with the SVM algorithm, the increase of noise causes an increase in the classification accuracy when compared with the baseline (75.3948%). With the different levels of noise, the SVM algorithm scored the following accuracy results (76.2731%, 76.2376%, 78.7615%, and 78.7216%). It can be concluded that SVM managed to correctly classify more testing instances, knowing that it was originally trained on a noisy (misclassified) data.(iv)
The baseline accuracy of the ANN algorithm is 77.7147%, and with the different levels of noise, the accuracy of the ANN algorithm varies with a slight increase and decrease compared to the baseline (79.2273%, 76.4061%, 77.4308%, and 75.2928%). The accuracy of the ANN algorithm behaves similar to the DT (J48).(v)
Similar to the RF algorithm, the accuracy of the NB algorithm decreases with the increase of noise when compared with the baseline value (76.1178%), except that, with the 30% noise injection, the classification accuracy increased when compared with 10% and 20% noise injection (74.9867%, 73.9354%, 71.6776%, and 74.4677%).The effect of noise injection on the accuracy of the ML algorithms tested on the UNSW-NB15 dataset can be summarized as follows:(i)
The classification accuracy of the DT (J48) algorithm is not affected by the 5%, 10%, and 20% noise and it remained as the baseline (100%). However, the accuracy was intensely affected when a 30% noise was injected. The DT accuracy recorded 66.9412% classification accuracy. This means that the DT algorithm with the UNSW-NB15 dataset can maintain high classification accuracy until a certain limit where it starts to heavily degrade and cannot be used reliably.(ii)
With the RF algorithm, the classification accuracy continuously decreased with the increase of noise. It can be concluded that RF algorithm is sensitive to noise and it should be trained on a correctly labelled dataset in order to obtain better classification outcomes.(iii)
The classification accuracy of the SVM algorithm was not affected by any level of noise. The classification accuracy remained as the baseline (100%) even after injecting different levels of noise. This means that the SVM algorithm managed to successfully classify all testing instances even though it was trained on a mislabelled dataset. Therefore, it can be considered as the most robust algorithm in this set of experiments.(iv)
The classification accuracy of the ANN algorithm was slightly decreased with the increase in noise. The baseline accuracy of the ANN algorithm is 100%, and the accuracy results after injecting the different levels of noise are 99.9988%, 100%, 99.9988%, and 99.9818. This means that training the ANN algorithm on noisy dataset does not greatly affect the classification accuracy.(v)
The baseline value of the NB algorithm is 87.4435%, and the accuracy results after inserting the different noise levels are 77.5992%, 77.5883%, 77.2713%, and 77.7511%, respectively. This indicates that the effect of different levels of noise on the NB algorithm is almost identical.Figure7 illustrates the impact of injecting different levels of noise in the NLS-KDD dataset and the corresponding accuracy of the ML algorithms. It can be noticed that SVM algorithm is the most resilient algorithm to noise injection whereas the RF algorithm is the least resilient algorithm to noise injection.Figure 7
Noise injection in the NSL-KDD dataset and the accuracy of ML algorithms.Figure8 illustrates the impact of injecting different levels of noise in the UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. The major degradation in the classification accuracy of the DT algorithm with the 30% noise injection is readily apparent in addition to the continuous decrease in the classification accuracy of the RF algorithm with the increase of the percentage of noise ratio.Figure 8
Noise injection in the UNSW-NB15 dataset and the accuracy of ML algorithms.


### 4.4. Noise Filtering Then Injection Experiment

In the fourth set of experiments, noise is filtered by removing outliers and extreme value instances and then noise is injected with different levels (5%, 10%, 20%, and 30%) to the intrusion dataset. The third experiment investigated the effect of noise injection. The current experiment inspects the potential impact of noise injection on filtered intrusion datasets. Table15 shows the results obtained from this set of experiments. Figures 9(a) and 9(b) show the results of injecting noise on the filtered NSL-KDD and UNSW-NB15 datasets, respectively.Table 15
The results of running ML algorithms on a filtered and then injected intrusion dataset.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874Filtered then 5% noise injectedDT (J48)80.67420.8440.8071001.0001.000RF80.48690.7460.80596.32960.9670.963SVM80.48690.7460.8051001.0001.000ANN80.52430.7600.80598.50010.9850.985NB80.48690.7460.80574.2850.7950.743Filtered then 10% noise injectedDT (J48)80.67420.8440.8071001.0001.000RF80.29960.7210.80396.3360.9670.963SVM80.48690.7460.8051001.0001.000ANN80.63670.7960.80699.8920.9990.999NB80.48690.7460.80574.20550.7950.742Filtered then 20% noise injectedDT (J48)80.56180.8430.80671.44720.8150.714RF81.27340.7770.81392.6560.9380.927SVM80.48690.7460.80599.98411.0001.000ANN80.63670.7960.80699.96821.0001.000NB80.48690.7460.80574.07840.7940.741Filtered then 30% noise injectedDT (J48)78.57680.6620.78670.18240.7970.702RF80.97380.8040.81087.60010.8970.876SVM80.48690.7460.80599.91740.9990.999ANN80.71160.7660.80799.90780.9990.999NB80.48690.7460.80574.07210.7940.741Figure 9
The ML algorithms’ accuracy after noise filtering and injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)In general, removing outliers and extreme value instances appeared to have a positive influence on certain ML algorithms. Here is the analysis of the accuracy results for the NSL-KDD dataset:(i)
The DT (J48) was slightly impacted by noise when applied on a filtered dataset. The baseline accuracy was 81.5339%, and the accuracy results after injecting the different levels of noise are 80.6742%, 80.6742%, 80.5618%, and 78.5768%. The DT (J48) gave the same accuracy results with the 5% and the 10% noise injection.(ii)
The accuracy results from the third set of experiments illustrate that the accuracy of the RF algorithm has decreased with the increase of noise. In the current experiments, it seems that the RF algorithm achieved better accuracy results. The baseline accuracy of the RF algorithm is 80.4516%, and the accuracy results after filtering the dataset and injecting different levels of noise are 80.4869%, 80.2996%, 81.2734%, and 80.9738%. Therefore, it is obvious that removing outliers and extreme value instances has a positive influence on the RF algorithm when used with a noisy NSL-KDD dataset.(iii)
The accuracy of the SVM and NB algorithms with all different levels of noise injection remained exactly the same (80.4869%), whereas the accuracy of the baseline was 75.3948% and 76.1178% for SVM and NB, respectively. This means that the removal of outliers and extreme values instances eliminated the effect of noisy data.(iv)
For the ANN algorithm, the removal of outliers and extreme values made the effect of the different levels of noise notably limited. The baseline accuracy of the ANN algorithm is 76.1178%, and the accuracy after the filtering and the injecting of the different levels of noise are 80.4869%, 80.4869%, 80.4869%, and 80.4869%.When ML algorithms were applied on the UNSW-NB15 dataset, after filtering outliers and extreme value instances and injecting noisy data, certain algorithms greatly affected such as DT (J48), RF, and NB:(i)
With DT (J48) algorithm, the accuracy with 5% and 10% noise remained as the baseline, which is 100%. A strong decrease in accuracy occurred when the noise increased to 20% and 30%. In particular, with the 20% noise injection, the classification accuracy dropped to 71.4472%, and with the 30% noise injection, the accuracy of the DT algorithm dropped again to 70.1824%.(ii)
The classification accuracy of the RF algorithm decreased with the increase of noise. The baseline accuracy is 98.4903%, and the accuracy with the different levels of noise are 96.3296%, 96.336%, 92.656%, and 87.6001%.(iii)
Similar to DT, the classification accuracy of the SVM algorithm for 5% and 10% noise levels remained the same as the baseline (100%). However, with the 20% noise injection, the classification accuracy slightly dropped to 99.9841%, and with the 30% noise injection, it dropped to 99.9174%.(iv)
The classification accuracy of the ANN algorithm was oscillated with different levels of noise. The baseline accuracy of the ANN algorithm is 100%. However, it achieved the following accuracy results with the different levels of noise (98.5001%, 99.892%, 99.9682%, and 99.9078%).(v)
With all levels of noise, NB algorithm achieved lower, but very convergent accuracy results. The baseline accuracy was 87.4435%, and the corresponding accuracy with the different levels of noise are 74.285%, 74.2055%, 74.0784%, and 74.0721%.Figure10 shows the impact of injecting different levels of noise to the filtered NLS-KDD dataset and the corresponding accuracy of the ML algorithms. It can be noticed that the removal of outliers and extreme value instances and then the manipulation of the instances’ labels with different noise percentages have made the classification accuracy of the ML algorithms nearly similar except for the RF algorithm with the 20% noise injection and the DT algorithm with the 30% noise injection.Figure 10
The accuracy of ML algorithms after filtering and noise injection (NSL-KDD).Figure11 shows the impact of injecting different levels of noise to the filtered UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. The resilience of the RF algorithm has remained weak to the different levels of noise injection even after the removal of outliers and the extreme value instances.Figure 11
The accuracy of ML algorithms after filtering and noise injection (UNSW-NB15).


### 4.5. Noise Injection Then Filtering Experiment

This set of experiments aims to investigate the influence of noise injection before filtering the dataset from outliers and extreme values. The difference between this set of experiments and the previous set of experiments is the order of dealing with noise. More specifically, the previous set of experiments conducted noise filtering then injection. However, in this set of experiments, noise injection will be conducted before filtering the noisy instances. Table16 shows the accuracy, precision, and recall values of this experiment. Figures 12(a) and 12(b) show the results of filtering the datasets after injecting noise on both NSL-KDD and UNSW-NB15 datasets, respectively.Table 16
The results of running ML algorithms on an injected and then filtered intrusion dataset.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.8745% noise injected then filteringDT (J48)77.90260.8280.7791001.0001.000RF77.82770.7490.77897.0510.9730.971SVM77.67790.7150.7771001.0001.000ANN77.86520.8280.7791001.0001.000NB77.67790.7150.77774.29450.7950.74310% noise injected then filteringDT (J48)73.970.7420.7401001.0001.000RF73.85770.6820.73995.00760.9570.950SVM73.82020.6760.7381001.0001.000ANN74.08240.7790.7411001.0001.000NB73.82020.6760.73874.20550.7950.74220% noise injected then filteringDT (J48)75.24340.7620.75273.3920.8490.734RF66.74160.5890.66791.55650.9290.916SVM67.71540.6200.6771001.0001.000ANN67.64040.5390.6761001.0001.000NB67.71540.6200.67774.07530.7940.74130% noise injected then filteringDT (J48)66.62920.6760.66670.22690.7880.702RF61.9850.5950.62088.68690.9000.887SVM61.72280.5730.61799.98731.0001.000ANN61.79780.6210.61899.80620.9980.998NB61.72280.5730.61774.0880.7940.741Figure 12
The state of the accuracy with noise filtering then injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)For the NSL-KDD dataset, SVM and the NB algorithms achieved results similar to the previous set of experiments, with all levels of noise removal and injection. The detailed analysis is as follows:(i)
The baseline accuracy of the DT algorithm was 81.5339%, whereas it achieved 77.9026%, 73.97%, 75.2434%, and 66.6292 with the different levels of noise. The DT algorithm achieved higher accuracy with the 20% noise injection when compared with the 10% noise injection.(ii)
The classification accuracy of the RF algorithm continuously decreased with the increase of the noise levels.(iii)
The classification accuracies of both SVM and NB algorithms were identical in all different noise levels. This is also identical to the previous set of experiments, which means that the order of noise filtering and injection does not change the impact of the classification accuracy on these ML algorithms.(iv)
ANN algorithm achieved a slight increase in the classification accuracy with the 5% noise injection (+0.1505%) comparing to the baseline. In contrast, there was a continuous degradation in the classification accuracy with the increase in the noise level.For the UNSW-NB15 dataset, the accuracy of ML algorithms is similar to the previous set of experiments. This means that the order of conducting noise filtering and injection does not remarkably affect the classification accuracy. In particular,(i)
DT algorithm maintained the same accuracy result with the 5% and the 10% noise levels. A large degradation in the classification accuracy has occurred with the 20% and the 30% noise levels (−26.608% and −29.7731%, respectively).(ii)
In the RF algorithm, the classification accuracy decreased with the increase in the noise levels.(iii)
Both the SVM and the ANN maintained the same accuracy results across 5%, 10%, and 20%. A small decrease in accuracy occurred with the 30% noise injection. SVM accuracy degraded −0.0127% and ANN accuracy degraded by −0.1938%.(iv)
NB algorithm achieved similar accuracy results across different levels of noise.Figure13 shows the impact of injecting and then filtering noise in the NLS-KDD dataset and the corresponding accuracy of the ML algorithms. The performance of all algorithms degraded with DT showing the highest accuracy with the maximum noise level. Figure 14 shows the impact of filtering and then injecting noise in the UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. DT performance shows the greatest drop among all ML algorithms.Figure 13
The accuracy of ML algorithms after injecting then filtering the noisy instances in the NSL-KDD dataset.Figure 14
The accuracy of ML algorithms after noise injection then filtering on the UNSW-NB15 dataset.


### 4.6. Ensemble of Classifiers Experiment

In this experiment, two ensemble learning classifiers are used, which are bagging and boosting. In this experiment, each ML algorithm will be used as a base classifier with bagging and boosting. The detailed results of this set of experiments are illustrated in Table17. Figures 15(a) and 15(b) show the results of ensemble of classifiers learning applied to both NSL-KDD dataset and UNSW-NB15 dataset, respectively.Table 17
Using ensemble learning (bagging and boosting).
Ensemble learningML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874BaggingDT (J48)83.72520.8700.8371001.0001.000RF80.14990.8500.80199.99761.0001.000SVM75.03110.8000.7501001.0001.000ANN76.09560.8080.7611001.0001.000NB76.29520.8100.76387.29290.8820.873BoostingDT (J48)77.85220.8380.7791001.0001.000RF79.40920.8460.79490.55770.9220.906SVM75.63430.8030.7561001.0001.000ANN77.71470.8170.7771001.0001.000NB73.74470.7990.73799.9490.9990.999Figure 15
The accuracy results after applying the ensemble of classifiers learning method. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)With the NSL-KDD dataset, it can be noticed that none of the ensemble methods caused a remarkable impact. In fact, the accuracy results indicate that the ML algorithms are slightly affected by the ensemble learning methods. In particular,(i)
The baseline accuracy of the DT algorithm was 81.5339% and it achieved a small increase in accuracy with bagging (83.7252%) which represents +2.1913% increase. With boosting, the achieved classification accuracy (77.8522%) represents a decrease by −3.6817%.(ii)
The classification accuracy of the RF algorithm was negatively affected by both ensemble learning methods. In bagging, it achieved 80.1499% classification accuracy, which is a slight decrease of −0.3017%. The classification accuracy with boosting was (79.4092%), which is also a decrease by −1.0424%.(iii)
Ensembled SVM achieved lower accuracy with bagging and higher accuracy with boosting. SVM classification accuracy with bagging is 75.0311% which represents a decrease by −0.3637%. Boosted SVM achieved an accuracy of 75.6343% which is slightly greater than the baseline by +0.2395%.(iv)
Bagged ANN algorithm achieved an accuracy of 76.0956% which is slightly lower than the baseline by −1.6836%. However, boosting yielded the same accuracy of the baseline, which is 77.7147%.(v)
Similar to the DT algorithm, the NB algorithm generated a greater accuracy value with bagging and a lower accuracy value with boosting. With bagging, it achieved 76.2952%, which is slightly greater than the baseline by +0.1774%, and with boosting, it achieved a lower classification accuracy of 73.7447%, which is less than the baseline by −2.3731%.In the UNSW-NB15 dataset, ensemble methods did not remarkably improve the classification accuracy of the ML algorithms, except for the RF and the NB algorithms. The observations of the classification accuracy are as follows:(i)
DT (J48), SVM, and ANN are not affected by bagging and boosting, and the accuracy after applying bagging and boosting remained as the baseline accuracy, which is 100%.(ii)
With the RF algorithm, there is a slight increase in accuracy with bagging (+1.5073%). However, with boosting, the classification accuracy was decreased by −7.9326%.(iii)
With the NB algorithm, there is a slight decrease in accuracy with bagging (−0.1506%). However, there is a large increase in the classification accuracy with boosting (+12.5055%). The accuracy value increased from 87.4435% to 99.949%. The factors that caused the sudden increase of the classification accuracy of the NB algorithm with boosting need to be further investigated. This might pave the way for developing NB-based IDSs for conducting near real-time detection due to the high speed of the NB algorithm [6].


## 4.1. Baseline Experiment

The main objective of this set of experiments is to determine the data that will be used in subsequent experiments and to establish a baseline to compare it with the results of subsequent experiments. Therefore, three baseline experiments are conducted. Each of these baselines will be constructed using the same ML algorithms. However, the only difference is in the method of using the dataset as the following:(i)
Training the model using the training dataset and testing it on a separate testing dataset.(ii)
Each dataset will be divided into three equal parts. Two-thirds will be used for training and one-third will be used for testing. This method is referred to as the percentage split. In this paper, all ML algorithms were trained on the same two-thirds of the datasets and all were tested on the same one-third that was dedicated for testing.(iii)
The entire training data of each dataset will be used for training and testing the constructed models. This will be achieved using an iterative manner called cross-validation, which entails dividing the dataset to a certain number of equal partitions (folds). All of these partitions have the same size. Then, the tests are performed by selecting one of these folds for testing and the remaining folds for training. This is achieved in an iterative manner. In this paper, we have divided the training portion to 10-folds.The results of the first set of experiments are aggregated in Table12 which includes details about the testing mode, the used ML methods, the names of the intrusion datasets, and the evaluation metrics. Figure 4(a) compares the results using different testing modes using the NSL-KDD dataset while Figure 4(b) compares the results using different testing modes using the UNSW-NB15 dataset.Table 12
Constructing the baseline experiments with different testing modes.
Test modeML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecessionRecallSupplied test setDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000Naïve Bayes76.11780.8090.76187.44350.8840.874Percentage splitDT (J48)99.72450.9970.9971001.0001.000RF99.90190.9990.9991001.0001.000SVM97.45740.9750.9751001.0001.000ANN98.60850.9860.9861001.0001.000Naïve Bayes90.59330.9070.90692.13970.9300.921Cross-validationDT (J48)99.78170.9980.9981001.0001.000RF99.91740.9990.9991001.0001.000SVM97.4050.9740.9741001.0001.000ANN98.53780.9850.9851001.0001.000Naïve Bayes90.38290.9050.90492.48090.9320.925Figure 4
The baseline classification accuracy results of the intrusion datasets. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)In the supplied test set, both KDDTrain+ and KDDTest+ from the NSL-KDD were used for training and testing, respectively. On the other hand, the UNSW_NB15_training-set and the UNSW_NB15_testing-set from UNSW-NB15 were used for training and testing, respectively. In percentage split and cross-validation, the KDDTrain+ from NSL-KDD and UNSW_NB15_training-set from UNSW-NB15 were used.With the NSL-KDD dataset, it can be noticed that the test mode highly affects the classification accuracy of the used ML algorithms. However, the observations are illustrated in the following points:(i)
The classification accuracy of the ML algorithms tends to degrade when a supplied test set is used, whereas the accuracy of the other test modes, which are percentage split and cross-validation, is high(ii)
With the supplied test set, DT (J48) achieved the highest accuracy (81.5339%), whereas RF achieved the highest accuracy with the percentage split (99.9019%) and cross-validation (99.9174%)(iii)
The NB scored the lowest accuracy in all test modes, especially with the supplied test mode (76.1178%).The observations from the accuracy results when the UNSW-NB15 dataset is used are as follows:(i)
DT, SVM, and ANN achieved the same accuracy results across all the experiments, which is 100%.(ii)
RF algorithm achieved less accuracy results with the supplied test set (98.4903%) and it achieved (100%) classification accuracy with both percentages split and cross-validation.(iii)
NB algorithm, similarly, achieved higher accuracy results with percentage split and cross-validation, which are 92.1397% and 92.4809%, respectively, whereas it achieved the lowest classification accuracy (87.4435%) with the supplied test set.(iv)
Typically, gaining a 100% accuracy means that the ML algorithm managed to correctly classify all instances within the testing dataset.(v)
Generally, the results seem to support the claim of Moustafa et al. [8], about the inadequacy of using ML algorithms with the UNSW-NB15 dataset. The reasons for this inadequacy are mentioned in Section 3.1.4.Subsequent experiments will be conducted using the supplied test set only rather than splitting a single dataset or cross-validation as this provides a better understanding of different factors that might affect the accuracy of the ML algorithms on the intrusion dataset. For the NSL-KDD dataset, KDDTrain+ and KDDTest+ will be used, to train and test the model, respectively. On the other hand, for the UNSW-NB15, UNSW_NB15_training-set and the UNSW_NB15_testing-set will also be used to train and test the model, respectively.


## 4.2. Noise Filtering Experiment

The second set of experiments includes using noise filtering by removing outliers and extreme values from the training and the testing datasets. The results from this set of experiments are listed in Table13. In addition, the classification accuracy results are compared with the baseline. Figures 5(a) and 5(b) show the results of using the filtered NSL-KDD dataset and the filtered UNSW-NB15 dataset, respectively.Table 13
Results after conducting the noise filtering.
Noise filteringML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874FilteredDT (J48)80.71160.8440.8071001.0001.000RF80.67420.8440.80799.93960.9990.999SVM80.63670.7960.8061001.0001.000ANN80.63670.7960.8061001.0001.000NB80.48690.7460.80575.46080.8000.755Figure 5
The classification accuracy results of the filtered datasets. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)The effects of removing the outliers and extreme instances on the accuracy of the filtered NSL-KDD dataset are as follows:(i)
Removing the outliers and the extreme value instances slightly decreased (−0.8223%) the classification accuracy of the DT (J48) algorithm in comparison with the baseline experiment(ii)
The accuracy of the RF slightly increased (+0.2226%) after removing the outliers and the extreme instances.(iii)
For SVM, ANN, and NB, the removal of outliers and noisy instances has a noticeable positive influence. The classification accuracy of the SVM algorithm increased by +5.2419%, whereas the accuracy of ANN increased by +2.922%, and for the NB, the accuracy increased by +4.3691%.The accuracy values of the UNSW-NB15 dataset after conducting the instance reduction by removing the outliers and extreme value instances are as follows:(i)
For DT (J48), SVM, and ANN, the accuracy values of the filtered dataset remained as the baseline (100%). This means that the removal of the outliers and the extreme value instances did not affect the classification accuracy of these ML algorithms when used with the UNSW-NB15 intrusion dataset.(ii)
The accuracy of the RF algorithm was slightly improved by +1.4493% due to the removal of the outliers and the extreme value instances.(iii)
On the other hand, the accuracy value of the NB algorithm was decreased by −11.9827% as a result of noise filtering. This means the NB algorithm performs better with the presence of the outliers and extreme values in the UNSW-NB15 dataset.


## 4.3. Noise Injection Experiment

The third set of experiments aims to investigate the extent of the effect of noise over the five considered ML algorithms when applying them over the intrusion-related datasets. In this set of experiments, different levels of noise (5%, 10%, 20%, and 30%) are added to each training dataset, and no noise will be injected into the testing dataset. The noise will be injected using WEKA’s AddNoise filter.The noise will be injected solely into the class attribute. This will help to investigate the classification accuracy of the ML algorithms on the testing dataset, knowing that it was trained on a noisy dataset. The results after injecting the different levels of noise are illustrated in Table14. Figures 6(a) and 6(b) show the results of using noise with the NSL-KDD dataset and the UNSW-NB15 dataset, respectively.Table 14
Injecting different levels of noise in the intrusion datasets.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaseline 0% noiseDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.8745% noise injectedDT (J48)80.78870.8510.8081001.0001.000RF79.32040.8440.79394.85380.9540.949SVM76.27310.8280.7631001.0001.000ANN79.22730.8260.79299.99881.0001.000NB74.98670.8050.75077.59920.8050.77610% noise injectedDT (J48)80.79760.8460.8081001.0001.000RF77.21790.8140.77293.98290.9470.940SVM76.23760.8280.7621001.0001.000ANN76.40610.8090.7641001.0001.000NB73.93540.8000.73977.58830.8010.77620% noise injectedDT (J48)79.80840.8260.7981001.0001.000RF72.32080.7770.72388.81480.9080.888SVM78.76150.8480.7881001.0001.000ANN77.43080.8130.77499.99881.0001.000NB71.67760.7910.71777.27130.8000.77330% noise injectedDT (J48)80.10110.8280.80166.94120.7780.669RF70.65740.7500.70784.47990.8710.845SVM78.72160.8470.7871001.0001.000ANN75.29280.8020.75399.98181.0001.000NB74.46770.8010.74577.75110.8010.778Figure 6
The classification accuracy with different levels of noise injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)Noise injection affected the accuracy of the ML algorithms tested on the NSL-KDD dataset. The accuracy of some algorithms decreases with the increase of noise, and the accuracy of certain algorithm increases with the increase of noise. The observations from this set of experiments are as follows:(i)
The accuracy of the DT (J48) algorithm is slightly influenced by the different levels of noise compared to the baseline, which is 81.5339%. DT (J48) achieved better accuracy with 10% noise compared to 5% noise and it also achieved better accuracy with 30% noise in comparison with 20% noise injection.(ii)
The accuracy of the RF algorithm continuously decreased with the increase of noise (79.3204%, 77.2179%, 72.3208%, and 70.6574%), respectively, when compared with the baseline (80.4516%).(iii)
Interestingly, with the SVM algorithm, the increase of noise causes an increase in the classification accuracy when compared with the baseline (75.3948%). With the different levels of noise, the SVM algorithm scored the following accuracy results (76.2731%, 76.2376%, 78.7615%, and 78.7216%). It can be concluded that SVM managed to correctly classify more testing instances, knowing that it was originally trained on a noisy (misclassified) data.(iv)
The baseline accuracy of the ANN algorithm is 77.7147%, and with the different levels of noise, the accuracy of the ANN algorithm varies with a slight increase and decrease compared to the baseline (79.2273%, 76.4061%, 77.4308%, and 75.2928%). The accuracy of the ANN algorithm behaves similar to the DT (J48).(v)
Similar to the RF algorithm, the accuracy of the NB algorithm decreases with the increase of noise when compared with the baseline value (76.1178%), except that, with the 30% noise injection, the classification accuracy increased when compared with 10% and 20% noise injection (74.9867%, 73.9354%, 71.6776%, and 74.4677%).The effect of noise injection on the accuracy of the ML algorithms tested on the UNSW-NB15 dataset can be summarized as follows:(i)
The classification accuracy of the DT (J48) algorithm is not affected by the 5%, 10%, and 20% noise and it remained as the baseline (100%). However, the accuracy was intensely affected when a 30% noise was injected. The DT accuracy recorded 66.9412% classification accuracy. This means that the DT algorithm with the UNSW-NB15 dataset can maintain high classification accuracy until a certain limit where it starts to heavily degrade and cannot be used reliably.(ii)
With the RF algorithm, the classification accuracy continuously decreased with the increase of noise. It can be concluded that RF algorithm is sensitive to noise and it should be trained on a correctly labelled dataset in order to obtain better classification outcomes.(iii)
The classification accuracy of the SVM algorithm was not affected by any level of noise. The classification accuracy remained as the baseline (100%) even after injecting different levels of noise. This means that the SVM algorithm managed to successfully classify all testing instances even though it was trained on a mislabelled dataset. Therefore, it can be considered as the most robust algorithm in this set of experiments.(iv)
The classification accuracy of the ANN algorithm was slightly decreased with the increase in noise. The baseline accuracy of the ANN algorithm is 100%, and the accuracy results after injecting the different levels of noise are 99.9988%, 100%, 99.9988%, and 99.9818. This means that training the ANN algorithm on noisy dataset does not greatly affect the classification accuracy.(v)
The baseline value of the NB algorithm is 87.4435%, and the accuracy results after inserting the different noise levels are 77.5992%, 77.5883%, 77.2713%, and 77.7511%, respectively. This indicates that the effect of different levels of noise on the NB algorithm is almost identical.Figure7 illustrates the impact of injecting different levels of noise in the NLS-KDD dataset and the corresponding accuracy of the ML algorithms. It can be noticed that SVM algorithm is the most resilient algorithm to noise injection whereas the RF algorithm is the least resilient algorithm to noise injection.Figure 7
Noise injection in the NSL-KDD dataset and the accuracy of ML algorithms.Figure8 illustrates the impact of injecting different levels of noise in the UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. The major degradation in the classification accuracy of the DT algorithm with the 30% noise injection is readily apparent in addition to the continuous decrease in the classification accuracy of the RF algorithm with the increase of the percentage of noise ratio.Figure 8
Noise injection in the UNSW-NB15 dataset and the accuracy of ML algorithms.


## 4.4. Noise Filtering Then Injection Experiment

In the fourth set of experiments, noise is filtered by removing outliers and extreme value instances and then noise is injected with different levels (5%, 10%, 20%, and 30%) to the intrusion dataset. The third experiment investigated the effect of noise injection. The current experiment inspects the potential impact of noise injection on filtered intrusion datasets. Table15 shows the results obtained from this set of experiments. Figures 9(a) and 9(b) show the results of injecting noise on the filtered NSL-KDD and UNSW-NB15 datasets, respectively.Table 15
The results of running ML algorithms on a filtered and then injected intrusion dataset.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874Filtered then 5% noise injectedDT (J48)80.67420.8440.8071001.0001.000RF80.48690.7460.80596.32960.9670.963SVM80.48690.7460.8051001.0001.000ANN80.52430.7600.80598.50010.9850.985NB80.48690.7460.80574.2850.7950.743Filtered then 10% noise injectedDT (J48)80.67420.8440.8071001.0001.000RF80.29960.7210.80396.3360.9670.963SVM80.48690.7460.8051001.0001.000ANN80.63670.7960.80699.8920.9990.999NB80.48690.7460.80574.20550.7950.742Filtered then 20% noise injectedDT (J48)80.56180.8430.80671.44720.8150.714RF81.27340.7770.81392.6560.9380.927SVM80.48690.7460.80599.98411.0001.000ANN80.63670.7960.80699.96821.0001.000NB80.48690.7460.80574.07840.7940.741Filtered then 30% noise injectedDT (J48)78.57680.6620.78670.18240.7970.702RF80.97380.8040.81087.60010.8970.876SVM80.48690.7460.80599.91740.9990.999ANN80.71160.7660.80799.90780.9990.999NB80.48690.7460.80574.07210.7940.741Figure 9
The ML algorithms’ accuracy after noise filtering and injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)In general, removing outliers and extreme value instances appeared to have a positive influence on certain ML algorithms. Here is the analysis of the accuracy results for the NSL-KDD dataset:(i)
The DT (J48) was slightly impacted by noise when applied on a filtered dataset. The baseline accuracy was 81.5339%, and the accuracy results after injecting the different levels of noise are 80.6742%, 80.6742%, 80.5618%, and 78.5768%. The DT (J48) gave the same accuracy results with the 5% and the 10% noise injection.(ii)
The accuracy results from the third set of experiments illustrate that the accuracy of the RF algorithm has decreased with the increase of noise. In the current experiments, it seems that the RF algorithm achieved better accuracy results. The baseline accuracy of the RF algorithm is 80.4516%, and the accuracy results after filtering the dataset and injecting different levels of noise are 80.4869%, 80.2996%, 81.2734%, and 80.9738%. Therefore, it is obvious that removing outliers and extreme value instances has a positive influence on the RF algorithm when used with a noisy NSL-KDD dataset.(iii)
The accuracy of the SVM and NB algorithms with all different levels of noise injection remained exactly the same (80.4869%), whereas the accuracy of the baseline was 75.3948% and 76.1178% for SVM and NB, respectively. This means that the removal of outliers and extreme values instances eliminated the effect of noisy data.(iv)
For the ANN algorithm, the removal of outliers and extreme values made the effect of the different levels of noise notably limited. The baseline accuracy of the ANN algorithm is 76.1178%, and the accuracy after the filtering and the injecting of the different levels of noise are 80.4869%, 80.4869%, 80.4869%, and 80.4869%.When ML algorithms were applied on the UNSW-NB15 dataset, after filtering outliers and extreme value instances and injecting noisy data, certain algorithms greatly affected such as DT (J48), RF, and NB:(i)
With DT (J48) algorithm, the accuracy with 5% and 10% noise remained as the baseline, which is 100%. A strong decrease in accuracy occurred when the noise increased to 20% and 30%. In particular, with the 20% noise injection, the classification accuracy dropped to 71.4472%, and with the 30% noise injection, the accuracy of the DT algorithm dropped again to 70.1824%.(ii)
The classification accuracy of the RF algorithm decreased with the increase of noise. The baseline accuracy is 98.4903%, and the accuracy with the different levels of noise are 96.3296%, 96.336%, 92.656%, and 87.6001%.(iii)
Similar to DT, the classification accuracy of the SVM algorithm for 5% and 10% noise levels remained the same as the baseline (100%). However, with the 20% noise injection, the classification accuracy slightly dropped to 99.9841%, and with the 30% noise injection, it dropped to 99.9174%.(iv)
The classification accuracy of the ANN algorithm was oscillated with different levels of noise. The baseline accuracy of the ANN algorithm is 100%. However, it achieved the following accuracy results with the different levels of noise (98.5001%, 99.892%, 99.9682%, and 99.9078%).(v)
With all levels of noise, NB algorithm achieved lower, but very convergent accuracy results. The baseline accuracy was 87.4435%, and the corresponding accuracy with the different levels of noise are 74.285%, 74.2055%, 74.0784%, and 74.0721%.Figure10 shows the impact of injecting different levels of noise to the filtered NLS-KDD dataset and the corresponding accuracy of the ML algorithms. It can be noticed that the removal of outliers and extreme value instances and then the manipulation of the instances’ labels with different noise percentages have made the classification accuracy of the ML algorithms nearly similar except for the RF algorithm with the 20% noise injection and the DT algorithm with the 30% noise injection.Figure 10
The accuracy of ML algorithms after filtering and noise injection (NSL-KDD).Figure11 shows the impact of injecting different levels of noise to the filtered UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. The resilience of the RF algorithm has remained weak to the different levels of noise injection even after the removal of outliers and the extreme value instances.Figure 11
The accuracy of ML algorithms after filtering and noise injection (UNSW-NB15).


## 4.5. Noise Injection Then Filtering Experiment

This set of experiments aims to investigate the influence of noise injection before filtering the dataset from outliers and extreme values. The difference between this set of experiments and the previous set of experiments is the order of dealing with noise. More specifically, the previous set of experiments conducted noise filtering then injection. However, in this set of experiments, noise injection will be conducted before filtering the noisy instances. Table16 shows the accuracy, precision, and recall values of this experiment. Figures 12(a) and 12(b) show the results of filtering the datasets after injecting noise on both NSL-KDD and UNSW-NB15 datasets, respectively.Table 16
The results of running ML algorithms on an injected and then filtered intrusion dataset.
Noise (%)ML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.8745% noise injected then filteringDT (J48)77.90260.8280.7791001.0001.000RF77.82770.7490.77897.0510.9730.971SVM77.67790.7150.7771001.0001.000ANN77.86520.8280.7791001.0001.000NB77.67790.7150.77774.29450.7950.74310% noise injected then filteringDT (J48)73.970.7420.7401001.0001.000RF73.85770.6820.73995.00760.9570.950SVM73.82020.6760.7381001.0001.000ANN74.08240.7790.7411001.0001.000NB73.82020.6760.73874.20550.7950.74220% noise injected then filteringDT (J48)75.24340.7620.75273.3920.8490.734RF66.74160.5890.66791.55650.9290.916SVM67.71540.6200.6771001.0001.000ANN67.64040.5390.6761001.0001.000NB67.71540.6200.67774.07530.7940.74130% noise injected then filteringDT (J48)66.62920.6760.66670.22690.7880.702RF61.9850.5950.62088.68690.9000.887SVM61.72280.5730.61799.98731.0001.000ANN61.79780.6210.61899.80620.9980.998NB61.72280.5730.61774.0880.7940.741Figure 12
The state of the accuracy with noise filtering then injection. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)For the NSL-KDD dataset, SVM and the NB algorithms achieved results similar to the previous set of experiments, with all levels of noise removal and injection. The detailed analysis is as follows:(i)
The baseline accuracy of the DT algorithm was 81.5339%, whereas it achieved 77.9026%, 73.97%, 75.2434%, and 66.6292 with the different levels of noise. The DT algorithm achieved higher accuracy with the 20% noise injection when compared with the 10% noise injection.(ii)
The classification accuracy of the RF algorithm continuously decreased with the increase of the noise levels.(iii)
The classification accuracies of both SVM and NB algorithms were identical in all different noise levels. This is also identical to the previous set of experiments, which means that the order of noise filtering and injection does not change the impact of the classification accuracy on these ML algorithms.(iv)
ANN algorithm achieved a slight increase in the classification accuracy with the 5% noise injection (+0.1505%) comparing to the baseline. In contrast, there was a continuous degradation in the classification accuracy with the increase in the noise level.For the UNSW-NB15 dataset, the accuracy of ML algorithms is similar to the previous set of experiments. This means that the order of conducting noise filtering and injection does not remarkably affect the classification accuracy. In particular,(i)
DT algorithm maintained the same accuracy result with the 5% and the 10% noise levels. A large degradation in the classification accuracy has occurred with the 20% and the 30% noise levels (−26.608% and −29.7731%, respectively).(ii)
In the RF algorithm, the classification accuracy decreased with the increase in the noise levels.(iii)
Both the SVM and the ANN maintained the same accuracy results across 5%, 10%, and 20%. A small decrease in accuracy occurred with the 30% noise injection. SVM accuracy degraded −0.0127% and ANN accuracy degraded by −0.1938%.(iv)
NB algorithm achieved similar accuracy results across different levels of noise.Figure13 shows the impact of injecting and then filtering noise in the NLS-KDD dataset and the corresponding accuracy of the ML algorithms. The performance of all algorithms degraded with DT showing the highest accuracy with the maximum noise level. Figure 14 shows the impact of filtering and then injecting noise in the UNSW-NB15 dataset and the corresponding accuracy of the ML algorithms. DT performance shows the greatest drop among all ML algorithms.Figure 13
The accuracy of ML algorithms after injecting then filtering the noisy instances in the NSL-KDD dataset.Figure 14
The accuracy of ML algorithms after noise injection then filtering on the UNSW-NB15 dataset.


## 4.6. Ensemble of Classifiers Experiment

In this experiment, two ensemble learning classifiers are used, which are bagging and boosting. In this experiment, each ML algorithm will be used as a base classifier with bagging and boosting. The detailed results of this set of experiments are illustrated in Table17. Figures 15(a) and 15(b) show the results of ensemble of classifiers learning applied to both NSL-KDD dataset and UNSW-NB15 dataset, respectively.Table 17
Using ensemble learning (bagging and boosting).
Ensemble learningML algorithmNSL-KDDUNSW-NB15AccuracyPrecisionRecallAccuracyPrecisionRecallBaselineDT (J48)81.53390.8580.8151001.0001.000RF80.45160.8520.80598.49030.9850.985SVM75.39480.8020.7541001.0001.000ANN77.71470.8170.7771001.0001.000NB76.11780.8090.76187.44350.8840.874BaggingDT (J48)83.72520.8700.8371001.0001.000RF80.14990.8500.80199.99761.0001.000SVM75.03110.8000.7501001.0001.000ANN76.09560.8080.7611001.0001.000NB76.29520.8100.76387.29290.8820.873BoostingDT (J48)77.85220.8380.7791001.0001.000RF79.40920.8460.79490.55770.9220.906SVM75.63430.8030.7561001.0001.000ANN77.71470.8170.7771001.0001.000NB73.74470.7990.73799.9490.9990.999Figure 15
The accuracy results after applying the ensemble of classifiers learning method. (a) NSL-KDD. (b) UNSW-NB15.
(a)(b)With the NSL-KDD dataset, it can be noticed that none of the ensemble methods caused a remarkable impact. In fact, the accuracy results indicate that the ML algorithms are slightly affected by the ensemble learning methods. In particular,(i)
The baseline accuracy of the DT algorithm was 81.5339% and it achieved a small increase in accuracy with bagging (83.7252%) which represents +2.1913% increase. With boosting, the achieved classification accuracy (77.8522%) represents a decrease by −3.6817%.(ii)
The classification accuracy of the RF algorithm was negatively affected by both ensemble learning methods. In bagging, it achieved 80.1499% classification accuracy, which is a slight decrease of −0.3017%. The classification accuracy with boosting was (79.4092%), which is also a decrease by −1.0424%.(iii)
Ensembled SVM achieved lower accuracy with bagging and higher accuracy with boosting. SVM classification accuracy with bagging is 75.0311% which represents a decrease by −0.3637%. Boosted SVM achieved an accuracy of 75.6343% which is slightly greater than the baseline by +0.2395%.(iv)
Bagged ANN algorithm achieved an accuracy of 76.0956% which is slightly lower than the baseline by −1.6836%. However, boosting yielded the same accuracy of the baseline, which is 77.7147%.(v)
Similar to the DT algorithm, the NB algorithm generated a greater accuracy value with bagging and a lower accuracy value with boosting. With bagging, it achieved 76.2952%, which is slightly greater than the baseline by +0.1774%, and with boosting, it achieved a lower classification accuracy of 73.7447%, which is less than the baseline by −2.3731%.In the UNSW-NB15 dataset, ensemble methods did not remarkably improve the classification accuracy of the ML algorithms, except for the RF and the NB algorithms. The observations of the classification accuracy are as follows:(i)
DT (J48), SVM, and ANN are not affected by bagging and boosting, and the accuracy after applying bagging and boosting remained as the baseline accuracy, which is 100%.(ii)
With the RF algorithm, there is a slight increase in accuracy with bagging (+1.5073%). However, with boosting, the classification accuracy was decreased by −7.9326%.(iii)
With the NB algorithm, there is a slight decrease in accuracy with bagging (−0.1506%). However, there is a large increase in the classification accuracy with boosting (+12.5055%). The accuracy value increased from 87.4435% to 99.949%. The factors that caused the sudden increase of the classification accuracy of the NB algorithm with boosting need to be further investigated. This might pave the way for developing NB-based IDSs for conducting near real-time detection due to the high speed of the NB algorithm [6].


## 5. Conclusion and Future Work

Optimizing IDS capabilities is becoming an essential requirement due to the continuous increase of cyber threats and attacks. ML-based IDSs represent one of the emerging paradigms that can be used to confront misuse and anomaly attacks. However, the classification accuracy of the ML-based IDSs is prone to several factors. Determining these factors helps to build better ML-based IDSs.The results from the empirical experiments of this paper illustrate that the classification accuracy of the ML-based IDSs can be influenced by certain factors. These factors are the method of using the dataset for training and testing, the removal of outliers and extreme value instances, the injection of mislabelled instances, and the use of ensemble learning techniques. These factors have a diverse impact on the classification accuracy. In certain cases, these factors cause a negative impact on the classification accuracy such as the effect of noise on the accuracy of the RF algorithm. On the other hand, some of these factors caused a massive improvement of the classification accuracy such as the NB algorithm with boosting when applied on the UNSW-NB15 dataset, and in other situations, these factors did not affect the accuracy of the ML-based IDSs.This work can be expanded in several ways. First, algorithms for noise filtering and instance reduction such as the Decremental Reduction Optimization Procedures DROP3 and DROP5 can be used, rather than using the built-in noise filtering functions of WEKA. Other datasets such as ADFA, CIC-IDS 2017, or CIC-DDoS 2019 can also be tested. The work can also be expanded by employing the fine-tuned NB algorithm [40] which improved NB performance by finding a better estimation of NB’s probability terms, which makes the algorithm less stable and more suitable for building a bag of ensembles of classifiers [41]. Investigating the efficacy of these methods for the evaluation of the effect of noise using intrusion detection datasets is an interesting future research. Feature selection can also be included in future work. The impact of including or removing different features can be studied empirically, which might represent an important factor that can optimize the classification accuracy of the ML-based IDSs.



---

*Source: 8836057-2021-01-15.xml*