Network intrusion detection method based on artificial fish school feature selection and deep learning
Through artificial fish swarm feature selection and deep learning methods, the key features in network traffic are screened out and the TBM-FL model is constructed, which solves the problems of low performance and feature dimensionality in the existing technology, and improves the accuracy and accuracy of network intrusion detection. efficiency.
Patent Information
- Application Number
- CN202410871986.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-06
AI Technical Summary
Existing network intrusion detection technology has low performance, cannot effectively process complex data, has low training and testing efficiency, and fails to effectively reduce feature dimensions, resulting in inaccurate detection results.
A network intrusion detection method based on artificial fish swarm feature selection and deep learning is used to select the most representative and discriminating features through the artificial fish swarm algorithm, combined with the Transformer coding layer, BiLSTM layer and improved multi-layer perceptron MLP layer. , build a TBM-FL model to perform dimensionality reduction and detection on network traffic data.
It improves the performance of network intrusion detection, significantly reduces the dimension of the feature space, enhances the accuracy of detection results and the operating efficiency of the model, and can better handle complex network traffic data and class-imbalanced samples.
Smart Images

Figure CN118611974A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a network intrusion detection method based on artificial fish swarm feature selection and deep learning. Background Art
[0002] With the rapid development of the Internet in recent years, various forms of network attacks have emerged in an endless stream. How to effectively detect abnormal behaviors and attack types has become an important topic in the field of network security. Network Intrusion Detection System (NIDS) refers to the combination of hardware and software to detect behaviors that endanger the security of computer systems, such as collecting vulnerability information, leading to denial of access and obtaining system control rights beyond the scope of legal authority. NIDS mainly includes three functional components: information source, analysis engine and response component. The information source is responsible for collecting various information of the detected network or system, and providing this information as data to the analysis engine component of the intrusion detection system. The analysis engine uses statistics or rules to find possible intrusion behaviors and provide events to the response component below. The response component takes appropriate actions based on the output of the analysis engine, and usually has an automated mechanism, such as actively notifying the system administrator, interrupting the intruder's connection, and collecting intrusion information.
[0003] At present, intrusion detection technology can be divided into two types according to the different observed objects. The first intrusion detection technology is signature-based intrusion detection, which is called misuse detection method. The second intrusion detection technology is behavior-based intrusion detection, which is called anomaly detection method. Anomaly-based detection method in NIDS is the main research direction in the field of intrusion detection. This method learns normal and abnormal behaviors by analyzing network traffic. In recent years, most researchers have tried to apply machine learning to intrusion detection, especially to solve the problem of high false alarm rate through machine learning. At the same time, some studies have tried to apply deep learning to network traffic prediction. Many studies have shown that deep learning can outperform traditional methods in anomaly recognition and prediction. In recent years, deep neural networks have been widely promoted in various scenarios that require big data analysis, triggering a craze for deep learning. Deep learning is an algorithm research branch in machine learning. It trains the target feature model by organizing the linear or nonlinear model conversion sequence into a specific data structure and continuously learning and converging. In recent years, some studies have been using the advantages of deep neural networks to complete intrusion detection tasks.
[0004] Feature selection is one of the research hotspots in the field of machine learning and data mining. According to the relationship with the classifier, traditional feature selection methods can be divided into three categories: filtering, wrapping, and embedded. Network traffic data usually contains complex feature correlations and nonlinear relationships. Traditional feature selection methods may not be able to effectively capture these relationships, resulting in inaccurate feature selection; moreover, traditional feature selection methods usually use static feature selection strategies, which cannot adaptively select features according to data changes and cannot automatically adapt to the characteristics of different data sets; in addition, traditional methods usually only focus on the selection of a single feature subset, and cannot find multiple data feature subsets and select the best subset from them, which limits the diversity and performance of feature selection.
[0005] The existing technology has a low detection rate for a few attack types, which affects intrusion detection and cannot cope with complex data. The intrusion detection performance is not high. In addition, the training and testing efficiency of the existing technology model is low, the training process is prone to overfitting, and the feature dimension is not taken into account, and the feature dimension cannot be effectively reduced. Summary of the invention
[0006] The present invention provides a network intrusion detection method based on artificial fish swarm feature selection and deep learning, which solves the problems in the prior art that the intrusion detection performance is not high, the feature dimension is not taken into consideration, and the feature dimension cannot be effectively reduced. The present invention realizes the screening of features and the detection result has a high accuracy rate.
[0007] The present invention provides a network intrusion detection method based on artificial fish swarm feature selection and deep learning, the method comprising:
[0008] Acquire a network traffic data set to be detected, and use a data dimensionality reduction method to reduce the dimension of the network traffic data set to be detected to obtain a reduced-dimensional network traffic data set to be detected;
[0009] The network traffic data set to be detected after dimensionality reduction is input into the trained TBM-FL model to obtain the detection result; wherein, the TBM-FL model construction includes: a Transformer encoding layer, a BiLSTM layer and an improved multi-layer perceptron MLP layer connected in sequence.
[0010] In a possible implementation, the TBM-FL model is trained in the following manner:
[0011] Preprocessing the training data set to obtain a preprocessed training data set; wherein the preprocessed training data set includes multiple data, each of which includes multiple feature values and a label value;
[0012] Dividing the preprocessed training data set into a test set and a training set;
[0013] Use a data dimensionality reduction method to reduce the dimensionality of the preprocessed training data set, obtaining a preprocessed training data set with reduced dimensionality;
[0014] Use the data in the training set to train the initial TBM-FL model, and use the data in the test set to evaluate the TBM-FL model. Obtain the trained TBM-FL model according to the evaluation results.
[0015] In a possible implementation manner, the using a data dimensionality reduction method to reduce the dimensionality of the network traffic data set to be detected, obtaining a network traffic data set to be detected with reduced dimensionality, includes:
[0016] Initialize an artificial fish swarm. The size of the artificial fish swarm is N, each artificial fish is represented by a 0, 1 sequence of length L, the maximum number of iterations K of the data dimensionality reduction method, the initial visual range visual0, the initial step size step0, and the mutation rate mulation, where N≥1, K≥1, 0<visual0≤1, 0<step0≤1, 0<mulation≤1, and L is the number of features in each data in the network traffic data set to be detected;
[0017] Circularly update the sequence of each artificial fish through the behavior of the artificial fish swarm, screen the data set according to the updated sequence to obtain a feature subset; calculate the multi-objective fitness function value of each artificial fish using the feature subset and the multi-objective fitness function, and update the visual range and step size according to the multi-objective fitness function value until the maximum number of iterations is reached, obtaining the sequence corresponding to the best artificial fish, and reduce the dimensionality of the network traffic data set to be detected according to this sequence, obtaining a network traffic data set to be detected with reduced dimensionality.
[0018] In a possible implementation manner, the behavior of the artificial fish swarm includes: foraging behavior, aggregation behavior, following behavior, mutation behavior, and extinction behavior.
[0019] In a possible implementation manner, the multi-objective fitness function is expressed as:
[0020]
[0021] where, is the multi-objective fitness value of the jth artificial fish in the i-th iteration ; L sub is the dimension of the feature subset; L is the dimension of the total features; α is the dimension weight; β is the accuracy weight, α + β = 1; accuracy sub represents the accuracy of the feature subset.
[0022] In one possible implementation, the Transformer encoding layer includes a multi-attention mechanism layer, a layer normalization layer, a residual connection layer, and a feedforward neural network layer connected in sequence;
[0023] The attention mechanism layer is used to extract multi-dimensional sequence features from the network traffic data after dimensionality reduction to obtain a multi-head attention extraction result, and add the multi-head attention extraction result to the network traffic data after dimensionality reduction to obtain an addition result;
[0024] The addition result is sequentially input into the layer normalization layer and the residual connection layer to obtain a normalized data set;
[0025] The feedforward neural network layer is used to process the normalized data set to obtain the output result of the Transformer encoding layer.
[0026] In a possible implementation, the BiLSTM layer includes: a first LSTM layer and a second LSTM layer that are independent of each other;
[0027] The first LSTM layer is used to forward propagate the output result of the Transformer encoding layer to obtain a forward propagation result;
[0028] The second LSTM layer is used to back-propagate the output result of the Transformer encoding layer to obtain a back-propagation result;
[0029] The forward propagation result and the backward propagation result are concatenated, and the last time step in the concatenated result is determined as the BiLSTM layer output result.
[0030] In a possible implementation, the multilayer perceptron MLP layer includes a first linear layer, a first ReLU activation function layer, a second linear layer, a second ReLU activation function layer, a third linear layer and a Softmax activation function layer connected in sequence;
[0031] The first linear layer is used to perform a linear transformation on the output result of the BiLSTM layer to obtain a first transformation result;
[0032] The first ReLU activation function layer is used to process the first transformation result to obtain a first result;
[0033] The second linear layer is used to perform a linear transformation on the first result to obtain a second transformation result;
[0034] The second ReLU activation function layer is used to process the second transformation result to obtain a second result;
[0035] The third linear layer is used to perform a linear transformation on the second result input to obtain a third transformation result;
[0036] The Softmax activation function is used to process the third transformation result to obtain a probability distribution.
[0037] In a possible implementation, the loss function of the improved multi-layer perceptron MLP layer includes:
[0038] loss FL =-1×weight×(1-p t ) γ ×log(p t )
[0039] Among them, loss FL represents category loss; weight represents category weight; p t represents the category prediction probability of each data; γ represents the focusing parameter.
[0040] One or more technical solutions provided in the present invention have at least the following technical effects or advantages:
[0041] (1) The TBM-FL model provided by the present invention can not only better handle complex situations in network traffic data, but also better handle class imbalance and difficult-to-classify samples, thereby improving the performance of network traffic intrusion detection;
[0042] (2) The present invention uses the feature subset dimension and accuracy to calculate the fitness function value, which can obtain a feature subset with small dimension and high accuracy, thereby improving the performance of network intrusion detection;
[0043] (3) The present invention can efficiently screen out the most representative and distinguishing features from the original features through the improved artificial fish swarm algorithm, and the improved artificial fish swarm algorithm comprehensively considers the dimension of the features and the classification accuracy through a multi-objective fitness function to obtain a feature subset with small feature dimension and high classification accuracy, thereby significantly reducing the dimension of the feature space, reducing the amount of calculation for model processing, and improving the operation efficiency of the model;
[0044] (4) The adaptive changes of the field of view and step size in the present invention can increase the convergence accuracy of the algorithm in the later stage and enhance the robustness of the algorithm. The use of genetic algorithm increases the randomness of the artificial fish school and effectively prevents the artificial fish school from falling into the local optimum, thereby effectively enhancing the robustness of the algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flowchart of the steps of a network intrusion detection method based on artificial fish swarm feature selection and deep learning provided by an embodiment of the present invention;
[0046] Figure 2 This is a schematic diagram of the architecture of the TBM-FL model provided by the embodiments of the present invention. Detailed implementation manners
[0047] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0048] The present invention provides a network intrusion detection method based on artificial fish swarm feature selection and deep learning, as Figure 1 shown. This method includes the following steps S101 to S102.
[0049] S101. Obtain the network traffic data set to be detected, and use a data dimensionality reduction method to reduce the dimensionality of the network traffic data set to be detected, so as to obtain the reduced network traffic data set to be detected.
[0050] Preferably, before reducing the data dimensionality, the network intrusion detection method provided by the embodiments of the present invention further includes: cleaning, one-hot encoding, and StandardScaler standardization processing on the network traffic data set to be detected.
[0051] Specifically, in step S101, the data dimensionality reduction method includes the following steps S1011 to S1013.
[0052] S1011. Initialize the artificial fish swarm. The size of the artificial fish swarm is N, each artificial fish is represented by a 0, 1 sequence with a length of L, the maximum number of iterations K of the data dimensionality reduction method, the initial visual range visual0, the initial step size step0, and the mutation rate mulation, where N≥1, K≥1, 0<visual0≤1, 0<step0≤1, 0<mulation≤1, and L is the number of features in each data in the network traffic data set to be detected.
[0053] S1012, cyclically updating the sequence of each artificial fish through the behavior of the artificial fish school, filtering the data set according to the updated sequence to obtain a feature subset; calculating the multi-objective fitness function value of each artificial fish using the feature subset and the multi-objective fitness function, and updating the field of view and the step length according to the multi-objective fitness function value until the maximum number of iterations is reached, obtaining the sequence corresponding to the best artificial fish, and reducing the dimension of the network traffic data set to be detected according to the sequence to obtain the network traffic data set to be detected after the dimension reduction. It can also include updating the announcement content on the bulletin board, and the announcement content is the sequence corresponding to the best artificial fish.
[0054] Specifically, in step S1012, the behaviors of the artificial fish school include: foraging behavior, grouping behavior, chasing behavior, mutation and extinction.
[0055] Exemplarily, updating the sequence of each artificial fish through the behavior of the artificial fish school specifically includes:
[0056] (1) Foraging behavior of artificial fish:
[0057] (1.1) The jth artificial fish in the i-th iteration is Random Retention middle state, when the random number R is less than step i When, yes Invert the other states in to get a new artificial fish Compare and if unchanged, otherwise, use replace
[0058] (1.2) Comparison With the bulletin board, if Bulletin board i No change, otherwise, update the bulletin board i The value of And record the bulletin board i Corresponding best artificial fish X best ,in, For the new artificial fish state The fitness value of Artificial fish status Fitness value, visual i is the visual range of the artificial fish in the i-th iteration, step i is the step length of the artificial fish in the i-th iteration, Artificial fish Length, 0≤R≤1.
[0059] (2) Swarming behavior of artificial fish:
[0060] (2.1) The state of the jth artificial fish in the i-th iteration is calculate The sum of the states of the same position as other artificial fish, if Then the artificial fish Otherwise, the artificial fish is not within the visual range. within the field of vision;
[0061] (2.2) Artificial fish The states of the artificial fish at the same position within the field of view are superimposed and divided by the total number of artificial fish within the field of view. If the value of the position is greater than 0.5, the state is set to 1, otherwise it is set to 0, thus obtaining The center position of the artificial fish within the field of view Compare and if but unchanged, otherwise, when the random number R is less than step i When, yes Zhongyu Invert different states of the same position to get a new artificial fish Use with replace
[0062] (2.3) Comparison With bulletin board i ,if Bulletin board i No change, otherwise, update the bulletin board i The value of And record the bulletin board i Corresponding best artificial fish X best ,in, For the new artificial fish The fitness value of Artificial fish Fitness value, visual i is the visual range of the artificial fish in the i-th iteration, step i is the step length of the artificial fish in the i-th iteration, Artificial fish , R is a random number, 0≤R≤1.
[0063] (3) Tail-chasing behavior of artificial fish:
[0064] (3.1) The state of the jth artificial fish in the i-th iteration is calculate The sum of the states of the same position as other artificial fish, if Then the artificial fish is in the artificial fish Otherwise, the artificial fish is not within the visual range. within the field of vision;
[0065] (3.2) Get the artificial fish with the largest fitness value within the field of view Compare and if but unchanged, otherwise, when the random number R is less than step i When, yes Zhongyu Invert different states of the same position to get a new artificial fish Use with replace
[0066] (3.3) Comparison With bulletin board i ,if Bulletin board i No change, otherwise, update the bulletin board i The value of And record the bulletin board i Corresponding best artificial fish X best ,in, For the new artificial fish The fitness value of The artificial fish with the largest fitness value within the field of view The fitness value of Artificial fish Fitness value, visual i is the visual range of the artificial fish in the i-th iteration, step i is the step length of the artificial fish in the i-th iteration, Artificial fish , R is a random number, 0≤R≤1.
[0067] (4) Mutation and extinction of artificial fish:
[0068] (4.1) In the i-th iteration, the number of crossover and mutation rounds of the genetic algorithm is set to Q. In each round of the genetic algorithm, two individual parents, parent1 and parent2, are randomly selected from the current artificial fish population, a crossover point is randomly selected, the genes of the parents are divided into two parts, and two individuals, child1 and child2, are generated by crossover. Child1 inherits the first half of parent1 and the second half of parent2, and child2 inherits the first half of parent2 and the second half of parent1.
[0069] (4.2) Perform mutation operation on child1 and child2 with a certain probability. If the random number is less than the mutation rate mutation, randomly select a position to invert it to obtain the new child 1 and the new child 2. Add child 1 and child 2 to the artificial fish school. If the size of the artificial fish school exceeds the set artificial fish school size N, select the first N artificial fish with the highest fitness value and keep them in the artificial fish school, and the rest of the artificial fish are eliminated.
[0070] The improved artificial fish swarm algorithm can efficiently screen out the most representative and discriminative features from the original features. The improved artificial fish swarm algorithm comprehensively considers the dimension of the features and the classification accuracy through a multi-objective fitness function to obtain a feature subset with small feature dimension and high classification accuracy, thereby significantly reducing the dimension of the feature space, reducing the computational amount of model processing, and improving the operation efficiency of the model.
[0071] Specifically, in step S1012, the field of view and the step length are updated according to the multi-objective fitness function value, which is specifically implemented as follows:
[0072] At the beginning of the iteration, the artificial fish should move in a relatively large field of view and range, but in the later stages of the iteration, because the artificial fish group has converged, the artificial fish needs to move in a smaller field of view and step size to increase the convergence accuracy. After each iteration, the field of view of the artificial fish changes as follows:
[0073]
[0074] The step size changes are as follows:
[0075]
[0076] Among them, θ is the rate of change of the visual range, 0<θ<1, ρ is the rate of change of the step size, 0<ρ<1, visual i is the visual range of the artificial fish in the i-th iteration, i+1 is the field of view of the artificial fish in the i+1th iteration, stepi is the step length of the artificial fish in the i-th iteration, step i+1 is the step length of the artificial fish in the i+1th iteration, board i is the bulletin board in the i-th iteration, board i+1 is the bulletin board in the i+1th iteration, and K is the maximum number of iterations of the algorithm.
[0077] Specifically, in step S1012, the multi-objective fitness function is: in the iterative process of feature selection, a binary sequence of length L is used to represent each artificial fish, where the value of each position is 0, indicating that the feature is not selected, and 1, indicating that the feature is selected. These feature subsets are combined with the corresponding sample category labels to construct new training sets and test sets. The LSTM model improved by the focal loss function is used as a classifier, the new training set is input into the classifier for training, and the trained model is evaluated with the new test set to obtain the accuracy of the new test set corresponding to each feature subset. sub , combined with accuracy sub and dimension L sub Calculate fitness value Used to evaluate the quality of each feature subset, the calculation formula is as follows:
[0078]
[0079] in, is the jth artificial fish in the i-th iteration The fitness value, L sub is the dimension of the feature subset, L is the dimension of the total feature, α is the dimension weight, β is the accuracy weight, α+β=1; accuracy sub is the accuracy of the new test set, TP is the actual number of positive samples in the new test set that are correctly classified as positive, TN is the actual number of negative samples in the test set that are correctly classified as negative, FP is the actual number of negative samples in the new test set that are misclassified as positive, and FN is the actual number of positive samples in the new test set that are misclassified as negative.
[0080] Use the focal loss function to improve the LSTM model: implement the focal loss function in the fully connected layer of the LSTM model, and introduce category weights in the focal loss function Calculate the classification loss loss FL =-1×weight×(1-p t ) γ ×log(p t), the category prediction probability p corresponding to each sample t =target×logit+ε, where y1 is the number of the first attack category, y w is the number of the wth attack category, w is the number of attack types, target is the true label value, logit is the output of the model after the full connection layer is processed, γ is the focus parameter, 0<γ≤5, ε is the smoothing parameter, 10 -10 ≤ε≤10 -5 .
[0081] The improved LSTM model can not only better handle complex situations in network traffic data, but also better handle class imbalance and difficult-to-classify samples, thereby improving the performance of network traffic intrusion detection. Using the feature subset dimension and accuracy to calculate the fitness function value can obtain a feature subset with small dimension and high accuracy, thereby improving the performance of network intrusion detection.
[0082] S1013, until the maximum number of iterations is reached, a sequence corresponding to the best artificial fish is obtained, and the dimension of the data set is reduced according to the sequence to obtain a data set after dimension reduction.
[0083] Exemplarily, according to the sequence corresponding to the best artificial fish, 0 in the sequence represents ignoring the feature, and 1 represents retaining the feature.
[0084] S102, inputting the network traffic data set to be detected after dimension reduction into the trained TBM-FL model to obtain the detection result.
[0085] Among them, TBM-FL model construction includes: Figure 2 As shown, the Transformer encoding layer, BiLSTM layer and improved multi-layer perceptron MLP layer are connected in sequence.
[0086] Specifically, the TBM-FL model is trained in the following manner, including the following steps S1021 to S1024.
[0087] S1021, preprocessing the training data set to obtain a preprocessed training data set; wherein the preprocessed training data set includes: multiple data, each data includes multiple feature values and a label value.
[0088] S1022, dividing the preprocessed training data set into a test set and a training set
[0089] S1023, using a data dimensionality reduction method to reduce the dimension of the preprocessed training data set to obtain a preprocessed training data set after dimensionality reduction.
[0090] S1024, using the data in the training set to train the initial TBM-FL model, and using the data in the test set to evaluate the TBM-FL model, and obtaining a trained TBM-FL model according to the evaluation results.
[0091] Specifically, the Transformer encoding layer includes a multi-attention mechanism layer, a layer normalization layer, a residual connection layer, and a feedforward neural network layer connected sequentially.
[0092] (1) Using the attention mechanism layer to extract multi-dimensional sequence features from the network traffic data after dimensionality reduction, obtaining a multi-head attention extraction result, and adding the multi-head attention extraction result to the network traffic data after dimensionality reduction to obtain an addition result;
[0093] (2) The addition results are sequentially input into the normalization layer and the residual connection layer to obtain a normalized data set;
[0094] (3) The feedforward neural network layer is used to process the normalized data set to obtain the output result of the Transformer encoding layer.
[0095] For example, the Transformer encoding layer processes the features of each time step through an attention mechanism to capture global information. First, the preprocessed training dataset M after dimensionality reduction is subjected to multi-dimensional sequence feature extraction through a multi-head self-attention mechanism to obtain a multi-head self-attention output M multihead Next, the reduced feature vector is added to the output of the multi-head self-attention mechanism and layer normalized to obtain the residual connection and layer normalized output M multihead-rn , that is, the output results of residual connection and layer normalization are further processed by the feedforward neural network, and finally the Transformer encoder output result M is obtained encoded , that is, M multihead-rn =LayerNorm(M multihead +M)M encoded =FFN(M multihead-rn ).
[0096] Specifically, the BiLSTM layer includes: a first LSTM layer and a second LSTM layer that are independent of each other;
[0097] The first LSTM layer is used to forward propagate the output of the Transformer encoding layer to obtain the forward propagation result;
[0098] The second LSTM layer is used to backpropagate the output of the Transformer encoding layer to obtain the backpropagation result;
[0099] The forward propagation result and the backward propagation result are concatenated, and the last time step in the concatenated result is determined as the output result of the BiLSTM layer.
[0100] For example, BiLSTM can effectively capture the long-term dependencies in the sequence and generate rich feature representations, converting the output of the Transformer encoding layer into encoded Input to the bidirectional long short-term memory network BiLSTM layer, where the BiLSTM layer consists of two independent LSTM layers, one for forward propagation and the other for backward propagation. The output of the LSTM forward process is The output of the LSTM backward process is The output of the LSTM forward process and backward process are concatenated together and only the last time step is retained to obtain the output M of the BiLSTM layer. BiLSTM ,Right now
[0101] Specifically, the multi-layer perceptron MLP layer includes a first linear layer, a first ReLU activation function layer, a second linear layer, a second ReLU activation function layer, a third linear layer and a Softmax activation function layer connected in sequence;
[0102] The first linear layer is used to perform a linear transformation on the output result of the BiLSTM layer to obtain a first transformation result;
[0103] A first ReLU activation function layer is used to process the first transformation result to obtain a first result;
[0104] A second linear layer is used to perform a linear transformation on the first result to obtain a second transformation result;
[0105] A second ReLU activation function layer is used to process the second transformation result to obtain a second result;
[0106] A third linear layer is used to perform a linear transformation on the second result input to obtain a third transformation result;
[0107] The Softmax activation function is used to process the third transformation result to obtain a probability distribution.
[0108] For example, a multilayer perceptron MLP is used as a fully connected layer to transform the output M of the BiLSTM BiLSTMMapped to the probability distribution of the output category. First, the output from the BiLSTM layer is used as input. Then, it is linearly transformed through the first linear layer Linear1, and then the ReLU activation function is applied. This result is linearly transformed through the second linear layer Linear2, and the ReLU activation function is applied again. Finally, the result is passed through the third linear layer Linear3 for the final linear transformation, and then the output is converted to a probability distribution through the Softmax activation function. The following is the output M of the multi-layer perceptron MLP layer MLP The calculation process:
[0109] M MLP =Softmax(Linear3(ReLU(Linear2(ReLU(Linear1(M BiLSTM ))))))
[0110] Specifically, in the multilayer perceptron MLP, the loss function of the multilayer perceptron MLP layer includes:
[0111] loss FL =-1×weight×(1-p t ) γ ×log(p t )
[0112] Among them, loss FL represents category loss; weight represents category weight; p t represents the category prediction probability of each data; γ represents the focusing parameter.
[0113] For example, the category weight is introduced into the focal loss function Calculate the classification loss loss FL =-1×weight×(1-p t ) γ ×log(p t ), the category prediction probability p corresponding to each sample t =target×M MLP +ε, where y1 is the number of the first attack category, y w is the number of the wth attack category, w is the number of attack types, target is the true classification label value, M MLP is the output after processing by the multilayer perceptron MLP layer, γ is the focusing parameter, 0<γ≤5, ε is the smoothing parameter, 10 -10 ≤ε≤10 -5 .
[0114] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of the present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0115] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the present invention.
Claims
1. A network intrusion detection method based on artificial fish swarm feature selection and deep learning, characterized in that: Including: Obtain the network traffic dataset to be detected, and use the data dimensionality reduction method to reduce the dimensionality of the network traffic dataset to be detected, obtaining the reduced-dimensional network traffic dataset to be detected; Input the reduced-dimensional network traffic dataset to be detected into the trained TBM-FL model to obtain the detection result; wherein, the construction of the TBM-FL model includes a Transformer encoding layer, a BiLSTM layer, and a multi-layer perceptron MLP layer connected in sequence.
2. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1 is characterized in that: The TBM-FL model is trained in the following manner: Preprocess the training dataset to obtain the preprocessed training dataset; wherein, the preprocessed training dataset includes multiple pieces of data, and each piece of data includes multiple feature values and a label value; Divide the preprocessed training dataset into a test set and a training set; Use the data dimensionality reduction method to reduce the dimensionality of the preprocessed training dataset, obtaining the reduced-dimensional preprocessed training dataset; Use the data in the training set to train the initial TBM-FL model, and use the data in the test set to evaluate the TBM-FL model, and obtain the trained TBM-FL model according to the evaluation result.
3. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1 is characterized in that: The step of using the data dimensionality reduction method to reduce the dimensionality of the network traffic dataset to be detected, obtaining the reduced-dimensional network traffic dataset to be detected, includes: Initialize the artificial fish swarm, the size of the artificial fish swarm is N, each artificial fish is represented by a 0, 1 sequence with a length of L, the maximum number of iterations K of the data dimensionality reduction method, the initial visual range visual0, the initial step size step0, and the mutation rate mulation, where N≥1, K≥1, 0<visual0≤1, 0<step0≤1, 0<mulation≤1, and L is the number of features in each data in the network traffic dataset to be detected; Circularly update the sequence of each artificial fish through the behavior of the artificial fish swarm, screen the dataset according to the updated sequence to obtain a feature subset; calculate the multi-objective fitness function value of each artificial fish using the feature subset and the multi-objective fitness function, and update the visual range and step size according to the multi-objective fitness function value until the maximum number of iterations is reached, obtaining the sequence corresponding to the best artificial fish, and reducing the dimensionality of the network traffic dataset to be detected according to this sequence, obtaining the reduced-dimensional network traffic dataset to be detected.
4. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 3 is characterized in that: The behaviors of the artificial fish swarm include: foraging behavior, aggregation behavior, following behavior, mutation behavior, and extinction behavior.
5. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 3 is characterized in that: The multi-objective fitness function is expressed as: in, is the jth artificial fish in the i-th iteration The multi-objective fitness value of L sub is the dimension of the feature subset; L is the dimension of the total feature; α is the dimension weight; β is the accuracy weight, α+β=1; accuracy sub Represents the accuracy of the feature subset.
6. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1 is characterized in that: The Transformer encoding layer includes a multi-attention mechanism layer, a layer normalization layer, a residual connection layer, and a feed-forward neural network layer connected in sequence; The attention mechanism layer is used to extract multi-dimensional sequence features from the reduced-dimensional network traffic data to obtain the multi-head attention extraction result, and add the multi-head attention extraction result to the reduced-dimensional network traffic data to obtain the addition result; The addition result is sequentially input into the layer normalization layer and the residual connection layer to obtain the normalized dataset; The feedforward neural network layer is used to process the normalized data set to obtain the output result of the Transformer encoding layer.
7. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1 is characterized in that: The BiLSTM layer includes: a first LSTM layer and a second LSTM layer that are independent of each other; The first LSTM layer is used to forward propagate the output result of the Transformer encoding layer to obtain a forward propagation result; The second LSTM layer is used to back-propagate the output result of the Transformer encoding layer to obtain a back-propagation result; The forward propagation result and the backward propagation result are concatenated, and the last time step in the concatenated result is determined as the BiLSTM layer output result.
8. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1, characterized in that: The multi-layer perceptron MLP layer includes a first linear layer, a first ReLU activation function layer, a second linear layer, a second ReLU activation function layer, a third linear layer and a Softmax activation function layer connected in sequence; The first linear layer is used to perform a linear transformation on the output result of the BiLSTM layer to obtain a first transformation result; The first ReLU activation function layer is used to process the first transformation result to obtain a first result; The second linear layer is used to perform a linear transformation on the first result to obtain a second transformation result; The second ReLU activation function layer is used to process the second transformation result to obtain a second result; The third linear layer is used to perform a linear transformation on the second result input to obtain a third transformation result; The Softmax activation function is used to process the third transformation result to obtain a probability distribution.
9. The network intrusion detection method based on artificial fish swarm feature selection and deep learning according to claim 1, characterized in that: The loss function of the multi-layer perceptron MLP layer includes: loss FL =-1×weight×(1-p t ) γ ×log(p t ) Among them, loss FL represents category loss; weight represents category weight; p t represents the category prediction probability of each data; γ represents the focusing parameter.
Citation Information
Patent Citations
Wireless power private network intrusion detection method based on artificial fish school and BP neural network
CN114666794A
Intelligent substation process layer network abnormal flow detection method based on deep learning
CN114785573A
Method for key quality feature selection
CN114897107A
Network traffic intrusion detection method
CN117155701A
Model source code vulnerability detection method based on signature
CN117540389A
