Network traffic classification method oriented to class imbalance
Through the group distribution robust optimization and Stackelberg game optimization steps, the decision boundary shift problem caused by class imbalance in network traffic data is solved, the performance of network traffic classification is improved, and balanced identification of minority and majority classes is achieved.
Patent Information
- Application Number
- CN202410766822.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-06-14
AI Technical Summary
In network traffic data, the classification model caused by class imbalance has poor recognition performance for minority classes and good recognition performance for majority classes, causing the decision boundary to shift and affecting the optimal solution of the machine learning model.
Design mitigation strategies for class imbalance through group distribution robust optimization, iteratively update non-parametric weights of different categories, use Stackelberg game optimization steps to optimize the learning model by minimizing reweighted losses, propose GDR-CIL method, group distribution robust optimization Suppress class imbalance effects.
It effectively suppresses the negative impact of class imbalance, improves the comprehensive performance of prediction, and improves the accuracy and robustness of network traffic classification.
Smart Images

Figure CN118747320A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of network data analysis, and in particular relates to a network traffic classification method oriented to class imbalance. Background Art
[0002] The problem of class imbalance in network traffic classification is common in network data analysis. It mainly refers to the significant difference in the amount of data of different categories in network traffic data, which leads to the challenge of imbalance in the training of classification models. The problem of class imbalance in network traffic classification is of great significance to practical network applications. For example, in scenarios such as QoS guarantee, content-based billing, network planning, and bandwidth management, effective traffic classification can help optimize network performance, improve service quality, reduce network congestion, and provide better decision support for enterprises.
[0003] Specifically, this class imbalance may lead to poor recognition performance of the model for the minority class and good recognition performance for the majority class. In network traffic data, this imbalance may manifest as the difference in the number of large flows (such as elephant flows) and small flows (such as mouse flows), or the scarcity of specific types of traffic. Since most of the traffic may belong to certain common categories, while certain specific, uncommon traffic types may only account for a small proportion, this will have a negative impact on the performance of the classifier.
[0004] Internet services have led to a surge in traffic, and machine learning has become an indispensable tool for analyzing this Internet data, especially when applications are risk-sensitive. The network traffic classification problem under the class imbalance phenomenon that is prevalent in network data analysis often shifts the optimal decision boundary, resulting in a less than ideal optimal solution for the machine learning model. Summary of the invention
[0005] In view of this, in order to mitigate this effect, this application proposes a strategy to mitigate class imbalance through group distribution robust optimization. The method of this application iteratively updates the non-parametric weights of different categories and optimizes the learning model by minimizing the reweighted loss. This application explains the optimization steps from the perspective of Stackelberg game and conducts extensive experiments on typical data sets. The results show that this application can not only suppress the negative impact of class imbalance, but also improve the overall performance of prediction.
[0006] The network traffic classification method for class imbalance disclosed in the present application comprises the following steps:
[0007] Collect network traffic data, that is, collect network data through network packet capture tools such as wireshark.
[0008] Initialize training parameters, including maximum number of iterations T and batch size N b ; learning rate ∈; temperature hyperparameter β; number of groups K; sizes of the K groups n1,…,n K ; Allocation matrix Γ; Calibration hyperparameter B; Number of categories Weight vector ω, model initial parameters θ (1) , the weight of each group ω k (0) ;
[0009] Calculate the calibration vector
[0010] Start iterative training, including:
[0011] Randomly sample a batch of training samples; calculate the empirical risk of each class at iteration t; calculate the group risk; estimate the group weights; update the model parameters to obtain θ by using the stochastic gradient descent method with a learning rate of ∈ (t+1) ;
[0012] The iteration ends;
[0013] Output traffic data classification labels. Classification labels include normal, harmless network traffic and many different types of attacks, including "Denial of Service (DoS)", "Probe", "User to Root (U2R)" and "Remote to Local (R2L)" and so on.
[0014] Preferably, the weight ω k (0) The value of
[0015] Preferably, the calibration vector Where n k is the number of training samples in the kth group.
[0016] Preferably, the training samples in t is the iteration number, For each flow data vector, R d is a d-dimensional real vector space, which is the input of the classification. represents the true label of each input feature, Represents the grouping label of each input feature x, N b is the batch size.
[0017] Preferably, the group risk is calculated as follows:
[0018]
[0019] in represents the loss vector at the group level, whose kth element corresponds to the sum of the losses within the group If the kth group contains the cth class, γ k,c is equal to 1, otherwise it is equal to 0. represents the allocation matrix, the loss term represents the loss vector for each class, l(D c ; θ) is the loss of the cth class.
[0020] Preferably, the grouping weights are estimated as follows:
[0021]
[0022] Among them, ω (t) is the model parameter θ (t) The weight vector of each group under i (t) is the weight value of the i-th element in ω at the t-th iteration, ω i (t) is the weight value of the i-th element in ω at the t-1th iteration, l g (D k θ (t) ) is the last evaluated performance of class k, β represents the temperature hyperparameter that controls the loss value, v i and v k is the calibration vector The i-th and k-th elements in .
[0023] Preferably, by using stochastic gradient descent with a learning rate ∈ and ω (t) , update the model parameters to obtain θ (t+1) ,include:
[0024]
[0025] θ (t+1) and θ (t) are the model parameters of the tth round and the t+1th round respectively.
[0026] The beneficial effects of the present invention are as follows:
[0027] This application proposes a simple and effective risk-sensitive method GDR-CIL for unbalanced network traffic data classification. The use of group-wise blue stick optimization suppresses the impact of class imbalance. This application transforms the optimization steps into Stackelberg games. Experimental results show the potential of this application in risk-sensitive and class-imbalanced situations. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Flowchart of the present invention;
[0029] Figure 2 The amount of data for each category in the three datasets. DETAILED DESCRIPTION
[0030] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.
[0031] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0032] The technical solution provided in the embodiments of the present application relates to machine learning technology of artificial intelligence, which is specifically introduced and explained through the following embodiments.
[0033] Before introducing the embodiments of the present application, some terms involved in the present application are first explained.
[0034] 1. Network traffic classification: For each traffic data vector, it is used as the input for classification. represents the true label of each input feature. The classification model can be represented as θ∈Θ, where Θ is the set of all classification models. p(x,y) represents the distribution of data points. The relevant dataset is Where N represents the number of training samples. This application divides the dataset into Where D c represents a data point belonging to class c.
[0035] The goal of network traffic classification is to learn a mapping This mapping minimizes the classification error as much as possible, e.g.
[0036] 2. Multi-class imbalanced learning
[0037] A deep learning model is used to classify multi-class unbalanced network traffic. A fully connected deep neural network (DNN) is a universal backbone network for multi-classification. Mathematically, DNN consists of a feature extraction module. and output modules Therefore, the estimated probability of a data point in all classes can be calculated as follows:
[0038]
[0039] The model parameters θ∶={Φ,Φ o}, For the prediction results.
[0040] Furthermore, based on formula (1), the negative log-likelihood is introduced As a loss function for multi-classification:
[0041]
[0042] 3. Stackelberg Game
[0043] The two-player Stackelberg game is a strategic interaction model often used in game theory. In this game, two competitors take turns to participate in the decision-making process to maximize their utility functions. First a decision is made, followed by a process called The focus of this application is the two-player zero-sum Stackelberg game, which is mathematically described as Indicates the player The action space of the player The action space, and Respectively represent players and players The utility function of .
[0044] At the heart of the Stackelberg game is the concept of strategic leadership, whereby the actions of a leader influence the subsequent decisions of followers. Recognizing this influence, leaders strategically choose actions to maximize their own utility while taking into account the reactions of followers. Conversely, followers, recognizing the leader's choices, will optimize their own decisions accordingly.
[0045] therefore, The equilibrium can be solved by backward induction, that is, (3.a: Leader’s decision)
[0046] (3.b: Follower's decision)
[0047] Note that the constraint in equation (3.a) is called the leader in game theory. The best response function of the leader is the sum of the responses of the leaders. This sequential structure essentially provides a strategic advantage to the leader, as it can predict and preempt the responses of the followers. Stackelberg games are therefore characterized by asymmetric power dynamics between leaders and followers, with the strategic assumptions of the leader influencing subsequent interactions between the players.
[0048] The presence of class imbalance often leads to decision boundary shift, which can be risky or even catastrophic in network traffic classification scenarios. One feasible way to mitigate this effect is to penalize classification errors by adjusting the weights of individual classes. However, effectively implementing weight distribution during training remains a thorny problem, and there are limited mechanisms to explain this process. To this end, this application introduces the Grouped Distributed Robust Class Imbalance Learner (GDR-CIL) as a competitive candidate to address this issue. See Algorithm 1 for details.
[0049]
[0050]
[0051] In machine learning, empirical risk It is the average of the loss functions on the training set, which measures the degree of prediction error of the model on the training data. For class imbalance learning problems, the calculation of empirical risk is similar to the normal case, but it may be necessary to consider the impact of class imbalance, such as using a weighted loss function to balance the contribution of different classes. In this way, the calculation of empirical risk takes into account the impact of class imbalance and helps to train a model with balanced performance on all classes. Empirical risk The calculation method of is the prior art in the field and will not be described in detail in this application.
[0052] S1 Robustness
[0053] This application simplifies the decision boundary offset problem in class imbalance learning into a distribution robustness problem. In the application, the robustness of the minority class classification performance is considered. To this end, the optimization problem with class imbalance is transformed into:
[0054]
[0055] Among them, the loss represents the loss vector for each class, and η corresponds to is an element of , which is a (C-1)-dimensional simplex, The term serves as a regularizer to prevent η from collapsing into a vertex.
[0056] The maximum-minimum optimization problem in formula (4) can be understood as a two-player zero-sum Stackelberg game. The weights of different categories are adjusted on the probability simplex to maximize The minimization operator is performed in the parameter space, corresponding to Followers in Its utility function is
[0057] S2 constructs an alternative loss function
[0058] Different from the existing methods, this application summarizes class imbalance learning as robust optimization at the level of class grouping. It is assumed that multiple classes retain unobservable grouping structure in the loss, and setting different weights for the set of groups in the optimization can balance the performance of all classes. To this end, this application performs the following training pipeline to obtain a robust classifier: 1) clustering classes into groups based on the initial verification performance based on a heuristic algorithm; 2) evaluating the performance of the classifier on these groups based on the updated model parameters; 3) updating the weights and model parameters of the groups accordingly based on the learning loss; 4) looping steps (2) / (3) until convergence.
[0059] S21 Grouping categories in an imbalanced dataset
[0060] First, the present application uses the collected dataset to perform standard supervised initialization training on the aforementioned backbone model, that is, no class imbalance suppression mechanism is used (this initialization training process is to empirically evaluate the class imbalance situation). Then, based on the initial training results of the validation dataset, the present application adopts the following clustering strategy: 1) Classes with almost zero F1 scores are treated as separate groups; 2) The number of instances of each class is used as input to cluster the remaining classes into other limited groups. This design pays more attention to a few classes that are difficult to distinguish. In addition, the present application also notes that the results of most classes with similar training samples are close to each other in terms of initial training performance. In view of this, the present application uses empirical evaluation and observed results as prior knowledge to heuristically define groups based on training data.
[0061] For example, the CIC-IDS2017 dataset is used as an example. For a few categories with an F1 score of 0 in the initial standard training, this application groups these categories separately. For other categories, this application uses a data clustering algorithm (such as K-means) to group categories with similar numbers of training samples. The purpose of the initial training is to determine the number of groups for formal training. After the grouping mechanism is adopted, the training data consists of (x, y, g) triplets, where represents the grouping label of each input feature x, and K represents the number of groups, which varies depending on the dataset.
[0062] S22 grouping blue stick loss function
[0063] The distribution of data points can be written as p(x, y, g). Given an integer K as the number of groups, this application uses represents the assignment matrix, where if the kth group contains the cth class, γ k,c is equal to 1, otherwise it is equal to 0. The number of groups is generally smaller than the number of classes, that is Therefore, the loss of each group can be expressed as:
[0064]
[0065] in represents the loss vector at the group level, whose kth element corresponds to the sum of the losses within the group Of course, the application expects that the classification model can have good generalization performance in both the average and worst-case groups. However, there are differences in the generalization gap between the groups, which leads to the gap between the average and worst-case test performance. In order to narrow this gap, the application attempts to reduce the training loss in the group with a large generalization gap. Specifically, the application constructs Where n k is the number of training samples in the kth group, and B is the model calibration constant as a hyperparameter. The scaling of reflects that small groups are more likely to overfit than large groups. By using group calibration, the model is more likely to fit smaller groups.
[0066] S23 Iteratively estimates the weights of each group
[0067] The present application uses the above grouping mechanism to obtain the weight of each group. In order to balance different groups, the present application sets the weight of each group to ω = [ω1, ..., ω K ] T ∈Δ K On, where ω k ≥0 is the weight of the kth group. In the proposed method, categories within a group share the same weight, while different groups have different weights. That is, when the i-th and j-th categories belong to the k-th group, η i =η j =ω k Therefore, the minimum optimization problem in formula (4) is further regularized as follows:
[0068]
[0069] The optimization problem in formula (6) can be interpreted as an approximate solution to a random two-player zero-sum Stackelberg game: The two players compete in turn to maximize The utility functions of each of them can be represented as
[0070]
[0071] To obtain the above optimal response approximately, let ω (t) is the model parameter θ (t) The weight vectors of each group under , then the update rule of the i-th element in ω in the t-th iteration is:
[0072]
[0073] Among them l g (D k θ (t) ) is the last evaluated performance of class k, β represents the temperature hyperparameter that controls the magnitude of the loss value.
[0074] For updating the model parameters, this application uses the stochastic gradient descent method for θ, with a learning rate of ∈ and a sampling batch of samples of D~p(D):
[0075]
[0076] S24 Solution in GDR-CIL
[0077] Next, this application will focus on another key question in this part: What is the concept of convergence point in the game? In response to this question, this application needs to Here, the present application introduces the global Stackelberg equilibrium as a solution concept.
[0078] Definition 1 (Global Stackelberg Equilibrium): Let (ω * ,θ * )∈Δ K ×Θ is the solution. In the leader ω * ∈Δ K and the follower θ * ∈Θ, if the following inequality is satisfied, then (ω * ,θ * ) is called the global Stackelberg equilibrium: and
[0079] Proposition 1 (Existence of equilibrium): Assuming Θ is compact, A global Stackelberg equilibrium always exists.
[0080] Proof due to is continuous with respect to ω and θ, and Both θ and θ are compact, so according to the extreme value theorem, Proposition 1 holds.
[0081] The present application can further explain the obtained equilibrium (ω * ,θ * ). That is, the leader has specified the optimal strategy ω for reweighting different groups * , and the followers except θ * In addition to , no other model parameters can be found to minimize the negative impact of class imbalance in the worst group. Therefore, this application can obtain a robust class imbalance learner from the designed optimization strategy.
[0082] This application uses three typical datasets to examine the performance of the proposed method, including the CIC-IDS2017, NSL-KDD, and UNSW-NB15 datasets. Figure 2 The data volume of each category in the three datasets is shown. It can be seen that the traffic data categories in these datasets are extremely unbalanced. Figure 2 In (a), “Others” contains 11 minority categories, namely DoSGoldenEye, FTP-Patator, DoS slowloris, DoS slowhttptest, SSH-Patator, Bot, WebAttack Brute Force, Web Attack XSS, Infiltration, Web Attack Sql Injection and Heartbleed, and the proportion of each category in the CIC-IDS2017 dataset is less than 0.5%.
[0083] CIC-IDS2017 is a commonly used intrusion detection dataset that contains 15 network traffic categories, including "BENIGN" (referring to normal, harmless network traffic) and 14 of the latest common attacks. It provides CSV (comma-separated value) files for machine learning and deep learning, each of which contains 78 different features, such as traffic duration, maximum packet length, minimum packet length, number of forward packets, etc.
[0084] NSL-KDD is also a network intrusion detection dataset. It consists of four sub-datasets in CSV format: KDDTest-21 and KDDTrain+20Percent are subsets of KDDTrain+ and KDDTest+ respectively. There are "normal" and 4 different types of attacks in these datasets, including "denial of service (DoS)", "probe (Probe)", "user to root (U2R)" and "remote to local (R2L)", such as Figure 2 (b) Each record in the dataset contains 41 features.
[0085] UNSW-NB15 is an intrusion assessment dataset released by the University of New South Wales in 2015. It contains 10 network traffic categories, including "normal" and 9 attack types. It includes a training set (UNSW NB15 training-set) and a test set (UNSW NB15 testing-set), both in CSV format, and each dataset contains 42 features.
[0086] Consider deep imbalanced learning for network traffic classification. Here, this paper compares GDR-CIL with typical and state-of-the-art (SOTA) baselines achieved by various strategies. They include expected risk minimization (ERM) loss, Focal loss, CB, Mixup-DRW, remmix-drw, LDAM-DRW, and LDR-KL.
[0087] 1) ERM loss: It assigns equal weights to all categories and adopts standard cross entropy as the optimization loss function.
[0088] 2) Focal loss: It adds a coefficient (1-p t )γ to reduce the loss weight of well-classified samples.
[0089] 3) CB loss: It uses the number of effective samples for each category (by calculation) to rebalance the losses.
[0090] 4) Mixup-DRW: It constructs virtual samples by linearly interpolating the features of two random samples in the training set with their labels using a mixing factor sampled from a beta distribution.
[0091] 5) Remix-DRW: It mixes the features of two samples in a Mixup manner and assigns the label of the minority class by giving it a disproportionately higher weight.
[0092] 6) LDAM-DRW: It enforces a class-dependent margin for multiple classes according to the label distribution, which is in the form of
[0093] 7) LDR-KL: Assign a distribution weight to each class label and regularize the worst-case loss of the distribution weight using the KL divergence function.
[0094] This application uses three classic evaluation indicators to evaluate the performance of all methods in the experiment: (1) Specificity: True negative rate, which measures the proportion of actual negative samples correctly predicted as negative. (2) F1 score: The harmonic mean of the other two performance indicators, precision and recall, is used to balance the performance. (3) G-mean: It is the geometric mean of specificity and recall.
[0095] The above comprehensive indicators are derived from the four basic indicators obtained by the classification model, namely, true positive (TP), false positive (FP), true negative (TN) and false negative (FN) in the confusion matrix. This paper considers multi-class network traffic classification; therefore, in the evaluation, samples from a specific traffic category are regarded as positive samples, and other samples are regarded as negative samples. Here, TP and TN represent the number of correctly classified positive samples and negative samples, respectively. FP represents the number of negative samples that are misclassified as positive, while FN represents the number of negative samples that are misclassified as positive. This application calculates the recall and precision from the basic indicators, that is, recall = TP / (TP+FN) and precision = TP / (TP+FP). The comprehensive indicators derived from this can be further obtained through calculation:
[0096]
[0097] It is worth noting that these indicators F1 score, specificity and G-mean are always positively correlated with the class imbalance performance, that is, the larger the indicator value, the better the performance.
[0098] This application randomly divides the dataset into a standard training-validation-test dataset. The validation dataset is used for hyperparameter configuration during training, and the test dataset is used to evaluate the experimental results. The dataset segmentation strategy is as follows.
[0099] For the CIC-IDS2017 dataset, Figure 2 As shown in (a), the amount of data in the majority class is much larger than that in the minority class, so this application randomly extracts 10,000 traffic samples from the class with more than 10,000 data, and the amount of data in other classes remains unchanged. Then, this application randomly divides the dataset into a training set (56%), a validation set (14%), and a test set (30%). The training set contains 91,784 samples, the validation set contains 22,946 samples, and the test set contains the remaining 49,171 samples.
[0100] For the NSL-KDD dataset, this application combines the KDDTest-21 set and the KDDTrain+20Percent set. Then, this application adopts the same training-validation-test set partitioning strategy as the CIC-IDS2017 dataset. The training set contains 20,743 samples, the validation set contains 5,186 samples, and the test set contains the remaining 11,113 samples.
[0101] For the UNSW-NB15 dataset, this application combines its training set and test set into one dataset. Figure 2 (c) shows a high class imbalance. This application uses the same extraction strategy as the CIC-IDS2017 dataset. Then, this application performs the same process as the CIC-IDS2017 dataset to split the dataset into training, validation, and test sets. The training set contains 37,346 samples, the validation set contains 9,337 samples, and the test set contains the remaining 20,008 samples.
[0102] Note that the number of groups K is heuristically defined, and the results of class clustering are based on the classification performance of the initial standard training and the number of training samples for each class. This application regards the relevant regularization term B and temperature β as hyperparameters. For the CIC-IDS2017 dataset, this application sets K=8, B=0.25 and β=0.005 based on the F1 score performance on the validation dataset. Similarly, in the NSL-KDD dataset, this application sets K=5, B=0.02 and β=0.15; in the UNSW-NB15 dataset, based on the performance of the validation dataset, this application sets K=10, B=0.02 and β=0.1.
[0103] This application provides the grouping results of each data set. In the CIC-IDS2017 data set, 15 categories are divided into 8 groups. The first group includes "BENIGN". The second group includes "DDoS", "DoS GoldenEye", "DoS Hulk", and "PortScan". The third group includes "SSH-Patator", "DoSSlowhttptest", "DoS slowloris", and "FTP-Patator". The fourth group consists of "Bot" and "Network Brute Force Attack". The remaining four categories represent another four groups. The NSL-KDD data set has 5 groups, each representing a category. Similarly, the UNSW-NB15 data set has 10 groups.
[0104] Without loss of generality, this application uses a multi-layer perceptron (MLP) as the backbone of a deep neural network. It is a fully connected neural network with two hidden layers, and ReLU is used as the activation function between the network layers. This application uses a stochastic gradient descent method to optimize the neural network, with a learning rate of 1e-2 and a weight decay rate of 1e-4.
[0105] To avoid overfitting, the MLP is enhanced with a dropout module with a learning rate of 0.2. The parameters of the MLP neural network are initialized by a truncated normal distribution with a standard deviation of 3e-2. The batch size is set to 128 by default. During the training phase, this application sets a learning rate scheduler that dynamically adjusts the learning rate based on the validation loss. Specifically, if the validation loss does not improve within six epochs, the learning rate will be halved, and the minimum learning rate will be reduced to 1e-6. If the validation loss does not decrease for 30 consecutive epochs, this application will stop training early. The network is trained for a maximum of 200 epochs.
[0106] The beneficial effects of the present invention are as follows:
[0107] This application proposes a simple and effective risk-sensitive method GDR-CIL for unbalanced network traffic data classification. The use of group-wise blue stick optimization suppresses the impact of class imbalance. This application transforms the optimization steps into Stackelberg games. Experimental results show the potential of this application in risk-sensitive and class-imbalanced situations.
[0108] As used herein, the word "preferred" is intended to be used as an example, instance, or illustration. Any aspect or design described herein as "preferred" is not necessarily to be construed as being more advantageous than other aspects or designs. On the contrary, the use of the word "preferred" is intended to present concepts in a specific way. The term "or" as used in this application is intended to mean an inclusive "or" rather than an exclusive "or". That is, unless otherwise specified or clear from the context, "X uses A or B" means any one of the naturally included permutations. That is, if X uses A; X uses B; or X uses both A and B, then "X uses A or B" is satisfied in any of the foregoing examples.
[0109] Moreover, although the present disclosure has been shown and described with respect to one or implementations, those skilled in the art will think of equivalent variations and modifications based on the reading and understanding of this specification and the accompanying drawings. The present disclosure includes all such modifications and variations, and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components (such as elements, etc.), the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (such as it is functionally equivalent), even if the structure is not equivalent to the disclosed structure of the function in the exemplary implementation of the present disclosure shown herein. In addition, although the specific features of the present disclosure have been disclosed with respect to only one of several implementations, such features can be combined with one or other features of other implementations that may be desired and advantageous for a given or specific application. Moreover, insofar as the terms "including", "having", "containing" or their variations are used in specific embodiments or claims, such terms are intended to be included in a manner similar to the term "comprising".
[0110] The functional units in the embodiments of the present invention may be integrated into a processing module, or each unit may exist physically separately, or multiple or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc. The above-mentioned devices or systems may execute the storage method in the corresponding method embodiment.
[0111] To sum up, the above embodiment is an implementation mode of the present invention, but the implementation mode of the present invention is not limited by the embodiment. Any other changes, modifications, substitutions, combinations, and simplifications that deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. Network traffic classification method for class imbalance, It is characterized in that The following steps are involved: Collect network traffic data; Initialize training parameters, including maximum number of iterations T and batch size N b ; learning rate∈; temperature hyperparameter β; number of groups K; size of K groups n 1 ,…,n K ; Allocation matrix Γ; Calibration hyperparameter B; Number of categories Weight vector ω, model initial parameters θ (1) , the weight of each group ω k (0) ; Calculate the calibration vector Start iterative training, including: Randomly sample a batch of training samples; calculate the empirical risk and group risk of each class at iteration t; estimate the group weights; update the model parameters to obtain θ by using the stochastic gradient descent method with a learning rate of ∈ (t+1) ; The iteration ends; Output classification labels for traffic data.
2. The network traffic classification method for class imbalance according to claim 1, It is characterized in that Weight ω k (0) The value of 3. The network traffic classification method for class imbalance according to claim 2, It is characterized in that Calibration vector where n k is the number of training samples in the kth group.
4. The network traffic classification method for class imbalance according to claim 3, It is characterized in that Training samples in t is the iteration number, For each flow data vector, R d is a d-dimensional real vector space, which is the input of the classification. represents the true label of each input feature, Represents the grouping label of each input feature x, N b is the batch size.
5. The network traffic classification method for class imbalance according to claim 4, It is characterized in that Calculating group risk as follows: in represents the loss vector at the group level, whose kth element corresponds to the sum of the losses within the group If the kth group contains the cth class, γ k,c is equal to 1, otherwise it is equal to 0. represents the allocation matrix, the loss term represents the loss vector for each class, l(D c ; θ) is the loss of the cth class.
6. The network traffic classification method for class imbalance according to claim 5, It is characterized in that The estimated group weights are as follows: Among them, ω (t) is the model parameter θ (t) The weight vector of each group under i (t) is the weight value of the i-th element in ω at the t-th iteration, ω i (t) is the weight value of the i-th element in ω at the t-1th iteration, l g (D k θ (t) ) is the last evaluated performance of class k, β represents the temperature hyperparameter that controls the loss value, v i and v k is the calibration vector The i-th and k-th elements in .
7. The network traffic classification method for class imbalance according to claim 6, It is characterized in that By using stochastic gradient descent with learning rate ∈ and ω (t) , update the model parameters to obtain θ (t+1) ,include: θ (t+1) and θ (t) are the model parameters of the tth round and the t+1th round respectively.
Citation Information
Patent Citations
Malicious traffic detection method in data imbalance scene
CN112990286A
Imbalanced network traffic classification method and system based on class sensitive feature extraction
CN114036357A
Unbalance learning method for image classification model
CN117422903A
