Intrusion detection feature selection method based on improved grey wolf optimization algorithm
By introducing Cauchy mutation and Levy flight perturbation into the gray wolf optimization algorithm, the problem of low detection efficiency and local optimality of high-dimensional data in the intrusion detection system is solved, and higher detection accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202210321742.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-03-25
AI Technical Summary
Existing intrusion detection systems have low detection efficiency due to high-dimensional network traffic data, and the gray wolf optimization algorithm is prone to falling into local optima, affecting feature subset selection and detection accuracy.
The gray wolf optimization algorithm, which combines Cauchy mutation and Levy flight, improves the global search ability by perturbing the wolf pack, jumps out of the local optimum, selects the best feature subset, and uses kNN technology for feature selection and detection.
It improves the accuracy and efficiency of intrusion detection, reduces the number of feature subsets, and improves the speed and accuracy of network defense.
Smart Images

Figure CN114897124B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a grey wolf optimization algorithm and kNN and other related technologies for classification and identification, belonging to a method for seeking an optimal feature subset in an intrusion detection system. Background Art
[0002] In an era of increasing network security risks, there are more and more security protection methods. Among them, intrusion detection technology has become one of the safest and most commonly used protection measures recognized by the industry because it can effectively detect known and unknown attacks and has the ability to identify and warn. Although intrusion detection systems have various classifications according to different classification standards, most of them have problems such as low detection efficiency. As the amount of network traffic data grows exponentially, the frequency and complexity of intrusions by network attackers are also increasing, making it difficult to accurately detect attacks or anomalies in high-dimensional network traffic, and the time cost also increases exponentially with the increase in data volume. After analyzing the network traffic data, it is found that although there are many data features in network traffic, there are also many redundant and invalid features. Eliminating redundant features and reducing the dimensionality of high-dimensional network traffic can effectively reduce time costs and increase accuracy.
[0003] Feature selection is the best way to reduce the dimensionality of high-dimensional traffic data. It selects the most representative and valuable feature subsets from the features to achieve dimensionality reduction. Feature selection algorithms can be divided into three categories: filtering, wrapping, and embedded. The filtering method is to first select features and then train the classifier. In the process of selecting feature subsets, no algorithm is involved; while the wrapping method is to add various intelligent algorithms when selecting feature subsets, and find the optimal set of feature subsets from the solution space composed of all features. The wrapping algorithm is also the most widely studied feature selection algorithm; the embedded method is to mix the two and regard the feature selection process as a link in training the classifier.
[0004] As the top predator in nature, gray wolves like to live in groups and have a strict social hierarchy. Therefore, in a group of gray wolves, the strongest and highest-ranking leader wolves can be clearly distinguished. The gray wolf optimization algorithm imitates the group hunting behavior pattern of gray wolves and improves it to surround prey, that is, the optimal fitness. Each wolf represents a feature subset solution. This algorithm has strong convergence and is easy to implement because it involves fewer parameters, but it also has the problem of being prone to local optimality. The feature selection based on the gray wolf optimization algorithm is a parcel feature selection type. When searching for the optimal feature subset in the solution space, the gray wolf optimization algorithm is used to search nearby with several groups of feature subsets as the base point, and finally the optimal feature subset is obtained, which realizes the dimensionality reduction of high-dimensional traffic data, reduces costs, improves the accuracy of intrusion detection, and realizes a rapid improvement in network defense efficiency. Summary of the invention
[0005] The present invention aims to reduce the problems of low accuracy and slow speed of the final intrusion detection results caused by factors such as a large number of data features and the existence of redundant features during the intrusion detection process. Traditional intrusion detection relies on existing technologies to detect traffic data, etc., and uses the gray wolf optimization algorithm to select feature subsets for complex data features. However, the algorithm currently has the problem of falling into local optimality, which affects the selection of the best feature subset and the final accuracy. The present invention proposes an intrusion detection feature selection technology that combines the gray wolf optimization algorithm with Cauchy mutation and Levy flight, which uses Cauchy mutation and Levy flight to disturb the wolf pack, jump out of the local optimality, improve the ability of global search, and then obtain the best feature subset, thereby improving the accuracy of intrusion detection.
[0006] The object of the present invention is achieved in this way, and the specific steps are as follows:
[0007] Step 1: Take 80% of the KDD Cup 99 dataset as the training set and 20% as the test set. The intrusion detection classification technology selects the kNN technology, and k is 5. k represents the K nearest neighbors, and each sample can be represented by its closest K neighboring values.
[0008] Step 2: Set the parameters of the improved gray wolf algorithm. The number of wolves N is 30, the maximum number of iterations T is 50, the population is initialized, the vector X represents the current position of the gray wolf, the dimension is the number of features of the selected data set 41, and the first generation of gray wolf population is initialized.
[0009] Step 3: Convert all gray wolf population positions into binary, with 0.5 as the boundary. In each dimension, if it exceeds 0.5, it is set to 1, indicating that the feature represented by the dimension is selected; otherwise, it is set to 0, indicating that the feature represented by the dimension is not selected.
[0010] Step 4: Substitute the obtained binary gray wolf population vector group and the corresponding feature selection scheme into the kNN training set to select the corresponding feature data.
[0011] Step 5: Train the feature data obtained in step 4 to get the accuracy Wherein, TP represents the number of correct detections, FP represents the number of false detections, and the error rate error = 1-Accuracy.
[0012] Step 6: Calculate the fitness of this feature subset Among them, a and b represent weights, a is usually 0.99, b is usually 0.01, m represents the number of features in this feature subset, and n represents all feature subsets. The calculation of this formula is used as the fitness value because in the process of feature selection, both accuracy and feature subset length need to be considered.
[0013] Step 7: After calculating the fitness values of each feature subset solution in step 6, sort them, and set the three smallest values as the three leading wolves α, β, and γ. Among these three wolves, α represents the alpha wolf, that is, the wolf with the best fitness, which belongs to the current best feature subset in this process; β wolf is the second best wolf in fitness, obeys the alpha wolf, and belongs to the current second best feature subset; γ wolf is the third best wolf, obeys α and β wolves, and belongs to the current third best feature subset.
[0014] Step 8: Generate a random number in [0,1) to determine the perturbation strategy of wolves α, β, and γ. With 0.5 as the bound, if the random number is in the range of [0,0.5], execute step 8.1, otherwise, execute step 8.2.
[0015] Step 8.1: Perform Cauchy mutation perturbations on α, β, and γ in turn to obtain new positions
[0016] Step 8.2: Perform Cauchy mutation perturbations on α, β, and γ in turn to obtain new positions in and w represents a random number that follows a standard normal distribution, where Γ(x)=(x-1)!.
[0017] Step 8.3: Calculate the corresponding fitness value based on the results obtained in step 8.1 or 8.2, and save the positions and fitness values of the first three wolves to be updated.
[0018] Step 9: The model of the gray wolf surrounding the prey is X(t+1)=X p (t)-A°D, where X p (t) represents the position vector of the current generation of prey, where the prey refers to the position of the first three wolves, A is the convergence factor, C is the swing factor, and D is the distance between wolves. A = 2α°r1-α, C = 2r2, and D = C°X p (t)-X(t), ° represents the Hadamard product, and α decreases nonlinearly from 2 to 0 during the entire iteration process. r1 and r2 are random vectors in [0, 1].
[0019] Step 10: In each iteration, keep the best three gray wolves in the current population and calculate the positions of the candidate wolves. Use the following formula to get the position of the next generation of gray wolf population. α =|C1°X α (t)-X(t)|,D β =|C2°X β (t)-X(t)|,D γ =|C3°X γ(t)-X(t)|,X1=X α -A1°D α 、X2=X β -A2°D β 、X3=X γ -A3°D β , Where X α , X β and X γ They represent the three best wolves in the current population, D α , D β and D γ Respectively represent the distance between the current candidate gray wolf and the best three wolves.
[0020] Step 11: Perform Cauchy mutation perturbation on all gray wolves.
[0021] Step 12: Repeat steps 3 to 12 until the maximum number of iterations is reached.
[0022] Step 13: During the kNN test, use the best feature subset to extract the test set data for detection analysis.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] When initializing the gray wolf population, Logistic chaotic mapping is used to improve the quality of the initial gray wolf population and the algorithm's mining ability. When the gray wolf population is updated, perturbations are performed to make up for the shortcomings of falling into local optimality to a certain extent and improve the global search ability. Finally, the best feature subset with a small number of features is trained, and after being brought into the test set, the detection accuracy obtained is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the method flow of the present invention; DETAILED DESCRIPTION
[0026] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0027] Figure 1 The figure is a flow chart of an intrusion detection feature selection method based on the gray wolf optimization algorithm of Cauchy mutation according to the present invention. The specific implementation steps of the method include:
[0028] 1. Randomly extract data from KDD Cup 99, 80% of which is used as the training set and 20% as the test set.
[0029] 2. Set all parameters used by the gray wolf optimization algorithm and initialize the gray wolf population using Logisitic chaos mapping.
[0030] 3. Bring the feature selection scheme corresponding to the initial gray wolf population into the kNN model, extract features from the training set and train it to obtain the specific accuracy And error rate error = 1-Accuracy, combined with the number of features contained in the feature subset, through Calculate the fitness value of each solution and sort them to get the top three best wolves as α, β, and γ wolves.
[0031] 4. Perform Levy flight on these three wolves or Cauchy variation Perturb, calculate its fitness value after perturbation, compare, and save the best result.
[0032] 5. Use the disturbed α, β, and γ wolves to update the positions of all gray wolves.
[0033] 6. Perform Cauchy mutation perturbation on the current gray wolf population to obtain the next generation of gray wolf population.
[0034] 7. Calculate the fitness value of the population Calculate and update the positions of the first three wolves.
[0035] 8. Determine whether the maximum number of iterations has been reached. If not, return to step 4 and perform each step in sequence. Repeat this cycle until the maximum number of iterations is reached and then exit the loop to complete the search for the best feature subset.
[0036] 9. Based on the best feature subset obtained above, feature extraction is performed on the data in the KDD Cup99 test set, and kNN is used for detection to obtain the test accuracy.
Claims
1. A method for intrusion detection feature selection based on improved grey wolf optimization algorithm, characterized in that: The steps include: Step 1: Take 80% of the KDD Cup99 dataset as the training set and 20% as the test set; select the kNN technology for intrusion detection classification technology, k is 5; k represents the K nearest neighbors, and each sample can be represented by its closest K neighboring values; Step 2: Set the parameters of the improved gray wolf algorithm; the number of wolves N is 30, the maximum number of iterations T is 50, initialize the population, use vector X to represent the current position of the gray wolf, the dimension is the number of features of the selected data set 41, and initialize the first generation of gray wolf population; Step 3: Convert all gray wolf population positions into binary, with 0.5 as the boundary. In each dimension, if it exceeds 0.5, it is set to 1, indicating that the feature represented by the dimension is selected; otherwise, it is set to 0, indicating that the feature represented by the dimension is not selected; Step 4: Substitute the obtained binary gray wolf population vector group and the corresponding feature selection scheme into the kNN training set to select the corresponding feature data; Step 5: Train the feature data obtained in step 4 to get the accuracy Where TP represents the number of correct detections, FP represents the number of false detections, and error rate error = 1-Accuracy; Step 6: Calculate the fitness of this feature subset Among them, a and b represent weights, a is usually 0.99, b is usually 0.01, m represents the number of features in this feature subset, and n represents all feature subsets. The calculation of this formula is used as the fitness value because in the process of feature selection, both accuracy and feature subset length need to be considered; Step 7: After calculating the fitness values of each feature subset solution in step 6, sort them, and set the three smallest values as the three leading wolves α, β, and γ; among these three wolves, α represents the alpha wolf, that is, the wolf with the best fitness, which belongs to the current best feature subset in this process; β wolf is the second best wolf in fitness, obeys the alpha wolf, and belongs to the current second best feature subset; γ wolf is the third best wolf, obeys α and β wolves, and belongs to the current third best feature subset; Step 8: Generate a random number in [0, 1) to determine the perturbation strategy of wolves α, β, and γ; with 0.5 as the bound, if the random number is in the range of [0, 0.5], execute step 8.1, otherwise, execute step 8.2; Step 8.1: Perform Cauchy mutation perturbations on α, β, and γ in turn to obtain new positions Step 8.2: Perform Cauchy mutation perturbations on α, β, and γ in turn to obtain new positions in u=w*σ, v and w represent a random number that follows a standard normal distribution. where Γ(x)=(x-1)!; Step 8.3: Calculate the corresponding fitness value according to the result obtained in step 8.1 or 8.2, and save the positions and fitness values of the first three wolves to be updated; Step 9: The model of the gray wolf surrounding its prey is Where X p (t) represents the position vector of the current generation of prey. The prey refers to the position of the first three wolves. A is the convergence factor, C is the swing factor, and D represents the distance between wolves. C = 2r2, represents the Hadamard product. During the entire iteration process, α decreases nonlinearly from 2 to 0. r1 and r2 are random vectors in [0, 1]; Step 10: In each iteration, keep the best three gray wolves in the current population and calculate the positions of the candidate wolves; use the following formula to get the position of the next generation of gray wolf population; Where X α , X β and X γ They represent the three best wolves in the current population, D α , D β and D γ Respectively represent the distance between the current candidate gray wolf and the best three wolves; Step 11: Perform Cauchy mutation perturbation on all gray wolves. Step 12: Repeat steps 3 to 12 until the maximum number of iterations is reached; Step 13: During the kNN test, use the best feature subset to extract the test set data for detection analysis.
Citation Information
Patent Citations
A modified particle swarm intelligent optimization method for solving high-dimensional optimization problems of large oil and gas production systems
AU2020103709A4
Feature selection method of grey wolf optimization algorithm based on fused random black hole strategy
CN110880031A
