Intrusion detection method based on convolutional neural network and lightweight gradient boosting machine

By combining the intrusion detection method of convolutional neural network and lightweight gradient boosting machine to deal with the imbalance and high-dimensional data in network intrusion detection, it achieves higher classification accuracy and lower false alarm rate, solving the current problem of There are challenges with data complexity and nonlinear analysis in technology.

CN113901448BActive Publication Date: 2024-10-29GUANGZHOU CHUANGBAO INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111030448.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-03
Publication Date
2024-10-29
Estimated Expiration
2041-09-03

AI Technical Summary

Technical Problem

Existing network intrusion detection algorithms have problems with low classification accuracy and high false alarm rate when dealing with complex imbalanced data and high-dimensional data, making it difficult to effectively handle the multidimensionality and nonlinear characteristics of data.

Method used

An intrusion detection method based on convolutional neural network and lightweight gradient boosting machine is adopted, through data preprocessing, feature selection and classification prediction, including data type conversion, oversampling technology, image data conversion, convolution layer, pooling layer and The combination of fully connected layers, combined with the LightGBM algorithm for feature dimensionality reduction and classification, uses mutually exclusive feature bundling, unilateral gradient sampling, histogram ideas and leaf growth strategies with depth restrictions to optimize model training.

Benefits of technology

It shows good performance in multi-dimensional evaluation indicators such as accuracy, precision and false negative rate, overcomes the difficulties caused by data imbalance, high dimensionality and non-linearity in intrusion detection analysis, and improves the classification effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113901448B_ABST
    Figure CN113901448B_ABST
Patent Text Reader

Abstract

The present invention discloses an intrusion detection method based on convolutional neural network and lightweight gradient boosting machine, which relates to intrusion detection technology in the field of network security, including: data preprocessing: the data preprocessing process includes data type conversion, oversampling technology and image data conversion; feature selection: using CNN model to select features; intrusion detection classification: using LightGBM algorithm for classification. The present invention overcomes the difficulties brought to intrusion detection analysis by data imbalance, high dimensionality and nonlinearity, thereby showing better performance in multi-dimensional evaluation indicators such as accuracy, precision rate and false negative rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to intrusion detection technology in the field of network security, and in particular to an intrusion detection method based on convolutional neural network and lightweight gradient boosting machine, which is used to address the limitations of existing network intrusion detection algorithms in processing complex unbalanced data and high-dimensional data. Background Art

[0002] With the development of network technology, the rapid growth of network scale has brought convenience to people, but also brought risks and challenges. Problems such as theft of private data and occupation of server resources have brought great troubles to people. In order to deal with the many problems that follow, intrusion detection technology came into being. For example, in 2017, hackers exploited Windows system vulnerabilities to attack 100,000 organizations around the world with Bitcoin ransomware. In 2019, the hacker group Fxmsp hacked into three anti-virus companies and extracted the source code of anti-virus software, causing huge losses to the companies. Microsoft releases hundreds of office vulnerability patches every year. Hackers can use office vulnerabilities to carry out APT attacks, spread botnets, spread ransomware, etc. Security incidents such as loss of private data and leakage of confidential information caused by malicious attacks by hackers have caused huge losses to major companies, organizations and individuals.

[0003] At present, the most commonly used intrusion detection algorithms are in the field of machine learning. In order to extract representative features for effectively detecting normal connections and attack behaviors, Lin et al. proposed a cluster center and nearest neighbor intrusion detection algorithm to improve the classification accuracy of intrusion detection. Elhefnawy et al. proposed a hybrid nested genetic fuzzy algorithm framework, which has a good effect on minority category detection. In order to solve the problems of imbalanced intrusion detection data sets and multi-classification, Yao et al. proposed an algorithm framework based on hybrid multi-level data mining. The performance of the algorithm was verified using the KDDCUP99 data set. Compared with the algorithms proposed in the same period, the prediction accuracy was greatly improved. Benmessahel et al. combined simulated annealing (SA) and error back propagation (BP) to improve the performance of deep neural networks. By comparing with existing methods, the proposed method has a strong potential to become an alternative IDS solution. Jiang Zetao et al. proposed an intrusion detection method based on multi-step classification, selecting different classifiers for classification for different types of data to achieve the best classification performance. Talita et al. used particle swarm algorithm as a feature selection method and classified the intrusion detection dataset based on Bayesian classifier, which performed best on the selected 38 features.

[0004] However, exponentially increasing complex data often brings problems such as large amount of calculation, easy memory overflow, and low classification accuracy. Machine learning algorithms have certain limitations when processing unbalanced data and high-dimensional data. In this context, deep learning has gradually been favored by scholars at home and abroad and has been rapidly applied to many fields. It has also achieved many results in the field of intrusion detection. Rao Xuli et al. proposed a deep learning network intrusion detection algorithm based on incomplete information. With the help of a multi-layer perceptron neural network, a deep learning model was constructed to achieve intrusion detection under incomplete information conditions. Li Heting et al. proposed an intrusion detection algorithm based on heterogeneous convolutional neural networks, and compared it with DT, support vector machine (SVM) and other algorithms. The algorithm has a high accuracy and strong generalization ability. Shideh et al. proposed to apply deep learning technology to an intrusion detection system based on a hybrid network. By comparing it with traditional machine learning algorithms, the algorithm was verified to improve the accuracy of the intrusion detection system.

[0005] Since deep learning requires more parameters and complex calculations, it exhibits problems such as low classification accuracy and high false alarm rate on high-dimensional data. To this end, some scholars have proposed the idea of ​​combining deep learning technology with machine learning technology and applied it to the field of intrusion detection. Sydney et al. proposed a wireless intrusion detection system, which uses a feedforward neural network based on the feature selection unit of the wrapper to generate the best feature vector from the original data set to improve the classification performance. Laghrissi et al. proposed using principal component analysis (PCA) and mutual information for feature selection and dimensionality reduction, combined with long and short term memory (LSTM) to detect attacks, and achieved a high detection rate. Du et al. proposed an intrusion detection algorithm based on deep belief network and three-branch decision-making. By setting thresholds, samples are divided into positive domains, negative domains, and boundary domains, and samples are classified, which improves the overall performance of intrusion detection. In other fields, there are also successful cases of combining deep learning technology with machine learning technology.

[0006] Intrusion detection data is becoming increasingly complex and diversified, gradually showing characteristics such as imbalance, high dimensionality and nonlinearity. The huge amount of calculation makes traditional machine learning algorithms stretched. Convolutional neural networks in deep learning have the characteristics of local network connection and convolution kernel parameter sharing, which enables them to maintain strong learning and recognition capabilities when facing high-dimensional nonlinear data. However, due to the influence of more parameter settings and complex calculations, there are still problems of low classification accuracy and high false alarm rate. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide an intrusion detection method based on convolutional neural networks and lightweight gradient boosting machines, which overcomes the difficulties brought to intrusion detection analysis by data imbalance, high dimensionality and nonlinearity, thereby being able to show better performance in multidimensional evaluation indicators such as accuracy, precision, and false negative rate.

[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0009] An intrusion detection method based on convolutional neural network and lightweight gradient boosting machine includes the following steps:

[0010] Step 1: Data preprocessing: The data preprocessing process includes data type conversion, oversampling technology and image data conversion;

[0011] Step 2: Feature selection: Select features using the CNN model;

[0012] Step 3: Intrusion detection classification: Use LightGBM algorithm for classification.

[0013] A further improvement of the technical solution of the present invention is that: in step 1, the intrusion detection data set D = {X 1×n ,Y} for data preprocessing, X represents data features, Y represents attack type; data preprocessing includes data type conversion, oversampling balanced data set and conversion of one-dimensional data to two-dimensional image data; if the number of data features n is an odd number, let n = n + 1; the preprocessed data feature set is recorded as X′ p×q ={x′ p×q}, where p×q=n, and the category label is denoted as Y, that is, D′={X′,Y}.

[0014] The further improvement of the technical solution of the present invention is that: in the step 2, the convolution layer, pooling layer, and fully connected layer of the CNN model are used in conjunction with the activation function to learn the key information of D′={X′,Y}, and the parameters in the model are adjusted to achieve the best result; the data set in the fully connected layer is extracted, which is recorded as D″={X″ 1×r ,Y}, where r is the hyperparameter of the fully connected layer.

[0015] A further improvement of the technical solution of the present invention is that in step 3, the main feature data is used to train and test the LightGBM model, so as to obtain the final classification result: after CNN processing, D″={X″ 1×r,Y} is used to divide the dataset into training set and test set. In the training process, the EFB algorithm in the LightGBM algorithm is first used to reduce the feature dimension of the dataset and reduce the sparsity. Then the GOSS algorithm is used to perform unilateral sampling on the dataset according to the gradient size. Finally, the leaf growth strategy with depth restriction and the histogram algorithm are used to fit the new weak classifier to realize the training of the LightGBM model. The test set is used to test the performance of the LightGBM model and output the classification results.

[0016] A further improvement of the technical solution of the present invention is that the oversampling technology in step 1 includes data set imbalance processing, and the process is as follows:

[0017] a. Find sample x from the minority class sample i , use the Euclidean distance to calculate its k nearest neighbors, denoted as x ij ,j∈(1,...,k);

[0018] b. Randomly select one of the neighboring samples x ij , using random numbers Synthesize new sample x new ,Right now:

[0019]

[0020] c. Repeat step b to obtain a sufficient number of minority class samples to balance the data set.

[0021] A further improvement of the technical solution of the present invention is that the image data conversion in step 1 includes a data conversion algorithm flow:

[0022] a. Select a sample x from the data set X, with n sample feature columns;

[0023] b. If n is an odd number, use the random normal distribution function to expand x so that x expands from n columns to k columns, where k = n + 1;

[0024] c. Reconstruct the structure of x, reconstruct x into a p×q matrix, where p×q=k;

[0025] d. Repeat steps a, b, and c until all samples in X are traversed.

[0026] A further improvement of the technical solution of the present invention is that in step 4, based on GBDT, LightGBM is optimized using the following four strategies: mutually exclusive feature bundling algorithm, unilateral gradient sampling algorithm, histogram idea, and Leaf-wise leaf growth strategy with depth limitation.

[0027] Due to the adoption of the above technical solution, the technical progress achieved by the present invention is:

[0028] Compared with other similar inventions, the present invention overcomes the difficulties brought to intrusion detection analysis by data imbalance, high dimensionality and nonlinearity in many aspects such as data preprocessing, feature selection, and classification prediction methods, thereby showing better performance in multidimensional evaluation indicators such as accuracy, precision, and missed reporting rate.

[0029] The present invention breaks through the mindset of processing one-dimensional data and converts one-dimensional data into two-dimensional image data, thereby broadening the range of methods that can be used for intrusion detection.

[0030] The present invention uses oversampling technology to increase the number of samples and eliminates the negative impact of class imbalance on classification results; when converting image data, a random normal distribution method is used to fill the expanded dimension, which retains the effective information of the original data set to the greatest extent, thereby ensuring the classification effect.

[0031] The present invention combines convolutional neural networks with lightweight gradient boosting machines, making full use of the advantages of automatic feature selection of neural networks and high classification accuracy and fast computing speed of lightweight gradient boosting machines to achieve fast and accurate classification of intrusion detection data.

[0032] The present invention can effectively process high-dimensional nonlinear intrusion detection data under class imbalance and show good performance in multi-dimensional evaluation indicators such as accuracy, precision, and false negative rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flow chart of the algorithm of the present invention;

[0034] Figure 2 It is a schematic diagram of data preprocessing principle of the present invention;

[0035] Figure 3 It is a schematic diagram of the data type conversion principle of the present invention;

[0036] Figure 4 It is the principle diagram of image data conversion of the present invention;

[0037] Figure 5 It is a schematic diagram of the CNN model training process of the present invention;

[0038] Figure 6 It is the weight sharing principle diagram of the present invention;

[0039] Figure 7 It is a schematic diagram of the GBDT model training process of the present invention;

[0040] Figure 8 It is a schematic diagram of the histogram optimization algorithm of the present invention;

[0041] Fig. 9 It is a principle diagram of the leaf growth strategy of the present invention; DETAILED DESCRIPTION

[0042] The present invention is further described in detail below in conjunction with embodiments:

[0043] like Figures 1 to 9 As shown, an intrusion detection method based on convolutional neural network and lightweight gradient boosting machine is proposed. Aiming at the limitations of existing network intrusion detection algorithms in processing complex unbalanced data and high-dimensional data, based on the characteristics of intrusion detection data and the advantages of various technical methods, an intrusion detection method based on convolutional neural network (CNN) and lightweight gradient boosting machine (LightGBM) is proposed. The present invention is aimed at intrusion detection classification and mainly includes three parts: data preprocessing, feature selection, and intrusion detection classification.

[0044] Firstly, data type conversion, oversampling technology and image data conversion method are introduced in the process of data preprocessing to balance the data and adapt to the input format; oversampling is used to reduce the negative impact of sample imbalance on classification, and data type conversion and image data conversion are used to adapt to the input format requirements of the method adopted by the present invention, thereby giving full play to the superiority of the method adopted by the present invention.

[0045] Secondly, the input standard data is processed using a convolutional neural network, and the main features are selected from the converted image data by using the convolutional layer, pooling layer, and fully connected layer of the convolutional neural network (CNN). By selecting the main features through convolution, reducing unnecessary parameters through pooling, and integrating sample features through full connection, automatic feature selection of high-dimensional data is achieved to achieve the purpose of reducing data dimension.

[0046] Finally, a lightweight gradient boosting machine is used to classify and predict the intrusion detection data after feature selection. This model is an improved model based on the decision tree. Due to its distributed data processing mechanism, it can reduce the time and space complexity of classifying massive data, and has a good classification effect. The main feature data is used to train and test the lightweight gradient boosting machine (LightGBM, Light Gradient Boosting Machine) model to obtain the final classification result. The present invention uses the KDDCup99 data set for multi-classification experiments. Through experimental comparisons before and after the imbalanced data set processing, as well as experimental comparisons with other similar algorithms, the superiority of the algorithm proposed in the present invention in intrusion detection classification performance is verified, especially in small categories. It has a strong classification ability, which lays a foundation for solving network information security monitoring and defense.

[0047] The algorithm flow is as follows Figure 1 As shown, the algorithm steps are as follows.

[0048] Step 1: For the intrusion detection dataset D = {X 1×n ,Y} for data preprocessing, X represents data features, and Y represents attack type. Data preprocessing includes data type conversion, oversampling balanced data set, and conversion of one-dimensional data to two-dimensional image data. If the number of data features n is an odd number, let n = n + 1. The preprocessed data feature set is recorded as X′ p×q ={x′ p×q}, where p×q=n, and the category label is denoted as Y, that is, D′={X′,Y}.

[0049] Step 2: Use the CNN model to select features. Use the convolutional layer, pooling layer, and fully connected layer of the CNN model with the activation function to learn the key information of D′={X′,Y}, and adjust the parameters in the model to achieve the best result. Extract the data set in the fully connected layer, denoted as D″={X″ 1×r ,Y}, where r is the hyperparameter of the fully connected layer.

[0050] Step 3: Use LightGBM algorithm for classification. After CNN processing, D″={X″ 1×r ,Y} to divide the training set and test set. The training process first uses the EFB algorithm in the LightGBM algorithm to reduce the feature dimension of the data set and reduce the sparsity. Then use the GOSS algorithm to perform unilateral sampling on the data set according to the gradient size. Finally, use the leaf growth strategy with depth restriction and the histogram algorithm to fit the new weak classifier to realize the training of the LightGBM model. Use the test set to test the performance of the LightGBM model and output the classification results.

[0051] 1. Data Preprocessing

[0052] In order to adapt to the model proposed in this invention, the input intrusion detection data set needs to be preprocessed. Figure 2 shown.

[0053] (1) Data type conversion

[0054] Public data sets for intrusion detection often contain character data. Since the algorithm proposed in this invention has a better learning effect on numerical data, it is necessary to convert the character data in the data set into numerical data during the data preprocessing stage. Figure 3 shown.

[0055] (2) Oversampling technology

[0056] In data analysis algorithms, many algorithms do not consider the imbalance of data or conduct experiments and evaluations on the basis of assuming that the data set is balanced. However, the imbalance of data sets is a common problem in classification prediction. In the field of intrusion detection, the number of attack data samples is much smaller than the number of normal samples. However, attack samples are obviously more valuable for research and are also the significance of intrusion detection research. Therefore, in order for the intrusion detection system to learn the information of attack samples to the greatest extent, the present invention adopts oversampling technology to increase the number of attack samples to achieve the purpose of balancing the data set. The process of processing the imbalance of data sets is as follows.

[0057] a. Find sample x from the minority class sample i , use the Euclidean distance to calculate its k nearest neighbors, denoted as x ij ,j∈(1,...,k);

[0058] b. Randomly select one of the neighboring samples x ij , using random numbers Synthesize new sample x new ,Right now:

[0059]

[0060] c. Repeat step b to obtain a sufficient number of minority class samples to balance the data set.

[0061] (3) Image data conversion

[0062] The CNN algorithm has a high accuracy in image classification. To adapt to the algorithm proposed in this invention, the processed data set needs to be converted from one-dimensional data to two-dimensional image data. In order to ensure the integrity of data features, this invention proposes a method based on data filling to perform feature expansion on data samples and convert the expanded data into two-dimensional image data. The process is as follows: Figure 4 shown.

[0063] This method expands the sample features while retaining all the information of the original sample, and uses a random normal distribution to fill the expanded features, thus retaining the effective information of the original data set to the greatest extent. Data conversion algorithm process:

[0064] a. Select a sample x from the data set X, with n sample feature columns;

[0065] b. If n is an odd number, use the random normal distribution function to expand x so that x expands from n columns to k columns, where k = n + 1;

[0066] c. Reconstruct the structure of x, reconstruct x into a p×q matrix, where p×q=k;

[0067] d. Repeat steps a, b, and c until all samples in X are traversed.

[0068] 2. CNN model feature selection

[0069] The CNN model is a feedforward neural network with a deep structure, which has made outstanding contributions in the field of image recognition. The CNN model has improved the traditional neural network in terms of layer function and form, solving the problems of large amount of computation and loss of structural information in artificial neural networks. Faced with massive and complex data sets, CNN can perform nonlinear mapping of data features and mine the connections between each feature, thereby improving the accuracy of feature selection.

[0070] The operation process of CNN can be expressed by formula (2).

[0071] s=f(w×x+b) (2)

[0072] Among them, s represents output data, x represents input data, w is the weight matrix, f represents activation function, and b represents bias.

[0073] CNN consists of a data input layer, a convolution calculation layer, an activation function layer, a pooling layer, a fully connected layer, and an output layer. It does not require manual feature selection, and can reduce the number of free parameters in the network through local perception of the field of view, convolution kernel weight sharing, and time or space downsampling ideas, thereby selecting more representative features. The CNN model training process is as follows: Figure 5 shown.

[0074] (1) Convolutional layer

[0075] The convolution layer is the core part of the CNN model. Its main features are local perception and convolution kernel weight sharing, which can greatly reduce the complexity of the network model. The main function of the convolution layer is to use multiple convolution kernels to perform feature selection through convolution operations and abstract higher-level features. The convolution operation refers to the inner product of the local image and the convolution kernel matrix, as shown in formula (3).

[0076]

[0077] Among them, W is the convolution kernel matrix and X is the input dataset.

[0078] Local perception refers to the process in which CNN imitates the local perception field mechanism of the biological world and uses sparse connections to receive local information of the input image. Weight sharing means that the entire image shares a set of weights when the convolution kernel works. For example, when using a 2×2 convolution kernel, four of the weights will be shared by the entire image to calculate the feature mapping matrix. The weights will not change as the convolution kernel moves. Figure 6 shown.

[0079] like Figure 6 In the example, the feature map is a 5×5 matrix, using a 2×2 convolution kernel. Figure 1 Using the same weight parameters, after the convolution of the entire image is completed, a 3×3 feature mapping matrix is ​​obtained.

[0080] (2) Activation Function

[0081] In CNN, activation functions are needed to perform nonlinear processing on input data, which can improve CNN's ability to fit nonlinear models. If activation functions are not added, it will be the same as traditional machine learning algorithms, which can only process linearly separable data and cannot process complex data. The most commonly used activation functions include relu, tanh, sigmoid, etc.

[0082] Among them, the relu function is more commonly used than the other two functions, but it is easy to cause neuron necrosis, resulting in the inability to update some parameters. In addition, the relu function will reset the eigenvalues ​​less than 0 to zero during execution. The currently public intrusion detection data sets are all sparse data sets. Using the relu function will cause serious information loss problems. The sigmoid function is often used in neural network models, but due to its own defects, the sigmoid function is prone to gradient disappearance problems, affecting the model convergence speed. The tanh function maps the variable value between [-1,1], as shown in formula (4).

[0083]

[0084] The tanh function effectively alleviates the defects of the sigmoid function and the relu function and reduces the negative impact on the model. Therefore, in the algorithm proposed in the present invention, the tanh function is used as the activation function.

[0085] (3) Pooling layer

[0086] The convolution operation abstracts higher-level features, but does not reduce the data dimension. If the classification operation is performed after the convolution operation, overfitting is likely to occur, reducing the classification performance. Therefore, it is necessary to add a pooling layer. The pooling layer can retain the main features of the data sample while reducing the dimension, compressing the feature map and parameters, reducing the amount of calculation of the network model, reducing model overfitting, and enhancing the fault tolerance of the model. Commonly used pooling operations in CNN are Max Pooling and Average Pooling, which can be selected according to different needs. Assume that the pooling window size is kernel*kernel, and the pooling layer expression is shown in formula (5).

[0087] y i =f(x strides×i+j ),j∈R kernel×kernel (5)

[0088] Among them, y i represents the value of the i-th mapping after pooling, f is the pooling function, strides is the moving step length, R kernel×kernel represents the pooling area, and j represents the index of the pooling area.

[0089] (4) Fully connected layer

[0090] The fully connected layer in a convolutional neural network is similar to the hidden layer in a traditional neural network. After the pooling operation, each neuron in the feature map is connected to all neurons in the fully connected layer, integrating the local information with category-distinguishing properties in the previous pooling layer, reducing the impact of position on classification and improving the robustness of the model. The neurons in the fully connected layer can be expressed by formula (6).

[0091]

[0092] Among them, z j represents the j-th category score of the fully connected layer, w j represents the weight matrix, and x is the input of the fully connected layer.

[0093] (5) Loss Function

[0094] In classification problems, the purpose of using a classification algorithm is to distinguish samples of different categories, so that the distance between the predicted sample category and its original category is as small as possible. The tool used to measure this distance is the loss function. The loss function can be used to calculate the distance between the sample category predicted by the current model and the actual sample category, that is, the loss value, and then the loss value can be used for back propagation to update the weights in the model and obtain a better model. Commonly used loss functions include the mean square error loss function and the cross entropy loss function.

[0095] Cross entropy is an information measurement method based on entropy, which can determine the difference between the predicted value and the true value of a sample. When using the cross entropy loss function, the weight adjustment gradient is always proportional to the error, and has a faster convergence speed than the mean square error loss function. Therefore, the present invention chooses to use the cross entropy loss function as the loss function of the present invention. The cross entropy loss function is shown in formula (7).

[0096]

[0097] Among them, Loss is the loss value predicted by the current model, n represents the number of samples, K is the number of categories, and y ik Represents the labeled value. When the predicted value is the same as the true value, y ik Take 1, otherwise take 0, p ik It represents the probability that the fully connected layer predicts that sample i belongs to category k.

[0098] 3. LightGBM model classification

[0099] LightGBM is further optimized based on GDBT. GDBT is an iterative ensemble algorithm, and the base classifier is a decision tree. The idea is to build a new base classifier in the gradient descent direction according to the loss function value of the trained model, and the final result is determined by the sum of the scores of each base classifier. In the execution of GDBT, assuming that the current model is f t-1 (x), the loss function is L(y,f t-1 (x)), then the current goal is to find several base classifiers h(x) to fit the existing model respectively, so that the loss is minimized. The loss function is shown in formula (8), and the GBDT algorithm is shown in formula (9).

[0100] L(y,f t (x))=L(y,f t-1 (x)+h(x)) (8)

[0101]

[0102] Among them, f k (x) is the final score, h represents the score of a decision tree, K represents the number of trees, and θ k represents the parameters of the kth tree. The GBDT model training process is as follows Figure 7 shown.

[0103] GBDT uses decision trees as base classifiers, has many nonlinear transformations, has good expressive power, and shows good performance on dense data sets. However, GBDT needs to traverse the entire data set for each iteration, so its limitations are more obvious in high-dimensional sparse data sets. Based on GBDT, LightGBM uses the following four strategies for optimization, which reduces the amount of calculation and improves the model's operation speed.

[0104] (1) Exclusive Feature Bundling (EFB)

[0105] The idea of ​​the EFB algorithm is to bundle multiple mutually exclusive features through feature scanning, reduce data sparsity, and reduce the dimension of the data. After determining the features that need to be bundled, it is necessary to bias the non-zero values ​​of the features to ensure that the original features remain independent after bundling. Mutually exclusive features mean that when at least one of the values ​​of two attribute features in the corresponding samples is 0, the two features are mutually exclusive. At this time, one of the two features can be biased to perform feature bundling. The data set processed by the EFB algorithm greatly reduces data sparsity and achieves dimensionality reduction.

[0106] (2) Gradient Single-Side Sampling (GOSS)

[0107] The idea of ​​the GOSS algorithm is to sample samples based on the size of the gradient. The LightGBM model fits the negative gradient of the loss function. When the model does not have sufficient learning ability for a certain sample, the error will be relatively large and the absolute value of the gradient will also be large. Therefore, samples with larger absolute values ​​of gradients are more worthy of learning, while smaller gradients indicate that there is almost no new information to learn. Therefore, the GOSS algorithm focuses on samples with larger gradients, but in order to minimize the change in the original distribution of the data set, it will also randomly sample samples with smaller gradients.

[0108] (3) Histogram algorithm

[0109] The histogram algorithm is to segment the data of a feature and discretize the feature value into k segments, which is similar to using k buckets to bucket the qualified data separately. In this way, the number of traversal of the data set can be greatly reduced when traversing the data, reducing the computational complexity. Figure 8 shown.

[0110] (4) Leaf-wise leaf growth strategy with depth restriction

[0111] The leaf-wise leaf growth strategy is to find the leaf with the largest splitting gain from the current layer and split it, and the leaves with lower splitting gain are not split, so as to reduce memory consumption. Fig. 9 shown.

[0112] The leaf-wise strategy is based on a depth-first structure, finding the node with the most effective information from the current node for splitting, rather than splitting every leaf node. At the same time, the depth of the tree is limited, and no more splitting is performed when the maximum depth is reached. This strategy can shorten the time to find the optimal decision tree and prevent overfitting.

[0113] 4. Parameter settings of CNN model and LightGBM model

[0114] (1) Parameter setting of CNN model

[0115] The preprocessed intrusion detection dataset is input into the CNN model. After adjustment, the optimal parameters with the smallest model loss value are obtained. The parameter list is shown in Table 1. In order to solve the problem of easy loss of edge information, padding = "same" is set in the convolution layer, and the sample edges are expanded with "0".

[0116]

[0117] Table 1 CNN model parameter settings

[0118] (2) LightGBM classifier parameter setting

[0119] After the CNN model training is completed, the data in the fully connected layer is extracted as the input of the LightGBM algorithm. Although the CNN algorithm can use softmax to classify according to the selected features, many experiments have shown that the classification accuracy of using the CNN algorithm for feature selection and classification is lower than that of the algorithm proposed in the present invention, especially the generalization ability is relatively weak on small categories. LightGBM uses multiple weak classifiers to integrate a strong classifier, and uses the gradient of the model loss function as the residual to iteratively train the next weak classifier until the optimal decision tree is found. Therefore, the present invention uses the features selected by the CNN model as the input of the LightGBM algorithm, and uses the integrated algorithm to improve the classification accuracy of the model. The LightGBM setting parameters are shown in Table 2.

[0120]

[0121]

[0122] Table 2 LightGBM classifier parameter settings

[0123] The present invention has been verified by experiments, and the classification effect of intrusion detection is very ideal. The present invention proposes an intrusion detection method based on the combination of convolutional neural network and lightweight gradient boosting machine, that is, using deep learning algorithm to learn data features, and then using lightweight machine learning algorithm to classify the data after feature selection, giving full play to the advantages of each model. Through the three cases of single model of CNN or lightGBM, or the method proposed by the present invention before and after the data set is balanced, experimental comparison is carried out to verify the effectiveness of the data balancing method and combined model proposed by the present invention. By comparing with similar algorithms on the KDDCup99 data set, the algorithm proposed by the present invention has good performance in accuracy, precision, and false negative rate, reaching 99.8%, 99.8% and 0.13, all better than the comparison algorithm. The present invention shows the effectiveness of the intrusion detection algorithm based on convolutional neural network and lightweight gradient boosting machine.

Claims

1. An intrusion detection method based on convolutional neural network and lightweight gradient boosting machine, characterized by: The following steps are involved: Step 1: Data preprocessing: The data preprocessing process includes data type conversion, oversampling technology and image data conversion; In step 1, the intrusion detection data set D = {X 1×n ,Y} for data preprocessing, X represents data features, and Y represents attack type; Data preprocessing includes data type conversion, oversampling balanced data set, and conversion of one-dimensional data to two-dimensional image data; if the number of data features n is an odd number, let n = n + 1; The preprocessed data feature set is denoted as X′ p×q ={x′ p×q }, where p×q=n, and the category label is denoted by Y, i.e. D′={X′,Y}; Step 2: Feature selection: Select features using the CNN model; In step 2, the convolutional layer, pooling layer, and fully connected layer of the CNN model are used in conjunction with the activation function to learn the key information of D′={X′,Y}, and the parameters in the model are adjusted to achieve the optimal value; the data set in the fully connected layer is extracted and recorded as D″={X″ 1×r ,Y}, where r is the hyperparameter of the fully connected layer; Step 3: Intrusion detection classification: Use LightGBM algorithm for classification; In step 3, the main feature data is used to train and test the LightGBM model to obtain the final classification result: after CNN processing, D″={X″ 1×r ,Y} is used to divide the training set and the test set. The training process first uses the EFB algorithm in the LightGBM algorithm to reduce the feature dimension of the data set and reduce the sparsity. Then the GOSS algorithm is used to perform unilateral sampling on the data set according to the gradient size. Finally, the leaf growth strategy with depth restriction and the histogram algorithm are used to fit the new weak classifier to realize the training of the LightGBM model. The test set is used to test the performance of the LightGBM model and output the classification results. LightGBM is further optimized on the basis of GDBT. GDBT is an iterative ensemble algorithm, and the base classifier is a decision tree. The idea is to establish a new base classifier in the gradient descent direction according to the loss function value of the trained model, and the final result is determined by the sum of the scores of each base classifier. In the execution of GDBT, assuming that the current model is f t-1 (x), the loss function is L(y,f t-1 (x)), then the current goal is to find several base classifiers h(x) to fit the existing model respectively so that the loss is minimized; the loss function is shown in formula (8), and the GBDT algorithm is shown in formula (9); L(y,f t (x))=L(y,f t-1 (x)+h(x)) (8) Among them, f k (x) is the final score, h represents the score of a decision tree, K represents the number of trees, and θ k Represents the parameters of the kth tree; The leaf-wise leaf growth strategy is to find the leaf with the largest splitting gain from the current layer and split it, and the leaves with lower splitting gain are not split, so as to reduce memory consumption; the leaf-wise strategy is based on the depth-first structure, and finds the node with the most effective information from the current node to split, rather than splitting every leaf node; at the same time, the depth of the tree is limited, and no splitting is performed when the maximum depth is reached. This strategy can shorten the time of finding the optimal decision tree and prevent overfitting.

2. The intrusion detection method based on convolutional neural network and lightweight gradient boosting machine according to claim 1, characterized in that: The oversampling technique in step 1 includes handling the imbalance of the data set, and the process is as follows: a. Find sample x from the minority class sample i , use the Euclidean distance to calculate its k nearest neighbors, denoted as x ij ,j∈(1,...,k); b. Randomly select one of the neighboring samples x ij , using random numbers Synthesize new sample x new ,Right now: c. Repeat step b to obtain a sufficient number of minority class samples to balance the data set.

3. The intrusion detection method based on convolutional neural network and lightweight gradient boosting machine according to claim 1, characterized in that: The image data conversion in step 1 includes the data conversion algorithm flow: a. Select a sample x from the data set X, with n sample feature columns; b. If n is an odd number, use the random normal distribution function to expand x so that x expands from n columns to k columns, where k = n + 1; c. Reconstruct the structure of x, reconstruct x into a p×q matrix, where p×q=k; d. Repeat steps a, b, and c until all samples in X are traversed.

4. The intrusion detection method based on convolutional neural network and lightweight gradient boosting machine according to claim 1, characterized in that: In step 3, based on GBDT, LightGBM is optimized using the following four strategies: mutually exclusive feature bundling algorithm, unilateral gradient sampling algorithm, histogram idea, and Leaf-wise leaf growth strategy with depth limit.

Citation Information

Patent Citations

  • 10kV feeder line fault prediction method based on CNN and LightGBM

    CN110929918A

  • Unit power prediction method based on XGBoost-LightGBM

    CN111414717A