Network traffic anomaly detection method and system based on combination of TabTransform and genetic algorithm

By combining TabTransformer and genetic algorithms, it solves the problem of limited effectiveness of traditional network intrusion detection technology in processing network traffic data, achieves more efficient prediction and detection of abnormal traffic, and has the ability to adapt to complex network threats.

CN118611945APending Publication Date: 2024-09-06HANGZHOU DIANZI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410776999.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Traditional network intrusion detection technology is difficult to adapt to increasingly complex network attacks, and deep learning-based models are limited in their effectiveness when processing network traffic data, resulting in low accuracy in predicting abnormal network traffic.

Method used

A combination method based on TabTransformer and genetic algorithm is used to preprocess network traffic data and model training. TabTransformer's self-attention mechanism is used to capture data relationships, and hyperparameters are optimized through genetic algorithm to improve model performance.

Benefits of technology

Significantly improves the accuracy and performance of abnormal network traffic prediction, and can more effectively respond to changing network threats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118611945A
    Figure CN118611945A
Patent Text Reader

Abstract

The invention discloses a network traffic anomaly detection method and system based on the combination of TabTransform and a genetic algorithm, which are used for solving the problem of low accuracy of abnormal network traffic prediction. The method comprises the following steps: preprocessing network flow data, converting non-digital features contained in a data set into digital features, and performing normalization processing and data division on the whole data set; then, a TabTransform model is used for carrying out learning and end-to-end model training on the processed training data set; optimizing hyper-parameters of model training based on a genetic algorithm to obtain a network model with optimal performance; and finally, inputting the test data set into the trained model to obtain a prediction result so as to measure the final prediction performance of the model. Comparison test results show that the performance of the technical scheme provided by the invention on a related data set is remarkably improved compared with that of other similar methods in the prior art, continuously changing network threats can be dealt with, and the method is more efficient in practical application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of network traffic anomaly detection of information security, and specifically relates to a network traffic anomaly detection method and system based on the combination of TabTransform and genetic algorithm. Background Art

[0002] In recent years, with the rapid development of science and technology, people's lives and working methods have undergone earth-shaking changes, especially the Internet technology has brought great convenience. However, while people enjoy the ultimate experience brought by the Internet, they are also facing various network security issues. In recent years, network security issues have emerged in an endless stream. Not only do Internet users need to pay attention to their own security at all times, but countries have also successively increased the governance and attention to cyberspace security. All users, organizations and countries need to prevent the endless network attacks at all times to protect information security and prevent a series of serious consequences. Nowadays, the most effective way to detect network attacks is network intrusion detection technology, which can timely detect possible risks in the network by checking abnormal behavior. Therefore, it has become the focus of researchers in recent years. However, with the continuous iteration and development of network attack methods, traditional network intrusion detection technology has encountered bottlenecks in effective detection. In recent years, artificial intelligence has flourished, and has made significant progress in image recognition, natural language processing and other aspects, showing superior performance. Applying artificial intelligence technology to network intrusion detection technology can detect abnormal traffic in the network in a timely and effective manner, which can effectively improve the performance of intrusion detection methods and is of great significance to maintaining cyberspace security.

[0003] Traditional network intrusion detection technology mainly relies on rules or signatures, but such technologies often cannot adapt to the increasingly iterative new network intrusion threats. With the increasing complexity of network attacks, various machine learning and deep learning technologies have been introduced to improve the effectiveness of network intrusion detection. Among various deep learning models, convolutional neural networks, as a common model in deep learning, are widely used in fields such as image recognition. Then, recurrent neural networks and long short-term memory networks, which have achieved good results in time series prediction, appeared. These models were later applied to network traffic classification and achieved high accuracy. However, convolutional neural networks were originally designed to process images. Directly converting network traffic data into image-type matrices will result in the model not being able to play its advantages. Methods based on recurrent neural networks and long short-term memory networks still have problems in processing network traffic data, and the effects of related models are still severely limited. Therefore, how to use deep learning to process similar network traffic data and enable network models to play their due advantages is gradually becoming a research hotspot.

[0004] Based on the above situation, in order to achieve more accurate classification of abnormal network traffic, the present invention proposes a network traffic anomaly detection method based on the combination of TabTransformer and genetic algorithm. TabTransformer based on Transformer architecture can effectively capture the relational dependencies in network traffic data by using the self-attention mechanism. At the same time, in order to make the model perform at its best, the present invention also uses the adaptive search capability of genetic algorithm to optimize hyperparameters and achieve better model configuration. After experimental comparison, the results show that the performance of the technical solution proposed by the present invention on relevant data sets has been significantly improved compared with other existing similar methods, and can cope with ever-changing network threats. Summary of the invention

[0005] In view of the above situation, the present invention proposes a network traffic anomaly detection method and system based on the combination of TabTransformer and genetic algorithm, which is used to solve the technical problem of low accuracy in abnormal network traffic prediction.

[0006] In order to achieve the above purpose, the present invention first pre-processes the relevant network traffic data, that is, converts the non-digital features contained in the data set into digital features, and then normalizes and divides the entire data set; next, the TabTransformer model is used to learn and train the processed training data set; then the hyperparameters of the model training are optimized based on the genetic algorithm to obtain the network model with the best performance; finally, the test data set is input into the trained model to obtain the prediction results to measure the final prediction performance of the model. Compared with the prior art, the technical solution proposed by the present invention can improve the accuracy of abnormal network traffic prediction and has superior performance.

[0007] The technical solution adopted by the present invention is as follows:

[0008] A network traffic anomaly detection method based on the combination of TabTransform and genetic algorithm comprises the following steps:

[0009] S1, preprocessing the data of the network traffic data set, and dividing the preprocessed data set into a training data set and a test data set according to a set ratio;

[0010] S2. Use the Transformer-based TabTransformer model to learn and train the preprocessed training data set end-to-end. The self-attention mechanism in the model can effectively capture the dependencies and correlations between different cells in the network traffic data without manually designing feature extractors or preprocessors.

[0011] S3. Optimize the hyperparameters in model training based on genetic algorithms to obtain the hyperparameters and corresponding models with the best model performance in the entire training process;

[0012] S4. Input the test data set into the trained model, obtain the label data of each predicted flow, and then count the prediction results of all flows to measure the final prediction performance of the model.

[0013] Furthermore, the preprocessing in step S1 includes: converting non-digital features in the data set into digital features, performing null value check and normalization on the data in the data set, and then performing data segmentation according to the correlation between the features.

[0014] Furthermore, the specific steps of the preprocessing of step S1 are as follows:

[0015] S1-1. Network data sets usually contain digital features and character features. In order to process and analyze data information, these symbolic features need to be digitized, that is, the non-digital features in the network traffic data set are converted into digital features; some features such as "flag" or "logged_in" have only two values ​​of "yes" or "no", and can be encoded into digital 1 or 0 through direct encoding; and some features such as "protocol_type" have three possible values, namely "tcp", "udp" and "icmp", and the classic one-hot encoding needs to be used to encode these features, and the compiled results are "100", "010" and "001" respectively;

[0016] S1-2. Some data sets may contain null values, which may distort the results or cause errors in the model during training. Therefore, it is necessary to calculate the correlation matrix of the features and exclude any features with a correlation value greater than 0.95 with other features. This process ensures that each feature provides unique information for the model.

[0017] S1-3. Even if the processed numerical features can be trained directly, the large difference in the numerical range between the features will affect the training effect of the model. Therefore, it is necessary to normalize the data in the dataset so that all values ​​are in the range of [0,1]. For general numerical features, the linear normalization process is as follows:

[0018]

[0019] Among them, X represents the original data under a single feature, X max and X min Respectively represent the maximum and minimum values ​​of all values ​​in a single feature;

[0020] S1-4. Divide the data into several groups according to the feature correlation in the data set. The features in each group are strongly correlated, while the features between groups are weakly correlated. This approach can separate irrelevant features and avoid the influence of additive correlation.

[0021] Further, step S2 is specifically as follows:

[0022] S2-1. The preprocessed training data set is fed into the TabTransformer model for learning and end-to-end training. In the model, the classification features in the network traffic data, such as "protocol_type", "service", and "flag", are converted into embeddings by the embedding layer to capture the relationship between different categories; x represents the original classification feature, and F C To represent the transformed classification features, it is expressed as follows:

[0023] F C =Categorical_Embedding(x)

[0024] S2-2. The remaining numerical features in the data are directly input into a sequence of fully connected layers. After identifying the complex patterns and correlations in the numerical feature domain, these numerical features are standardized; x′ represents the remaining numerical features, F N Represents the standardized digital features, expressed as:

[0025] F N =Layer_Normalization(x′)

[0026] S2-3. In order to ensure that all features can be used, the converted categorical features and numerical features are connected in series and their semantic relationships are merged to make the feature set the most complete.

[0027] F = Concatenate(F C ,F N )

[0028] S2-4, the combined features are then passed forward to a binary classification layer consisting of a fully connected layer and a softmax activation function to calculate the probability and thus distinguish whether the network is normal or abnormal.

[0029] In summary, through the architecture of TabTransformer, the present invention designs an abnormal network traffic detection method. However, in order to enable the model to perform at its best, the hyperparameter setting of the model during the training process has a considerable impact on the final prediction accuracy.

[0030] Furthermore, the optimization in step S3 includes: initialization, evaluation, selection, crossover, mutation, replacement and termination.

[0031] Furthermore, in step S3, the hyperparameters are optimized based on the genetic algorithm and the hyperparameter set of the TabTransformer model, where P represents the hyperparameter set of the model and G represents the maximum number of generations; specifically:

[0032] S3-1. Initialize and randomly generate a population P0(P) of size |P| under constraints. For each individual x in P, the TabTransformer model is trained and validated using the hyperparameter x to calculate the fitness φ(x).

[0033] S3-2, selecting individuals from P as corresponding father and mother generations according to the fitness scores, and the selection method includes roulette wheel selection, etc.; then hybridizing each pair of parents to produce offspring, which includes mixing hyperparameters from two parents to produce one or more offspring;

[0034] S3-3, impose mutations on the offspring with a certain probability, which is equivalent to randomly modifying some hyperparameters within the allowed range, and then replacing unsuitable individuals with offspring to update the population;

[0035] S3-4. If the stopping condition is met, such as reaching the G generation or reaching the desired fitness, the individual with the highest fitness is returned, otherwise continue with step S3-1.

[0036] Further, step S4 is specifically as follows:

[0037] S4-1, obtaining the optimal parameters from step S3-4 and obtaining the final model after corresponding training, and then inputting the test data set into the model in sequence to obtain the prediction result corresponding to each flow;

[0038] S4-2. The parameters for measuring the performance of the model in predicting abnormal network traffic mainly include precision, recall and F1-Score. Among them, precision calculates the proportion of correctly classified samples to all detected samples, and the formula is:

[0039]

[0040] Among them, TP is the number of positive examples correctly classified by the model, and FP is the number of negative examples incorrectly classified by the model;

[0041] The calculation formula for recall is:

[0042]

[0043] Among them, FN is the number of positive examples misclassified by the model;

[0044] F1-Score calculates the harmonic mean of precision and recall, and the formula is:

[0045]

[0046] The present invention also discloses a network traffic anomaly detection system based on the combination of TabTransform and genetic algorithm, based on the above method, including the following modules:

[0047] Preprocessing module: preprocess the data in the network traffic data set, and divide the preprocessed data set into a training data set and a test data set according to a set ratio;

[0048] Model training module: Use the TabTransformer model to learn and perform end-to-end model training on the preprocessed training data set;

[0049] Hyperparameter optimization module: optimizes the hyperparameters in model training based on genetic algorithms to obtain the hyperparameters and corresponding models with the best model performance during the entire training process;

[0050] Model prediction performance measurement module: Input the test data set into the trained model, obtain the label data of each predicted flow, and count the prediction results of all flows to measure the prediction performance of the model.

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

[0052] 1. The present invention uses the TabTransformer model designed based on the Transformer architecture to detect abnormal network traffic. TabTransformer can effectively process and classify digital features and has the ability to capture complex relationships in tabular data. It is a powerful tool for real-time detection of abnormal network traffic and threats.

[0053] 2. The present invention uses a genetic algorithm to fine-tune the hyperparameters of the TabTransformer model. Extensive experimental results also prove that appropriate hyperparameter optimization can greatly improve the performance of the model, thereby effectively playing the role of the model in abnormal network traffic detection.

[0054] In summary, the network traffic anomaly detection method and system based on the combination of TabTransformer and genetic algorithm in the present invention can effectively improve the accuracy of detecting abnormal traffic and is more efficient in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 The present invention is a flowchart of a method for detecting anomalies in network traffic based on the combination of TabTransform and genetic algorithm according to a preferred embodiment of the present invention.

[0056] Figure 2 This is the architecture diagram of the TabTransformer model.

[0057] Figure 3 The figure is a comparison chart of indicators of the present invention and other models in the prior art on the test network traffic data set.

[0058] Figure 4 This is a block diagram of a network traffic anomaly detection system based on the combination of TabTransform and genetic algorithm according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0059] In order to better understand the technical solution of the present invention, the specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings, so that those skilled in the art can understand the present invention. It should be clear that the described implementations and all other implementations obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention.

[0060] like Figure 1 As shown, this embodiment is a network traffic anomaly detection method based on the combination of TabTransformer and genetic algorithm, which specifically includes the following steps:

[0061] S1. Preprocess the network traffic data to convert the non-digital features in the data set into digital features, then perform null value check and normalization on the data in the data set, and then segment the data according to the correlation between the features. The final processed data set will be divided into a training data set and a test data set according to a certain ratio;

[0062] S2. Use the Transformer-based TabTransformer model to learn and train the preprocessed training data set end-to-end. The self-attention mechanism in the model can effectively capture the dependencies and correlations between different cells in the network traffic data without manually designing feature extractors or preprocessors.

[0063] S3. Optimize the hyperparameters in model training based on genetic algorithms. The designed steps mainly include: initialization, evaluation, selection, crossover, mutation, replacement and termination, and finally obtain the hyperparameters and corresponding models with the best model performance in the whole training process;

[0064] S4. Input the test data set into the trained model, obtain the label data of each predicted flow, and then count the prediction results of all flows to measure the final prediction performance of the model.

[0065] The following is a detailed description of each step of this embodiment.

[0066] In step S1 of this embodiment:

[0067] S1-1. Network datasets usually contain digital features and character features. In order to process and analyze data information, these symbolic features need to be digitized. Some features, such as "flag" or "logged_in", have only two values, "yes" or "no". They can be encoded into numbers 1 or 0 through direct encoding. Some features, such as "protocol_type", have three possible values, "tcp", "udp" and "icmp". In this case, classic one-hot encoding is needed to represent and encode these features. The results of the encoding are "100", "010" and "001" respectively.

[0068] S1-2. Some data sets may contain null values, which may distort the results or cause errors in the model during training. Therefore, it is necessary to calculate the correlation matrix of the features and exclude any features with a correlation value greater than 0.95 with other features. This process ensures that each feature provides unique information for the model.

[0069] S1-3. Even if the processed numerical features can be trained directly, the large difference in the numerical range between the features will affect the training effect of the model. Therefore, it is necessary to normalize the data in the dataset so that all values ​​are in the range of [0,1]. For general numerical features, the linear normalization process is as follows:

[0070]

[0071] Among them, X represents the original data under a single feature, X max and X min Respectively represent the maximum and minimum values ​​of all values ​​in a single feature;

[0072] S1-4. Divide the data into several groups according to the correlation of features in the data set. The features in each group are strongly correlated, while the features between groups are weakly correlated. This approach can separate irrelevant features and avoid the influence of additive correlation.

[0073] In this embodiment, step S2 is specifically as follows:

[0074] S2-1. The preprocessed training data set is fed into the TabTransformer model for learning and end-to-end training. In the model, the classification features in the network traffic data, such as "protocol_type", "service", and "flag", are converted into embeddings by the embedding layer to capture the relationship between different categories; x represents the original classification feature, and F CTo represent the transformed classification features, it can be expressed as follows:

[0075] F C =Categorical_Embedding(x)

[0076] S2-2. The remaining numerical features in the data are directly input into a sequence of fully connected layers. After identifying the complex patterns and correlations in the numerical feature domain, these numerical features are standardized and represented by x′. N represents the standardized numerical features, which can be expressed as:

[0077] F N =Layer_Normalization(x′)

[0078] S2-3. In order to ensure that all features can be used, the converted categorical features and numerical features are connected in series and their semantic relationships are merged to make the feature set F the most complete:

[0079] F = Concatenate(F C ,F N )

[0080] S2-4, the combined features are then passed forward to a binary classification layer consisting of a fully connected layer and a softmax activation function to calculate the probability and thus distinguish whether the network is normal or abnormal.

[0081] In summary, through the architecture of TabTransformer, the present invention designs an abnormal network traffic detection method. However, in order to enable the model to perform at its best, the hyperparameter setting of the model during the training process has a considerable impact on the final prediction accuracy.

[0082] In this embodiment, in step S3, the hyperparameters are optimized based on the genetic algorithm and the hyperparameter set of the TabTransformer model, where P represents the hyperparameter set of the model and G represents the maximum number of generations; specifically, as follows:

[0083] S3-1. Initialize and randomly generate a population P0(P) of size |P| under constraints. For each individual x in P, the TabTransformer model is trained and validated using the hyperparameter x to calculate the fitness φ(x).

[0084] S3-2, selecting individuals from P as corresponding father and mother generations according to the fitness scores, and the selection method includes roulette wheel selection, etc.; then hybridizing each pair of parents to produce offspring, which includes mixing hyperparameters from two parents to produce one or more offspring;

[0085] S3-3, impose mutations on the offspring with a certain probability, which is equivalent to randomly modifying some hyperparameters within the allowed range, and then replacing unsuitable individuals with offspring to update the population;

[0086] S3-4. If the stopping criteria are met, such as reaching the G generation or reaching the desired fitness, the individual with the highest fitness is returned, otherwise the process in step S3-1 is continued.

[0087] In this embodiment, step S4 is specifically as follows:

[0088] S4-1, obtaining the optimal parameters from step S3-4 and obtaining the final model after corresponding training, and then inputting the test data set into the model in sequence to obtain the prediction result corresponding to each flow;

[0089] S4-2. The parameters for measuring the performance of the model in predicting abnormal network traffic mainly include precision, recall and F1-Score. The precision rate is calculated as the proportion of correctly classified samples to all detected samples. The formula is:

[0090]

[0091] Among them, TP is the number of positive examples correctly classified by the model, and FP is the number of negative examples incorrectly classified by the model;

[0092] The calculation formula for recall is:

[0093]

[0094] Among them, FN is the number of positive examples misclassified by the model;

[0095] F1-Score calculates the harmonic mean of precision and recall, and its formula can be expressed as:

[0096]

[0097] like Figure 2The following figure shows the architecture of the TabTransformer model. As can be seen from the figure, the architecture of the model can be roughly divided into five processes, namely, standardizing digital features and passing them forward, embedding classification features, processing embedding through N transformer blocks to obtain context embedding, concatenating context classification embedding with digital features, and concatenating through MLP to obtain the required prediction. Although the architecture of the model is relatively simple, the added Transformer can significantly improve the computing performance. TabTransformer uses a multi-layer Transformer encoder to process tabular data. Each encoder layer consists of a multi-head self-attention mechanism and a feedforward neural network. In order to capture the relationship between cells, TabTransformer uses a feature crossover method. Specifically, each cell will cross with other cells in the table to generate a new feature vector. The advantage of using TabTransformer to classify abnormal network traffic is that TabTransformer uses the self-attention mechanism in the Transformer architecture to effectively capture the complex relationship between different cells in network traffic data, including dependencies and correlations between cells. However, traditional models such as linear models or tree-based models are difficult to effectively capture nonlinear relationships in tabular data. Secondly, TabTransformer is able to utilize contextual information around each cell, not just local features. This allows for a more comprehensive understanding of the content in network traffic data. Finally, TabTransformer uses an end-to-end learning approach, and the entire model can be trained together without manually designing feature extractors or preprocessors, which simplifies the model building process and makes it easier to extend the model to different tasks or data sets.

[0098] To evaluate the embedding capacity of the proposed method, the performance of the proposed method was compared with other prior art models on the same network traffic dataset. Figure 3 It can be seen from the comparison results that the method proposed in the present invention is superior to all the comparison methods in terms of precision, recall rate and F1-Score, demonstrating the performance advantage of the method of the present invention.

[0099] The present invention uses the TabTransformer model designed based on the Transformer architecture to detect abnormal network traffic. TabTransformer can effectively process and classify digital features, and has the ability to capture complex relationships in tabular data. It is a powerful tool for real-time detection of abnormal network traffic and threats. In addition, the present invention uses a mature evolutionary algorithm genetic algorithm to fine-tune the hyperparameters of the TabTransformer model. Extensive experimental results also prove that appropriate hyperparameter optimization can greatly improve the performance of the model, thereby effectively playing the role of the model in abnormal network traffic detection.

[0100] like Figure 4 As shown, this embodiment discloses a network traffic anomaly detection system based on the combination of TabTransform and genetic algorithm, which includes the following modules based on the above method embodiment:

[0101] Preprocessing module: preprocess the data in the network traffic data set, and divide the preprocessed data set into a training data set and a test data set according to a set ratio;

[0102] Model training module: Use the TabTransformer model to learn and perform end-to-end model training on the preprocessed training data set;

[0103] Hyperparameter optimization module: optimizes the hyperparameters in model training based on genetic algorithms to obtain the hyperparameters and corresponding models with the best model performance during the entire training process;

[0104] Model prediction performance measurement module: Input the test data set into the trained model, obtain the label data of each predicted flow, and count the prediction results of all flows to measure the prediction performance of the model.

[0105] For other contents of this embodiment, please refer to the above method embodiment.

[0106] In summary, the network traffic anomaly detection method and system based on the combination of TabTransformer and genetic algorithm in the present invention can effectively improve the accuracy of detecting abnormal traffic and is more efficient in practical applications.

[0107] The above-described embodiments are only preferred solutions of the present invention, but they are not intended to limit the present invention. A person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent conversion falls within the protection scope of the present invention.

Claims

1. A network traffic anomaly detection method based on TabTransform and genetic algorithm, characterized in that: The steps include: S1, preprocessing the data in the network traffic data set, and dividing the preprocessed data set into a training data set and a test data set according to a set ratio; S2. Use the TabTransformer model to learn and perform end-to-end model training on the preprocessed training data set; S3. Optimize the hyperparameters in model training based on genetic algorithms to obtain the hyperparameters and corresponding models with the best model performance in the entire training process; S4. Input the test data set into the trained model, obtain the label data of each predicted flow, and count the prediction results of all flows to measure the prediction performance of the model.

2. The network traffic anomaly detection method according to claim 1, characterized in that: The preprocessing in step S1 includes: converting the non-digital features in the network traffic data set into digital features, performing null value check and normalization on the data in the data set, and then performing data segmentation according to the correlation between the features.

3. The network traffic anomaly detection method according to claim 2, characterized in that: The specific steps of preprocessing in step S1 are as follows: S1-1,Convert non-digital features in network traffic datasets into digital features; S1-2, calculate the correlation matrix of digital features, and exclude features with correlation values ​​greater than 0.95 with other features; S1-3, normalize the data in the dataset so that all values ​​are in the range of [0,1]; The normalization process is as follows: Among them, X represents the original data under a single feature, X max and X min Respectively represent the maximum and minimum values ​​of all values ​​in a single feature; S1-4. Group the data by features based on the feature correlation in the data set. The correlation between features in each group is stronger than the correlation between features between groups.

4. The network traffic anomaly detection method according to any one of claims 1 to 3, characterized in that: Step S2 is specifically as follows: S2-1. The preprocessed training data set is fed into the TabTransformer model for learning and end-to-end training. In the model, the classification features in the network traffic data are converted into embeddings by the embedding layer and capture the relationship between different categories. x represents the original classification features, and F C To represent the transformed classification features, it is expressed as follows: F C =Categorical_Embedding(x) S2-2. The remaining numerical features in the data are input into a sequence of fully connected layers. After identifying the patterns and correlations in the numerical feature domain, these numerical features are standardized and the remaining numerical features are represented by x′, F N Represents the standardized digital features, expressed as: F N =Layer_Normalization(x′) S2-3. Connect the converted categorical features and numerical features in series and merge their semantic relationships to make the feature set F complete: F=Concatenate(F C ,F N ) S2-4. The combined features are passed to the binary classification layer consisting of a fully connected layer and a softmax activation function to calculate the probability to distinguish whether the network is normal.

5. The network traffic anomaly detection method according to any one of claims 1 to 3, characterized in that: The optimization in step S3 includes: initialization, evaluation, selection, crossover, mutation, replacement and termination.

6. The network traffic anomaly detection method according to claim 5, characterized in that: In step S3, the hyperparameters are optimized based on the genetic algorithm and the hyperparameter set of the TabTransformer model, where P represents the hyperparameter set of the model and G represents the maximum number of generations; specifically, as follows: S3-1. Initialize and randomly generate a population P0(P) of size |P| under constraints. For each individual x in P, train and validate the TabTransformer model using the hyperparameter x to calculate the fitness φ(x). S3-2, select individuals from P according to the fitness score, and then cross each pair of parents to produce offspring; S3-3, impose mutations on offspring with a set probability, and then use offspring to replace unfit individuals to update the population; S3-4. If the stopping condition is met, the individual with the highest fitness is returned, otherwise the process returns to step S3-1.

7. The network traffic anomaly detection method according to claim 6, characterized in that: In step S3-4, the stopping condition is: reaching the G generation or reaching the set fitness.

8. The network traffic anomaly detection method according to claim 6, characterized in that: Step S4 is specifically as follows: S4-1, obtaining the optimal parameters from step S3-4 and obtaining the corresponding trained model, inputting the data in the test data set into the model in sequence, and obtaining the prediction results corresponding to each flow; S4-2. The parameters for measuring the performance of the model in predicting abnormal network traffic include precision, recall, and F1-Score. Among them, precision calculates the proportion of correctly classified samples to all detected samples, and the formula is: Among them, TP is the number of positive examples correctly classified by the model, and FP is the number of negative examples incorrectly classified by the model; The calculation formula for recall is: Among them, FN is the number of positive examples misclassified by the model; F1-Score calculates the harmonic mean of precision and recall, and the formula is:

9. A network traffic anomaly detection system based on a combination of TabTransform and genetic algorithm, based on the method according to any one of claims 1 to 8, characterized in that: Includes the following modules: Preprocessing module: preprocess the data in the network traffic data set, and divide the preprocessed data set into a training data set and a test data set according to a set ratio; Model training module: Use the TabTransformer model to learn and perform end-to-end model training on the preprocessed training data set; Hyperparameter optimization module: optimizes the hyperparameters in model training based on genetic algorithms to obtain the hyperparameters and corresponding models with the best model performance during the entire training process; Model prediction performance measurement module: Input the test data set into the trained model, obtain the label data of each predicted flow, and count the prediction results of all flows to measure the prediction performance of the model.

Citation Information

Cited By

  • Encrypted traffic threat detection method and system based on deep learning

    CN119363412A