Intrusion detection method based on improved sparrow algorithm to optimize SVM parameters

By introducing Levy flight, simulated annealing, sine and cosine algorithms and improvement factors into the sparrow search algorithm, the parameters of the SVM classifier are optimized, which solves the problems of high false positive and false negative rate and insufficient accuracy of the intrusion detection system, and achieves a more efficient Classification effect and stable convergence.

CN114881192BActive Publication Date: 2024-10-18HARBIN ENG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210306812.3
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

Technical Problem

Traditional intrusion detection systems based on machine learning have high false positive and false negative rates and insufficient accuracy in unknown attacks and large traffic environments. Moreover, the Sparrow search algorithm is prone to falling into local optimality, unstable convergence, and high randomness in initial values.

Method used

On the basis of the Sparrow search algorithm, Levy flight, simulated annealing, sine and cosine algorithms and improvement factors are introduced to optimize the Sparrow algorithm to improve its performance, make it jump out of the local optimum and converge stably, which is used for parameter optimization of the SVM classifier.

Benefits of technology

It effectively reduces the false positive and false negative rate of the intrusion detection system, improves classification accuracy, avoids local extreme value traps, and achieves more stable convergence and better parameter optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114881192B_ABST
    Figure CN114881192B_ABST
Patent Text Reader

Abstract

The present invention provides an intrusion detection method based on an improved sparrow algorithm to optimize SVM parameters. On the basis of the sparrow algorithm, four improvement methods based on Levy flight, simulated annealing, improvement factor, and sine-cosine algorithm are proposed, thereby improving the performance of the sparrow algorithm, making it jump out of the local optimum and converge stably. In the update process of the finder of the sparrow search algorithm of the present invention, the sine-cosine algorithm and the improvement factor are added to reduce the possibility of falling into the local extreme value, avoiding the phenomenon of the finder and the entire group stagnating; in the update process of the joiner, the simulated annealing algorithm and Levy flight are added to improve the global and local optimization capabilities, thereby providing better parameters for the SVM, achieving better classification effects, and solving the problem of insufficient accuracy of the intrusion detection system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to optimization methods such as SSA, Levy flight, simulated annealing algorithm, sine-cosine algorithm and other optimization methods in group intelligence algorithms, and related technologies such as SVM classifier, and belongs to the problem of intrusion detection classification. Background Art

[0002] With the increasingly complex network structure, network attack behaviors are becoming more diverse. Therefore, intrusion detection systems that can detect huge amounts of traffic data and attack characteristics have become a research hotspot in today's society. In recent years, the application of machine learning algorithms in intrusion detection has made good progress, but due to the large influence of its initial parameters, it is impossible to build an efficient model. Machine learning that integrates swarm intelligence algorithms can summarize nonlinear optimization problems into extremely simple biological survival problems, and can be widely used in intrusion detection systems with huge traffic data and complex network structures.

[0003] The core content of the intrusion detection system is efficient and accurate attack classification. Its key component is the classifier, and the performance of the classifier depends largely on the selection of initial parameters. Applying the swarm intelligence algorithm to the parameter optimization of the classifier can greatly improve the performance of the intrusion detection system. SVM is a classification model in the traditional machine learning algorithm. Its model definition is a linear classifier with the largest interval in the feature space. It has strong robustness, is usually insensitive to dimension, and is suitable for small sample data learning. Compared with other traditional machine learning algorithms, it has strong generalization ability and is suitable for intrusion detection systems.

[0004] The sparrow search algorithm is a new type of optimization algorithm, which mainly simulates the behavioral characteristics of sparrow predation and anti-predation for mathematical modeling. The sparrow search algorithm has the advantages of few control parameters, high solution accuracy, and easy combination with other algorithms. Compared with most swarm intelligence algorithms and heuristic algorithms, the sparrow search algorithm has certain advantages in optimizing most problems, but it still has problems such as low convergence accuracy and difficulty in escaping local extreme values. For this reason, methods based on Levy flight, simulated annealing algorithm, sine-cosine algorithm and improvement factor are proposed to optimize the sparrow algorithm, so as to provide better parameters for SVM to accurately and efficiently classify, thereby solving the accuracy problem of intrusion detection.

[0005] Purpose of the Invention

[0006] The present invention is to solve the problems of high false alarm and missed alarm rate and insufficient accuracy of intrusion detection system. The traditional intrusion detection system based on machine learning cannot adapt well to unknown attacks and huge traffic impacts. If the group intelligence algorithm is directly used for parameter optimization, there are generally shortcomings such as easy to fall into local optimum, unstable convergence, and large randomness of initial values. In response to this problem, this patent proposes an SVM classification algorithm based on the improved sparrow algorithm. Specifically, based on the sparrow algorithm, four improvement methods based on Levy flight, simulated annealing, improvement factor, and sine-cosine algorithm are proposed to improve the performance of the sparrow algorithm, so that it can jump out of the local optimum and converge stably.

[0007] The object of the present invention is achieved in this way, and the specific steps are as follows:

[0008] Step 1: Extract data from the authoritative intrusion detection database KDDCUP to form a data set, and divide the data set into a training set (x_train, y_train) and a test set (x_test, y_test) with a ratio of 7:3. Random division is used to eliminate contingency as much as possible to prevent data overfitting.

[0009] Step 2: Initialize the sparrow population parameters, set the warning value ST, the proportion of discoverers PD, the proportion of sparrows with danger awareness SD, the upper and lower boundaries ub, lb, the number of iterations Max, and the population number N and other parameters.

[0010] Step 3: Initialize the population according to step 2, and for each individual X in the population, X=r*(ub-lb)+lb is randomly distributed, and r is a random number between [0,1].

[0011] Step 4: Calculate the fitness of the individuals in the population in step 3, where the fitness value is obtained based on the classification effect (accuracy) of the SVM, which is fitness = 2-train_acc (training set accuracy)-test_acc (test accuracy).

[0012] Step 5: Sort the fitness values ​​of the sparrows in step 4, and sort the population according to their ranking, find the best individual and the worst individual, and select the initial optimal solution GbestScore and the corresponding position GbestPosition.

[0013] Step 6: Iterate the sparrow population initialized in step 5 to select the global optimal solution and corresponding position.

[0014] Step 6.1: Select some sparrows with better fitness values ​​as discoverers, introduce the sine-cosine algorithm and the improvement factor w. When R2<the warning value ST, use the improvement factor and sine fusion to find a new batch of discoverers Xnew=w*X+r11*sin(r2)*|r3*GbestPositon-X|; otherwise, mix the cosine and the improvement factor to update the discoverer population Xnew=w*X+r11*cos(r2)*|r3*GbestPositon-X|, where r2, r3 are random numbers between [0.2π], t is the current iteration number.

[0015] Step 6.2: The remaining sparrows act as followers and perform joiner update. Based on the sparrow algorithm, P is added using the idea of ​​simulated annealing. A larger value T (here 8000) is introduced. If the fitness value is poor, the algorithm is the same as the original algorithm and remains unchanged; otherwise, (BestF is the fitness value of the best individual), and optimize the sigmoid function to determine its positive or negative, inx is a positive number on the contrary,

[0016] Determine the size of the random number epsilon∈[0,1] and P. If it is greater than or equal to P, the fitness value is poor and it is necessary to leave the area; otherwise, Levy flight is performed. Where R is 1.5, r is a random number between [0,1], and F(x) = (x-1)!

[0017] Step 6.3: The sparrow responsible for alerting performs danger update: When the current fitness value is greater than BestF, Xnew = Xbest + b|X-Xbest|; when it is equal to, Xbest represents the global optimal position, Xw represents the worst position, fi and fw represent the current best fitness value and the worst fitness value respectively, λ is the minimum constant, b is the step size, which is a random number with a mean of 0 and a variance of 1 in the normal distribution, and k is a uniform random number between [-1,1].

[0018] Step 6.4: Perform boundary detection and cyclically search the position of each individual, which does not exceed the upper boundary ub and the lower boundary lb. If exceeded, update to the corresponding boundary.

[0019] Step 6.5: Calculate the fitness value of the current population in the same way as steps 4 and 5, sort them, select the individual with the best fitness value and compare it with the global optimal GbestScore. If it is greater than, select the current optimal as the global optimal, update the global optimal value and its optimal position; otherwise, perform the next iteration until the optimal solution is selected at the end of the iteration, which is the optimal value of the SVM parameter.

[0020] Compared with the prior art, the present invention has the following beneficial effects:

[0021] In the update process of the discoverer of the sparrow search algorithm, the sine-cosine algorithm and the improvement factor are added to reduce the possibility of falling into the local extreme value, avoiding the phenomenon of stagnation of the discoverer and the entire group; in the update process of the joiner, the simulated annealing algorithm and Levy flight are added to improve the global and local optimization capabilities, thereby providing better parameters for SVM, achieving better classification effects, and solving the problem of insufficient accuracy of the intrusion detection system. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a schematic diagram of the method flow of the present invention. DETAILED DESCRIPTION

[0023] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0024] 1. Randomly divide the KDDCUP dataset into a training set (x_train, y_train) and a test set (x_test, y_test) in a ratio of 7:3, initialize the sparrow population parameters, set the warning value ST, the proportion of discoverers PD, the proportion of sparrows with danger awareness SD, the upper and lower boundaries ub, lb, the number of iterations Max, and the population number N, and initialize the population.

[0025] 2. Calculate and sort the fitness of the initialized individuals in the population, and sort the population according to the ranking to find the best and worst individuals, and select the initial optimal solution GbestScore and the corresponding position GbestPosition.

[0026] 3. Perform multiple iterations on the initial sparrow population until the global optimal solution GbestScore and the corresponding position GbestPosition are selected.

[0027] 4. During the iteration, the discoverer is updated first, and the sine-cosine algorithm and the improvement factor w are introduced to select a new batch of discoverers. When R2 < the warning value ST, the improvement factor and sine fusion are used to obtain a new batch of discoverers Xnew = w*X + r11*sin(r2)*|r3*GbestPositon-X|; otherwise, the mixed cosine and improvement factor are used to update the discoverer population Xnew = w*X + r11*cos(r2)*|r3*GbestPositon-X|

[0028] 5. After the discoverer is determined, the remaining sparrows act as followers and update the joiners. The idea of ​​simulated annealing is used, that is, the local optimal solution can be probabilistically jumped out and eventually tend to the global optimal solution, and a variable range value P is added. The size of the random number epsilon∈[0,1] and P is judged. If it is greater than or equal to, the fitness value is poor and it is necessary to leave the area; otherwise, Levy flight is implemented to avoid local optimality and improve global search capabilities.

[0029] 6. The sparrows responsible for alerting perform danger updates: When the current fitness value is greater than the optimal fitness value BestF, it means that the sparrows are at the edge of the population and are very vulnerable to attacks by natural enemies, Xnew = Xbest + b|X-Xbest|; when it is equal to, it means that the sparrows in the middle of the population are aware of the danger,

[0030] 7. Perform boundary detection and cyclically search the position of each individual, which shall not exceed the upper boundary ub and the lower boundary lb. If exceeded, update to the corresponding boundary.

[0031] 8. Calculate the fitness value of the current population according to steps 4 and 5, sort them, select the individual with the best fitness value and compare it with the global optimal GbestScore. If it is greater than, select the current optimal value as the global optimal value, and update the global optimal value and its optimal position; otherwise, perform the next iteration until the optimal solution is selected at the end of the iteration, which is the optimal value of the SVM parameter.

Claims

1. An intrusion detection method based on the improved sparrow algorithm to optimize SVM parameters, characterized in that: The steps include: Step 1: Extract data from the authoritative intrusion detection database KDDCUP to form a data set, and divide the data set into a training set x_train, y_train and a test set x_test, y_test in a ratio of 7:

3. Random division is used to eliminate contingency as much as possible to prevent data overfitting; Step 2: Initialize the sparrow population parameters, set the warning value ST, the proportion of discoverers PD, the proportion of sparrows with danger awareness SD, the upper and lower boundaries ub, lb, the number of iterations Max, and the population number N; Step 3: Initialize the population according to step 2, and for each individual X in the population, X = r*(ub-lb)+lb, make it randomly distributed, and r is a random number between [0,1]; Step 4: Calculate the fitness of the individuals in step 3, where the fitness value is obtained based on the classification accuracy of the SVM, which is fitness = 2-train_acc training set accuracy-test_acc test accuracy; Step 5: Sort the sparrows in step 4 by their fitness values, and sort the population according to their ranking, find the best individual and the worst individual, and select the initial optimal solution GbestScore and the corresponding position GbestPosition; Step 6: Iterate the sparrow population initialized in step 5 to select the global optimal solution and corresponding position; Step 6.1: Select some sparrows with better fitness values ​​as discoverers, introduce the sine-cosine algorithm and the improvement factor w; when R2<the warning value ST, use the improvement factor and sine fusion to find a new batch of discoverers Xnew=w*X+r11*sin(r2)*|r3*GbestPositon-X|; otherwise, mix the cosine and the improvement factor to update the discoverer population Xnew=w*X+r11*cos(r2)*|r3*GbestPositon-X|, where r2, r3 are random numbers between [0.2π], t is the current iteration number; Step 6.2: The remaining sparrows act as followers and perform joiner update. Based on the sparrow algorithm, P is added using the idea of ​​simulated annealing. A larger value T is introduced, T is 8000. If the fitness value is poor, the algorithm is the same as the original algorithm, and the algorithm remains unchanged. Otherwise, BestF is the fitness value of the best individual, and the sigmoid function is optimized to determine whether it is positive or negative, inx is a positive number on the contrary, Determine the size of the random number epsilon∈[0,1] and P. If it is greater than or equal to P, the fitness value is poor and it is necessary to leave the area; otherwise, Levy flight is performed. Where R is 1.5, r is a random number between [0,1], and F(x) = (x-1)! ; Step 6.3: The sparrow responsible for alerting performs danger update: When the current fitness value is greater than BestF, Xnew = Xbest + b|X-Xbest|; when it is equal to, Xbest represents the global optimal position, Xw represents the worst position, fi and fw represent the current best fitness value and the worst fitness value respectively, λ is the minimum constant, b is the step size, which is a random number with a mean of 0 and a variance of 1 in the normal distribution, and k is a uniform random number between [-1,1]; Step 6.4: Perform boundary detection and cyclically search for the position of each individual, which does not exceed the upper boundary ub and the lower boundary lb. If it exceeds, update it to the corresponding boundary; Step 6.5: Calculate the fitness value of the current population in the same way as steps 4 and 5, sort them, select the individual with the best fitness value and compare it with the global optimal GbestScore. If it is greater than GbestScore, select the current optimal value as the global optimal value, and update the global optimal value and its optimal position; otherwise, perform the next iteration until the optimal solution is selected at the end of the iteration, which is the optimal value of the SVM parameter.

Citation Information

Patent Citations

  • Stainless steel weld defect detection method based on multi-domain expression data enhancement and model self-optimization

    CN113129266A

  • AMR autonomous mobile robot path planning method based on improved sparrow search algorithm

    CN113778093A