SVM network intrusion detection method based on sine and cosine and chameleon group optimization
By introducing the surrogate search strategy of the sine and cosine algorithm into the chameleon group algorithm and combining it with the SVM algorithm to find optimal parameters, the problem that traditional detection methods are difficult to detect unknown intrusions and local optimal solutions is solved, and a fast convergence and high-accuracy network is achieved. Intrusion detection.
Patent Information
- Application Number
- CN202410786682.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional intrusion detection methods based on attack signature libraries and specific rules are difficult to effectively detect unknown intrusion behaviors, and the chameleon swarm algorithm is prone to falling into local optimal solutions, resulting in insufficient detection accuracy and convergence speed.
The SVM network intrusion detection method based on sine and cosine and chameleon group optimization is used, and the chameleon individual position is updated through the agent search strategy of the sine and cosine algorithm. The optimal penalty coefficient C and Gaussian kernel function parameter γ are combined with the SVM algorithm to form SC-CSA. -SVM method, balances exploration and development, and improves convergence speed and accuracy.
The SC-CSA-SVM method achieves fast convergence, stability and high classification accuracy, significantly improves the identification ability of network attacks, avoids local optimal solutions, and improves detection accuracy.
Smart Images

Figure CN118764228A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of network and software engineering, and in particular to a SVM network intrusion detection method based on sine-cosine and chameleon group optimization. Background Art
[0002] With the continuous progress in network technology and software engineering, all dimensions of human production and life have been deeply embedded in a highly digital, interconnected and symbiotic cyberspace environment.
[0003] However, the vulnerability of network systems makes digital activities and assets vulnerable to hacker attacks. In order to ensure the information security of network users, intrusion detection systems are often used to identify illegal network access and malicious attacks to prevent potential security threats. With the continuous development of network attack methods and the emergence of new threats, traditional detection methods for attacks based on attack signature libraries and specific rules often cannot effectively detect unknown intrusion behaviors. Summary of the invention
[0004] The purpose of the present invention is to provide a SVM network intrusion detection method based on sine-cosine and chameleon swarm optimization, which can prevent a single individual from converging to a local optimum too early, achieve a balance between exploration and development, improve the convergence speed and accuracy of the chameleon swarm algorithm, further obtain the optimal parameters of the SVM, and improve the accuracy of detecting intrusions.
[0005] In order to achieve the above object, the present invention provides a SVM network intrusion detection method based on sine-cosine and chameleon group optimization, the detection method comprising:
[0006] S1. Use the min-max normalization method to normalize the NSL-KDD dataset and cut the NSL-KDD dataset into a training set and a test set in a ratio of 7:3;
[0007] S2, initialize the individual positions and parameters of the chameleon population, and use the accuracy of SVM to evaluate the position of each chameleon;
[0008] S3, using the improved chameleon hunting strategy to update the positions of all chameleon individuals;
[0009] S4, calculating the fitness of all chameleons and evaluating whether to keep the position of the current chameleon individual;
[0010] S5. When the maximum number of iterations is reached, the position of the best chameleon in the current chameleon population is used as the penalty coefficient C and the Gaussian kernel function parameter γ in the SVM;
[0011] S6. Train the SVM with the optimal parameters and test it using the test set, and output the detection results.
[0012] Preferably, in S1, the data after normalization of the NSL-KDD dataset is limited to the range of [0, 1].
[0013] Preferably, the min-max normalization method in S1 is:
[0014]
[0015] Among them, x′ i is the normalized value of the i-th column data in the NSL-KDD dataset, x i is the original data of the i-th column in the NSL-KDD dataset.
[0016] Preferably, the initialization of the chameleon population individuals in S2 includes:
[0017]
[0018] in, is the initial position of the jth chameleon, upper j and low j represents the maximum and minimum boundaries of the search area that the jth chameleon can access, and r is a random number between 0 and 1.
[0019] Preferably, the improved chameleon hunting strategy in S3 includes:
[0020]
[0021] in, represents the position of the jth chameleon in the kth dimension at the tth iteration, represents the best position of the jth chameleon in the kth dimension at the tth iteration; r1 sc , and are the 4 random numbers in the sine-cosine algorithm, where r1 sc =a sc -t(a sc / T), a sc is a constant of 2, t is the current number of iterations, T is the maximum number of iterations,
[0022] Preferably, the Gaussian kernel function in S5 is:
[0023]
[0024] According to the above technical scheme, the present invention introduces the proxy search strategy of the sine-cosine algorithm in the hunting stage of the chameleon group, which makes up for the disadvantage that the chameleon group algorithm is easy to fall into the local optimal solution to a certain extent, and improves the development ability of the algorithm. At the same time, combined with the SVM algorithm, an optimal chameleon is finally evolved, and the position of the chameleon is composed of the penalty coefficient C of the SVM and the Gaussian kernel function parameter γ. Among them, the improved algorithm is called the sine-cosine-chameleon group algorithm (SC-CSA), and the SC-CSA is used to find the optimal penalty coefficient C and Gaussian kernel function parameter γ in the SVM, and an optimized SC-CSA-SVM method is obtained. The SC-CSA-SVM method has fast convergence speed, good stability, high classification accuracy, and has significant network attack recognition capabilities on intrusion detection data sets.
[0025] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention but do not constitute a limitation of the present invention. In the accompanying drawings:
[0027] Figure 1 It is a flow chart of the SVM network intrusion detection method based on sine-cosine and chameleon group optimization provided by the present invention;
[0028] Figure 2 It is a comparison chart of the fitness value convergence curves of various detection methods on the Ionosphere dataset;
[0029] Figure 3 It is a comparison chart of the fitness value convergence curves of various detection methods on the Wine dataset;
[0030] Figure 4 It is a comparison chart of the fitness value convergence curves of various detection methods on the Breast Cancer dataset;
[0031] Figure 5 It is a comparison chart of the fitness value convergence curves of various detection methods on the Liver dataset;
[0032] Figure 6 It is a comparison chart of the fitness value convergence curves of various detection methods on the Balance Scale dataset;
[0033] Figure 7 This is a comparison chart of the global maximum variance test of various detection methods on the NSL-KDD dataset;
[0034] Figure 8This is a comparison chart of the global maximum variance test of various detection methods on the Ionosphere dataset;
[0035] Fig. 9 This is a comparison chart of the global maximum variance test of various detection methods on the Wine dataset;
[0036] Fig.10 This is a comparison chart of the global maximum variance test of various detection methods on the Breast Cancer dataset;
[0037] Fig.11 This is a comparison chart of the global maximum variance test of various detection methods on the Liver dataset;
[0038] Fig.12 This is a comparison chart of the global maximum variance test of various detection methods on the Balance Scale dataset;
[0039] Fig.13 This is a comparison chart of the global maximum variance test of various detection methods on the NSL-KDD dataset. DETAILED DESCRIPTION
[0040] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0041] In this field, machine learning, as a data-driven method, can effectively learn and identify new data patterns and discover new features, thereby improving the performance of network intrusion detection.
[0042] See also Figure 1 The present invention provides a SVM network intrusion detection method based on sine-cosine and chameleon group optimization, the detection method comprising:
[0043] S1. Use the min-max normalization method to normalize the NSL-KDD dataset and cut the NSL-KDD dataset into a training set and a test set in a ratio of 7:3;
[0044] S2, initialize the individual positions and parameters of the chameleon population, and use the accuracy of SVM to evaluate the position of each chameleon;
[0045] S3, using the improved chameleon hunting strategy to update the positions of all chameleon individuals;
[0046] S4, calculating the fitness of all chameleons and evaluating whether to keep the position of the current chameleon individual;
[0047] S5. When the maximum number of iterations is reached, the position of the best chameleon in the current chameleon population is used as the penalty coefficient C and the Gaussian kernel function parameter γ in the SVM;
[0048] S6. Train the SVM with the optimal parameters and test it using the test set, and output the detection results.
[0049] Through the above technical solution, the proxy search strategy of the sine-cosine algorithm is introduced in the hunting stage of the chameleon group, which makes up for the disadvantage that the chameleon group algorithm is easy to fall into the local optimal solution to a certain extent, and improves the development ability of the algorithm. At the same time, combined with the SVM algorithm, an optimal chameleon is finally evolved, and the position of the chameleon is composed of the penalty coefficient C of the SVM and the Gaussian kernel function parameter γ. Among them, the improved algorithm is called the sine-cosine-chameleon group algorithm (SC-CSA), and the SC-CSA is used to find the optimal penalty coefficient C and Gaussian kernel function parameter γ in the SVM, and an optimized SC-CSA-SVM method is obtained. The SC-CSA-SVM method has fast convergence speed, good stability, high classification accuracy, and has significant network attack recognition capabilities on intrusion detection data sets.
[0050] The above-mentioned CSA algorithm is a new swarm intelligence optimization algorithm proposed by Braik in 2021. The algorithm mainly simulates the foraging and hunting behavior of chameleons in desert and jungle environments. The specific description of the algorithm is:
[0051] 1. Prey search phase: When searching for prey, the individual position of the chameleon can be updated using the following formula (1):
[0052]
[0053] in, represents the position of the jth chameleon in the kth dimension at the tth iteration; represents the best position of the jth chameleon in the kth dimension at the tth iteration; represents the best position of the kth dimension of the current chameleon group up to the tth iteration; upper j and lower j represents the search space boundary of the jth chameleon; p1 and p2 are positive numbers that control the exploration ability of the algorithm, r1 is a random number in [0,1], represents the probability of a chameleon detecting prey, and the sgn(rand-0.5) value is +1 or -1, indicating the direction of exploration and exploitation; γ, α, and β are three constant values for adjusting the exploration and development capabilities. t and T represent the current number of iterations and the maximum number of iterations, respectively.
[0054] 2. Eye rotation stage: Chameleons can sense the location of prey by rotating their eyes, which enables them to observe prey within a 360-degree range. Once the chameleon finds prey, it moves in the direction of the prey. In this case, the formula for updating the chameleon's position is as follows:
[0055]
[0056] in, represents the position center of the jth chameleon at the tth iteration, represents the rotation center of the jth chameleon at the tth iteration, which can be expressed by the following formula (3):
[0057]
[0058] in, represents the center coordinates of the jth chameleon at the tth iteration, represents the chameleon rotation matrix. Among them, θ=r*sgn(rand-0.5)*180° represents the rotation angle of the chameleon's eyes, and represents a set of orthogonal vectors, A x and A y Respectively represent the rotation matrices on the x-axis and y-axis, the expressions are as follows:
[0059]
[0060] in, represents the rotation angle around the x-axis, Indicates the rotation angle around the y-axis.
[0061] 3. Hunting stage,
[0062] When chameleons get close to their prey, they attack it with their tongue. The chameleon that is closest to the prey is considered the best chameleon and is also considered the best solution in the solution space. During the hunting process, the chameleon's tongue extends to twice its original length. The speed of the tongue ejected towards the prey can be expressed as follows:
[0063]
[0064] in, is the k-th dimension tongue ejection speed of the j-th chameleon at the t-th iteration, c1 and c2 are two positive numbers, represents the inertia weight, which decreases with the increase of the number of iterations, and ρ is a positive number used to affect the exploration ability. When the chameleon extends its tongue in the direction of the prey, its own position will also change accordingly. The position change formula is as follows:
[0065]
[0066] Where a = 2590*(1-e -logt ) represents the acceleration of the chameleon's tongue.
[0067] In order to prevent a single entity from converging to a local optimum too early, a balance between exploration and development is achieved, thereby accelerating the convergence of the algorithm. Considering that the proxy search strategy in the sine-cosine algorithm can fully develop the solution space around the agent, the present invention introduces a proxy search strategy to update the position of the chameleon when hunting prey, so that it can fully develop the surrounding solution space at the end of hunting. The position update formula in the proxy search strategy is as follows:
[0068]
[0069] in, represents the position of the i-th agent in the j-th dimension at the t-th iteration, Represents the best position of the i-th agent in the t-th dimension at the t-th iteration. sc , and are the 4 random numbers in the sine-cosine algorithm, where: From 2 to 0, a sc is a constant of 2, t is the current iteration number, and T is the maximum iteration number. Therefore, the position transformation formula of the chameleon when hunting prey is:
[0070]
[0071] In the present invention, SVM separates data by establishing an optimal hyperplane. It can obtain higher classification accuracy when processing linearly separable data and is often used for tasks such as classification and regression. For nonlinearly separable data sets, SVM uses a kernel function to project the data into a high-dimensional space, thereby making the data linearly separable. At this time, the linearly separable condition in the high-dimensional space is equivalent to the following minimization problem:
[0072]
[0073] Among them, ω represents the normal vector of the hyperplane, C>0 is the penalty coefficient for balancing the "softness" and "hardness" of the model, and ξ i >0 represents a slack variable, x represents the input training sample, b represents the bias, and y represents the category of the data.
[0074] Considering that the network intrusion data feature vector belongs to nonlinear separable data, the present invention adopts the Gaussian kernel function, and the formula is:
[0075]
[0076] It can be seen that the SC-CSA method has the advantages of being able to jump out of the local optimal solution, improve the convergence speed of the algorithm, and fully balance exploration and development. Therefore, the above-mentioned SVM network intrusion detection method based on sine-cosine and chameleon group optimization is proposed, and:
[0077] In S1, the min-max normalization method is used to normalize the NSL-KDD dataset, limiting the processed data to the range of [0,1]. This can eliminate the adverse effects caused by outlier sample data, thereby improving classification accuracy. The min-max normalization method is shown in the following formula:
[0078]
[0079] Among them, x′ i is the normalized value of the i-th column data in the NSL-KDD dataset, x i is the original data of the i-th column in the NSL-KDD dataset.
[0080] In S2, the initialization of chameleon population individuals includes:
[0081]
[0082] in, is the initial position of the jth chameleon, upper j and low j represents the maximum and minimum boundaries of the search area that the jth chameleon can access, and r is a random number between 0 and 1.
[0083] In S3, the improved chameleon hunting strategy includes:
[0084]
[0085] in, represents the position of the jth chameleon in the kth dimension at the tth iteration, represents the best position of the jth chameleon in the kth dimension at the tth iteration; r1 sc , and are the 4 random numbers in the sine-cosine algorithm, where r1 sc =a sc -t(a sc / T), a sc is a constant of 2, t is the current number of iterations, T is the maximum number of iterations,
[0086] In S5, the Gaussian kernel function is:
[0087]
[0088] The method proposed in the present invention is applied to the problem of network intrusion detection, and the performance of the proposed method is evaluated using 5 standard data sets and the intrusion detection data set NSL-KDD. The 5 data sets used in the experiment are all from the UCI machine learning library, and their names are: Ionosphere data set, Wine data set, Breast Cancer data set, Liver data set, Balance Scale data set. The following Table 1 lists the name of the data set, the number of features of the samples in the data set, the number of samples in the data set, and the number of categories in the data set:
[0089] Table 1:
[0090] Dataset name Number of samples Number of features Number of categories Ionosphere 351 34 2 Wine 178 13 3 Breast Cancer 569 30 2 Liver 345 6 2 Balance Scale 625 4 3 NSL-KDD 148,517 41 5
[0091] Specifically, the following Table 2 gives the experimental results on the Ionosphere dataset:
[0092] Table 2:
[0093]
[0094]
[0095] The following Table 3 gives the experimental results on the Wine dataset:
[0096] Table 3:
[0097] Method Name Best Value Worst value Mean Standard deviation Ranking SC-CSA-SVM 1.00000 0.98113 0.99308 0.00925 1 CSA-SVM 1.00000 0.96226 0.98993 0.01378 3 PSO-SVM 1.00000 0.94444 0.98024 0.01679 5 DE-SVM 1.00000 0.96296 0.98456 0.01199 2 CS-SVM 1.00000 0.94444 0.98086 0.01647 4 MFO-SVM 1.00000 0.92592 0.98086 0.01785 6 MVO-SVM 1.00000 0.20370 0.52901 0.28343 7
[0098] The following Table 4 gives the experimental results on the Breast Cancer dataset:
[0099] Table 4:
[0100] Method Name Best Value Worst value Mean Standard deviation Ranking SC-CSA-SVM 0.99415 0.95906 0.98187 0.00833 1 CSA-SVM 0.99415 0.95906 0.97875 0.00833 2 PSO-SVM 0.98245 0.93567 0.96101 0.01401 4 DE-SVM 0.98245 0.92982 0.95536 0.01377 6 CS-SVM 0.98245 0.94152 0.96218 0.01115 3 MFO-SVM 0.98245 0.92982 0.95847 0.01278 5 MVO-SVM 0.98830 0.59064 0.79493 0.17250 7
[0101] The following Table 5 gives the experimental results on the Liver dataset:
[0102] Table 5:
[0103]
[0104]
[0105] The following Table 6 gives the experimental results on the Balance Scale dataset:
[0106] Table 6:
[0107] Method Name Best Value Worst value Mean Standard deviation Ranking SC-CSA-SVM 1.00000 0.98936 0.99787 0.00330 1 CSA-SVM 1.00000 0.85106 0.90620 0.03342 4 PSO-SVM 0.92021 0.84042 0.88865 0.02057 5 DE-SVM 0.93085 0.83510 0.88120 0.01886 6 CS-SVM 1.00000 0.85638 0.91560 0.04465 2 MFO-SVM 1.00000 0.83510 0.91152 0.05023 3 MVO-SVM 0.98404 0.40957 0.68971 0.23865 7
[0108] The following Table 7 gives the experimental results on the NSL-KDD dataset:
[0109] Table 7:
[0110] Method Name Best Value Worst value Mean Standard deviation Ranking SC-CSA-SVM 0.99427 0.99198 0.99275 0.00064 1 CSA-SVM 0.99273 0.94199 0.97118 0.02309 3 PSO-SVM 0.85750 0.85235 0.85408 0.00143 2 DE-SVM 0.97489 0.84505 0.91866 0.05796 5 CS-SVM 0.97442 0.84942 0.94664 0.04543 4 MFO-SVM 0.97657 0.85084 0.91221 0.06185 7 MVO-SVM 0.97454 0.84777 0.91189 0.05914 6
[0111] The following Table 8 gives the classification evaluation results on the Ionosphere dataset:
[0112] Table 8:
[0113]
[0114]
[0115] The following Table 9 gives the classification evaluation results on the Wine dataset:
[0116] Table 9:
[0117]
[0118] The following Table 10 gives the classification evaluation results on the Breast Cancer dataset: Table 10:
[0119]
[0120] The following Table 11 gives the classification evaluation results on the Liver dataset:
[0121] Table 11:
[0122]
[0123] The following Table 12 gives the classification evaluation results on the Balance Scale dataset: Table 12:
[0124]
[0125]
[0126] The following Table 13 gives the classification evaluation results on the NSL-KDD dataset:
[0127] Table 13:
[0128]
[0129] At the same time, Figure 2-Figure 13 The figure shows the fitness value convergence curve comparison and global maximum variance test comparison of various detection methods on 6 data sets.
[0130] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the specific details in the above embodiments. Within the technical concept of the present invention, a variety of simple modifications can be made to the technical solution of the present invention, and these simple modifications all belong to the protection scope of the present invention.
[0131] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not further describe various possible combinations.
[0132] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the present invention, they should also be regarded as the contents disclosed by the present invention.
Claims
1. A SVM network intrusion detection method based on sine-cosine and chameleon group optimization, characterized in that: The detection method comprises: S1. Use the min-max normalization method to normalize the NSL-KDD dataset and cut the NSL-KDD dataset into a training set and a test set in a ratio of 7:3; S2, initialize the individual positions and parameters of the chameleon population, and use the accuracy of SVM to evaluate the position of each chameleon; S3, using the improved chameleon hunting strategy to update the positions of all chameleon individuals; S4, calculating the fitness of all chameleons and evaluating whether to keep the position of the current chameleon individual; S5. When the maximum number of iterations is reached, the position of the best chameleon in the current chameleon population is used as the penalty coefficient C and the Gaussian kernel function parameter γ in the SVM; S6. Train the SVM with the optimal parameters and test it using the test set, and output the detection results.
2. The SVM network intrusion detection method based on sine-cosine and chameleon group optimization according to claim 1 is characterized in that: In S1, the normalized data of the NSL-KDD dataset is restricted to the range of [0,1].
3. The SVM network intrusion detection method based on sine-cosine and chameleon group optimization according to claim 1 or 2 is characterized in that: The min-max normalization method in S1 is: Among them, x' i is the normalized value of the i-th column data in the NSL-KDD dataset, x i is the original data of the i-th column in the NSL-KDD dataset.
4. The SVM network intrusion detection method based on sine-cosine and chameleon group optimization according to claim 1 is characterized in that: The initialization of chameleon population individuals in S2 includes: in, is the initial position of the jth chameleon, upper j and low j represents the maximum and minimum boundaries of the search area that the jth chameleon can access, and r is a random number between 0 and 1.
5. The SVM network intrusion detection method based on sine-cosine and chameleon group optimization according to claim 1 is characterized in that: Improved chameleon hunting strategies in S3 include: in, represents the position of the jth chameleon in the kth dimension at the tth iteration, represents the best position of the jth chameleon in the kth dimension at the tth iteration; and are the 4 random numbers in the sine-cosine algorithm, where: a sc is a constant of 2, t is the current number of iterations, T is the maximum number of iterations, 6. The SVM network intrusion detection method based on sine-cosine and chameleon group optimization according to claim 1 is characterized in that: The Gaussian kernel function in S5 is:
Citation Information
Patent Citations
Intrusion detection method of cosine time-variant PSO-SVM
CN108462711A
Method for constructing prediction model based on improved sine and cosine algorithm
CN111079074A
Integrated transmission device fault prediction algorithm based on ITSOBP
CN117708771A
