Method and system for detecting abnormal traffic attack of edge service of power internet of things

By using CatBoost classification model and SHAP feature selection in power IoT edge services, combined with Focal Loss loss function, the problem of insufficient real-time and robustness in abnormal traffic attack detection is solved, and efficient and reliable detection results are achieved, adaptable to Feature selection and model stability of PIoT environment.

CN118984237APending Publication Date: 2024-11-19GANSU ELECTRIC POWER INFORMATION COMM +1
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202411101383.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

Power IoT edge services face problems such as insufficient real-time and robustness, poor adaptability of feature selection methods, and poor classification model stability in abnormal traffic attack detection, especially in complex PIoT environments, which are difficult to effectively identify and respond to new attacks.

Method used

Using the CatBoost classification model combined with SHAP feature selection and Focal Loss loss function, through feature optimization and parameter configuration, a lightweight detection model is designed to reduce the number of features, improve the interpretability and robustness of the model, and adapt to the loss of traffic data in the PIoT environment. and category imbalance.

Benefits of technology

It realizes efficient and reliable abnormal traffic attack detection, reduces calculation burden and delay, improves detection efficiency and accuracy, and ensures the safe operation of the PIOT system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984237A_ABST
    Figure CN118984237A_ABST
Patent Text Reader

Abstract

The invention discloses a power Internet of Things edge service abnormal traffic attack detection method and system. The method comprises the following steps: acquiring an original network abnormal traffic attack data set; converting the original network abnormal traffic attack data set into traffic data suitable for machine learning and deep learning model processing; based on the preprocessed traffic data, selecting a set traffic feature to train the optimized CatBoost classification model, and storing the trained CatBoost classification model as a PIOT edge service abnormal traffic attack detection model; and detecting unknown abnormal traffic by using a PIOT edge service abnormal traffic attack detection model, and judging whether the access is malicious traffic for implementing the attack or not. According to the method, the detection efficiency is improved, the efficient and reliable abnormal traffic attack detection is realized, and the safe operation of the PIOT system is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the introduction of the concept of Industry 5.0, the power grid is shifting towards digitalization and intelligence. As an important part of this development direction, the Power Internet of Things (PIoT) relies on the Internet of Things and cyber-physical system technologies, integrates cloud computing, edge computing, the Internet of Things and big data, and realizes real-time collection, transmission, storage and processing of power data, as well as intelligent monitoring and control through intelligent perception, high-quality communication networks and advanced data analysis, thereby improving the safety, reliability, economy and sustainability of the power grid.

[0003] Unlike the traditional Internet and Internet of Things, which mainly rely on centralized cloud computing architecture, PIoT requires more advanced data processing capabilities and stronger interoperability to achieve real-time power data analysis and efficient information processing. The cloud-edge service architecture provides fast response, reduces network burden, and improves the security and stability of data processing by processing data near the power data collection source, which is crucial for power applications that require high reliability and real-time control.

[0004] However, due to the complexity and openness of the PIOT system, as well as the sensitivity of power data, edge services face a larger attack surface. Specifically, edge services are close to the power data collection area and are vulnerable to internal Mirai attacks caused by failure, contamination or manipulation of power sensing equipment, as well as external abnormal traffic attacks such as Distributed Denial-of-Service (DDoS), Denial-of-Service (DoS), reconnaissance, and deception. These attacks will affect the device's ability to respond immediately, causing critical power monitoring and control systems to fail to work properly. Therefore, ensuring the security of edge services, especially timely and accurate detection of attack events, is crucial to maintaining the normal operation of the PIOT system.

[0005] Although traditional rule- and signature-based anomaly detection methods have certain effects in identifying known attacks, they are limited in maintenance costs and flexibility in adapting to new attacks, especially in complex PIoT environments. Therefore, with the increase in data volume and the support of high-performance computing hardware, detection methods have changed from traditional models to data-driven methods. At present, methods based on machine learning, especially deep learning, have become the first choice for abnormal traffic attack detection. However, the detection of abnormal traffic attacks on PIoT edge services needs to consider the real-time and robustness of the system, as well as the computing and storage resource limitations of edge devices. Therefore, the present invention chooses to design a detection method by combining machine learning or deep learning technology with feature engineering to reduce the computational burden and memory consumption of edge services and improve the efficiency of attack detection. However, the current PIoT edge service faces the problem of poor adaptability of feature selection methods when performing abnormal traffic attack detection. Existing feature selection methods cannot meet the feature selection requirements of PIoT edge detection. In terms of model selection, the classification model used needs to have stronger stability and robustness, but some studies have not taken into account the problems of easy missing and imbalanced categories of collected traffic data in the PIoT environment, resulting in insufficient robustness of the detection algorithm. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a method and system for detecting abnormal traffic attacks on edge services of an electric power Internet of Things in response to the above-mentioned deficiencies in the prior art, so as to solve the technical problems existing in the prior art of insufficient real-time and robustness, poor adaptability of feature selection methods, and weak stability of classification models.

[0007] The present invention adopts the following technical solutions:

[0008] A method for detecting abnormal traffic attacks on edge services of an electric power Internet of Things comprises the following steps:

[0009] S1. Obtain the original network abnormal traffic attack data set;

[0010] S2, converting the original network abnormal traffic attack data set obtained in step S1 into traffic data suitable for processing by machine learning and deep learning models;

[0011] S3. Based on the traffic data preprocessed in step S2, select the set traffic features to train the optimized CatBoost classification model, and save the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model;

[0012] S4. Use the PIoT edge service abnormal traffic attack detection model obtained in step S3 to detect unknown abnormal traffic and determine whether the access is malicious traffic for carrying out the attack.

[0013] Preferably, the original network abnormal traffic attack data set includes network traffic data in the Internet of Things, Industrial Internet of Things, and traditional network environments, as well as abnormal traffic attack traffic data initiated by industrial equipment simulation.

[0014] Preferably, the traffic data converted into data suitable for processing by machine learning and deep learning models is:

[0015] First, all traffic data features involving flow identifiers are deleted, including ID, source / destination IP addresses, source / destination ports, timestamps, and flow start / end times; features involving lifetime are deleted;

[0016] Normal traffic samples with missing values ​​are directly deleted. For abnormal traffic attack samples, the missing feature values ​​are filled using the mean and mode based on the category.

[0017] Use One-Hot for category feature encoding;

[0018] Finally, the data is standardized.

[0019] Preferably, the set traffic features are selected to train the optimized CatBoost classification model as follows:

[0020] Build a CatBoost classification model that includes a feature selection module and an optimized CatBoost classifier module;

[0021] 70% to 75% of the traffic data preprocessed in step S2 is used as a training set, 15% to 20% of the data is used as a test set, and the rest is used as a validation set. The constructed CatBoost classification model is trained, tested and validated respectively. The number of selected features is analyzed using SHAP value for feature selection. The parameters inside the CatBoost classification model are configured and optimized. The CatBoost classification model and parameters are saved and used as a PIoT edge service abnormal traffic attack detection model for subsequent attack detection of unknown traffic.

[0022] Preferably, the specific process of the SHAP feature selection module is as follows:

[0023] Select the fast-trained decision tree as the preliminary classification model, and calculate the Shapley value of each feature based on the output of the model to evaluate the contribution of each feature to the model prediction;

[0024] According to the calculated Shapley value and the importance of each feature I j Calculate the importance of features and sort the features by importance;

[0025] Finally, the features with lower feature importance ranking are gradually eliminated, and the size of the feature set is recursively reduced until the predetermined number of features K is reached;

[0026] After the above feature selection process, a list of features sorted by importance is obtained after the feature deletion step, and a set of the most representative feature subsets is selected according to the preset criteria.

[0027] Preferably, the importance of each feature I j The calculation is as follows:

[0028]

[0029] Among them, n represents the total number of samples to be tested, φ i,j is a single sample feature x i,j The corresponding Shapley value.

[0030] Preferably, the specific process of the CatBoost classifier module is as follows:

[0031] Calculate the proportion of each type of data in the input abnormal traffic data set and find the corresponding inverse;

[0032] Normalize the inverse of the proportion of all categories to determine the weight parameter α of each category in the Focal Loss loss function c ;

[0033] Perform equal-width binning on the numerical type features based on SHAP feature selection to discretize continuous data;

[0034] Use Focal Loss to replace the underlying loss function of CatBoost;

[0035] The abnormal traffic data set is used to train the optimized CatBoost classification model to achieve classification, and the PIoT edge service abnormal traffic attack detection model is obtained.

[0036] Preferably, the parameters within the CatBoost classification model are configured and optimized as follows:

[0037] The SHAP algorithm is used to calculate and rank the importance of classification features on the ToN-IoT dataset, and the corresponding number of features are selected using recursive feature elimination. The optimal balance between the number of features and model performance is achieved by gradually removing them from the least important features and observing the changes in model performance indicators. The 8 most important features are selected as lightweight features for abnormal traffic attack detection of PIoT edge services. Grid search technology is used to ensure that the parameters reach the optimal configuration.

[0038] Preferably, determining whether the access is malicious traffic for carrying out an attack is specifically as follows:

[0039] When the PIoT edge device is running, it monitors the network traffic in the communication process, extracts 8 traffic features and performs data preprocessing in sequence, and then sends them to the PIoT edge service abnormal traffic attack detection model to obtain the probability distribution of normal and abnormal traffic. The category with the highest output probability is used as the judgment result of the model. If the traffic is judged to be abnormal attack traffic, the edge device will intercept it immediately and write the record into the log.

[0040] In a second aspect, an embodiment of the present invention provides a power Internet of Things edge service abnormal traffic attack detection system, comprising:

[0041] Data module, obtains the original network abnormal traffic attack data set;

[0042] The conversion module converts the acquired original network abnormal traffic attack data set into traffic data suitable for processing by machine learning and deep learning models;

[0043] The training module selects the set traffic features to train the optimized CatBoost classification model based on the preprocessed traffic data, and saves the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model;

[0044] The detection module uses the obtained PIoT edge service abnormal traffic attack detection model to detect unknown abnormal traffic and determine whether the access is malicious traffic for carrying out the attack.

[0045] In a third aspect, a computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for detecting abnormal traffic attacks on edge services of the power Internet of Things when executing the computer program.

[0046] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for detecting abnormal traffic attacks on edge services of the power Internet of Things.

[0047] Compared with the prior art, the present invention has at least the following beneficial effects:

[0048] A method for detecting abnormal traffic attacks on edge services of power Internet of Things solves the problem that existing feature selection methods cannot simultaneously reduce the number of features, avoid secondary transformation of features, and have poor adaptability to the edge of PIoT. It also solves the problem that existing classification models fail to fully consider the problems of easy missing traffic data and imbalanced categories in the PIoT environment, resulting in insufficient robustness of the detection algorithm.

[0049] Furthermore, in the traffic data acquisition part, two methods of acquiring training data are provided to enrich the data sources.

[0050] Furthermore, in the data preprocessing process, feature deletion, missing value processing, category feature encoding, and numerical feature standardization operations are performed on the monitored traffic data to achieve data de-redundancy and denoising, thereby improving the model detection accuracy while reducing the amount of subsequent analysis data and improving computing efficiency.

[0051] Furthermore, in the learning model training part, on the one hand, the unknown traffic data is analyzed based on the K features selected in the SHAP feature selection part. A small number of features can reduce the amount of data analyzed and improve the calculation efficiency, while ensuring the performance and interpretability of the model; on the other hand, a lightweight model CatBoost that is more capable of coping with feature missing situations is used to guide classification, and CatBoost is optimized from the perspective of adjusting numerical feature processing and alleviating data imbalance, thereby achieving a better balance in performance, efficiency and robustness.

[0052] It can be understood that the beneficial effects of the second aspect mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0053] In summary, the present invention improves detection efficiency, realizes efficient and reliable abnormal traffic attack detection, and ensures the safe operation of the PIOT system.

[0054] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a structural diagram of the detection method of the present invention;

[0056] Figure 2 It is a feature importance ranking diagram in the SHAP feature selection process of the present invention;

[0057] Figure 3 This is a graph showing the result of selecting the number of features in the SHAP feature selection process of the present invention;

[0058] Figure 4 This is a performance index result diagram of the multi-classification comparison experiment of the present invention;

[0059] Figure 5 This is a time index result diagram of the multi-classification comparison experiment of the present invention;

[0060] Figure 6 A schematic diagram of a computer device provided by an embodiment of the present invention;

[0061] Figure 7The present invention is a block diagram of an electronic device provided according to an embodiment. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0064] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0065] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.

[0066] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0067] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0068] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.

[0069] The present invention provides a method for detecting abnormal traffic attacks on edge services of power Internet of Things. The SHAP machine learning interpretation algorithm is migrated to the feature selection field to extract a small number of key features, and an optimized CatBoost lightweight model is used for attack detection to improve the accuracy and robustness of detection. The aim is to achieve efficient and reliable abnormal traffic attack detection and ensure the safe operation of the PIOT system.

[0070] See also Figure 1 The present invention provides a method for detecting abnormal traffic attack on edge services of power Internet of Things, comprising the following steps:

[0071] S1. Traffic data acquisition: obtain the original network abnormal traffic attack data set;

[0072] The abnormal traffic attack dataset is a public dataset or a dataset constructed by collecting IoT edge traffic data; when it is a self-constructed dataset, the labeling personnel label each network flow (the same quintuple) data as normal or attack type label; the abnormal traffic attack dataset used in the present invention is the public dataset ToN-IoT.

[0073] The ToN-IoT dataset includes network traffic data in the Internet of Things, Industrial Internet of Things, and traditional network environments, especially traffic data of abnormal traffic attacks initiated by industrial equipment simulation (including 9 types of attacks such as scanning attacks, DoS, DDoS, backdoor attacks, and MITM). The characteristics of heterogeneous data sources in the dataset are very consistent with the traffic characteristics in the edge environment of the power Internet of Things.

[0074] S2, data preprocessing: converting the original network abnormal traffic attack data set obtained in step S1 into a format suitable for machine learning and deep learning model processing;

[0075] Including feature deletion, missing value processing, category feature encoding, and numerical feature standardization. The specific steps are as follows:

[0076] S201, feature deletion;

[0077] The original network traffic data obtained in step S1 is characterized by 45 features, but some features can be directly excluded based on experience before feature selection. These features can be directly excluded because they are either irrelevant to the prediction target, or contain redundant information, or have a negative impact on model performance. Therefore, the present invention performs preliminary screening and exclusion of the original feature set before the formal feature selection process. This can not only reduce the computational complexity of the subsequent feature selection algorithm, but also improve the efficiency and accuracy of feature selection.

[0078] Specifically, firstly, all traffic data related to flow identifier features are deleted, including ID, source / destination IP address, source / destination port, timestamp and flow start / end time, to avoid the model from over-relying on these specific identifiers for learning, thereby avoiding the model from being biased against attack nodes and ensuring the generalization ability and applicability of the model; secondly, the features related to survival time are deleted, because they are highly correlated with the label, and the model may over-rely on this feature for prediction, resulting in overfitting. By excluding these irrelevant or redundant features that can be directly determined, the present invention can obtain a more streamlined and effective feature set, laying a solid foundation for subsequent feature selection and model training.

[0079] S202, missing value processing;

[0080] Missing values ​​will affect the integrity and accuracy of data analysis, and may lead to reduced model performance and decision-making bias. Filling missing values ​​helps ensure data quality and improve the accuracy and efficiency of network security monitoring. Therefore, in order to improve the accuracy of abnormal traffic attack detection, it is necessary to fill the missing values.

[0081] Specifically, when dealing with missing values, common methods include deletion, filling, and re-acquisition. The data set used in the present invention has sufficient normal traffic samples, and direct deletion will not affect the data distribution. Therefore, normal traffic samples with missing values ​​are directly deleted. For abnormal traffic attack samples, considering the preciousness of the samples, the category-based mean (for continuous features) and mode (for discrete features) are used to fill in the missing feature values ​​to retain as much information as possible.

[0082] S203, category feature coding;

[0083] Class features usually need to be encoded before being input into the model so that the machine learning algorithm can understand and process them. Common encoding methods include One-Hot encoding and label encoding. Among them, label encoding is suitable for situations where the size of the variable has practical significance. However, there is no size relationship between the class features in the abnormal traffic data set used in the present invention, so One-Hot is used for encoding.

[0084] S204, numerical feature standardization;

[0085] For numerical features, since different features have different dimensions, direct use may result in different contributions of the features to the target variable, thereby affecting the robustness of the model. In order to eliminate this dimensional difference, the present invention needs to standardize the data.

[0086] Specifically, the present invention selects to use Z-Score to standardize the numerical features, and the Z-Score calculation formula is shown in formula (1). Wherein, x is the feature value to be standardized, μ is the mean of the corresponding feature column, σ is the corresponding standard deviation, and x' is the transformed feature value.

[0087]

[0088] S3, learning model training: based on the traffic data preprocessed in step S2, select representative traffic features to train the optimized CatBoost classification model, and save the trained CatBoost classification model;

[0089] Specifically, step S3 mainly includes the learning model construction and learning model training process, and the specific steps are as follows:

[0090] S301, learning model construction;

[0091] Considering the real-time and robustness of the PIoT edge service detection solution and the resource limitations of edge devices, the present invention regards the abnormal traffic attack detection problem as a classification problem and focuses on building a lightweight and efficient model. Therefore, in the learning model construction stage, the present invention mainly focuses on designing a suitable feature selection module and optimizing the CatBoost classifier module to ensure that the model can reduce resource consumption while meeting performance requirements, aiming to provide a classification model that can accurately detect abnormal traffic attacks and can run efficiently on edge devices.

[0092] (1) SHAP feature selection module

[0093] This model uses the SHAP algorithm in the field of model interpretability in the feature selection module. It quantitatively evaluates the importance of each traffic feature by calculating its marginal contribution to the prediction result, and based on this, selects a small number of K features that have a greater impact on the model classification ability from the traffic features after the feature deletion step in step S201 as the analysis basis for subsequent models.

[0094] Specifically, SHAP provides a unified framework for explaining the prediction results of any machine learning model. It quantifies the contribution of each feature to the model prediction by scoring the importance of each feature. Since the contribution of each feature can be calculated, it can be naturally transferred to the field of feature selection to give priority to features that have a great impact on the prediction results.

[0095] Specifically, for a given flow data set, the SHAP method considers all possible combinations of feature subsets and evaluates the impact of each feature on the model prediction when added to the subset. The method determines the Shapley value of each feature by calculating the average of the marginal contributions of all feature subsets to the model prediction value. i,j The corresponding Shapley value φ i,j The calculation formula of is shown in formula (2).

[0096]

[0097] Where M is the set of all features, the cardinality of the set (i.e. the number of features) is m; S is the feature subset extracted from M; Indicates that only the features in the feature subset S are used for the sample x i The predicted value when making a prediction, when S is an empty set, Indicates adding a new feature x based on the feature subset S i,j When the sample x i The average value of the prediction in all samples; |S| is the cardinality of set S (that is, the number of features in S); (|S|! (m-|S|-1)!) / m! is and The weight of the difference between the values. These calculated Shapley values ​​reveal the specific contribution of each feature to the prediction of a single sample. Finally, the importance of each feature is calculated using formula (3).

[0098]

[0099] Formula (3) is implemented by averaging the Shapley absolute value of each feature over all samples, where n represents the total number of samples to be tested. j Sorting in descending order can determine the importance ranking of each feature to the model prediction results.

[0100] The specific process of SHAP feature selection is as follows:

[0101] ①Simple model training and Shapley value calculation

[0102] A fast-trained decision tree was selected as the preliminary classification model, and the Shapley value of each feature was calculated based on the output of the model to evaluate the contribution of each feature to the model prediction.

[0103] ②Calculate feature importance

[0104] The importance of the features is calculated based on the calculated Shapley value and formula (3), and the features are sorted according to their importance.

[0105] ③Feature selection

[0106] Finally, features with lower feature importance rankings are gradually eliminated, and the size of the feature set is recursively reduced until the predetermined number of features K is reached.

[0107] After the feature selection process, a feature list sorted by importance is obtained after the feature deletion step in step S201, and then a set of the most representative feature subsets is selected according to the preset standard. The subsequent training and prediction process of the present invention only relies on the K features selected by the SHAP feature selection part, so it can reduce the amount of data analyzed, improve the calculation efficiency, and ensure the performance and interpretability of the model.

[0108] (2) Optimize CatBoost classifier module

[0109] The present invention adopts CatBoost, a lightweight model that is more capable of coping with feature missing situations, to guide classification, and optimizes CatBoost from the perspectives of adjusting numerical feature processing and alleviating data imbalance, thereby achieving a better balance in performance, efficiency and robustness.

[0110] Although CatBoost performs well in processing categorical features, there is still room for improvement in processing continuous features: CatBoost uses a greedy algorithm to find the best split boundary by traversing all possible split points, which may lead to high computational overhead. At this time, the present invention introduces a data binning strategy when processing continuous features, that is, the continuous features are divided into a series of interval data according to certain rules, which not only simplifies the structure of continuous features, but also reduces the number of iterations of the model to search for the optimal split boundary, thereby effectively reducing the computational burden.

[0111] Furthermore, when CatBoost is classified, the underlying loss function is the cross entropy loss function. When the sample categories are relatively balanced, it can achieve a more outstanding prediction accuracy, but when the sample categories are unbalanced, the model may tend to predict the sample as a larger category to maximize the overall prediction accuracy. This will cause the samples of the smaller categories to be "flooded". In this case, even if the overall accuracy of the model looks high, it does not actually effectively identify the minority categories, thereby losing the balance and fairness of the model. In the process of abnormal traffic attack detection performed by the present invention, both the positive and negative samples are unbalanced, whether it is real scenes or traffic data in public data sets. Therefore, it is necessary to improve the class imbalance problem in CatBoost.

[0112] Specifically, the focal loss function is a loss function designed to solve the problem of extremely unbalanced ratio of positive and negative samples in target detection tasks. It achieves optimization in a framework based on cross-entropy loss by reducing the weights of a large number of easily classified samples and focusing on samples that are difficult to distinguish. Therefore, the present invention increases the cost of misclassification of minority classes in the loss function by replacing the underlying loss function of CatBoost with focal loss, which helps to improve the model's ability to recognize minority classes, thereby improving the accuracy of the model in detecting abnormal traffic attacks.

[0113] Specifically, for multi-classification problems, after reasoning, the formula of Focal Loss is (4):

[0114]

[0115] in, Represents the Focal Loss for each category; C is the total number of categories, α c is the adjustment parameter for the cth category; is the model's predicted probability that the true label t belongs to category c; and γ is the focus parameter for adjusting the weight of easy-to-classify samples. In the present invention, after testing, the model effect is best when the γ value is set to 2. At the same time, the weight coefficient α c Normalization is performed based on the inverse of the proportion of each category in the data set to give a higher weight to the minority class. This setting increases the cost of misclassification of the minority class in the loss function, which helps improve the model's ability to identify the minority class.

[0116] The specific process of optimizing the CatBoost classifier is as follows:

[0117] ① Calculate the category proportion

[0118] Calculate the proportion of each type of data in the input abnormal traffic data set and find the corresponding inverse.

[0119] ②Normalization weight parameter

[0120] Normalize the inverse of the proportion of all categories to determine the weight parameter α of each category in the Focal Loss loss function c .

[0121] ③Numerical feature binning

[0122] Perform equal-width binning on the numerical features based on SHAP feature selection to discretize continuous data and simplify the feature structure.

[0123] ④Improving the loss function

[0124] Use Focal Loss to replace the underlying loss function of CatBoost to reduce the loss of easily classified samples while focusing on difficultly classified samples.

[0125] ⑤Model training and application

[0126] The optimized CatBoost model trained with abnormal traffic dataset is used to achieve classification, and finally a lightweight and efficient PIoT edge service abnormal traffic attack detection model is obtained.

[0127] S302, learning model training process

[0128] After the model and data are prepared in step S301, model training can be started, and the trained model and parameters are finally saved for subsequent prediction. The specific process is as follows:

[0129] S3021. Dataset Division

[0130] After the data set is selected in step S1, it is first preprocessed in S2 to convert it into a form that can be processed by the model. Finally, 70% to 75% of the data in the data set is taken as the training set, 15% to 20% of the data is taken as the test set, and the rest is taken as the validation set.

[0131] S3022, parameter setting

[0132] The present invention determines the parameter configuration when the model achieves the best performance through the validation set, and this configuration is selected as the final parameter setting of the learning model. The setting of these key parameters mainly includes two aspects: first, the number of selected features when using SHAP value analysis for feature selection, which aims to identify the features that contribute most to the model's predictive performance; second, the parameter configuration within the CatBoost classification model, which has a significant impact on the model's training process and final predictive ability. The specific process of parameter selection and setting is as follows:

[0133] S30221, SHAP feature selection parameter settings

[0134] Figure 2 The results of calculating and ranking the importance of classification features on the ToN-IoT dataset using the SHAP algorithm are shown. To simplify the presentation of the results, only the top 10 important features are shown. Figure 2 It can be seen that flow duration is the most critical feature affecting the output of the abnormal traffic attack detection model. The application layer protocol type and the maximum TCP window feature from source to destination follow closely and contribute greatly to the model output.

[0135] Furthermore, a recursive feature elimination method is used to select an appropriate number of features, and the optimal balance between the number of features and model performance is achieved by gradually removing the least important features and observing the changes in the model performance indicators. Figure 3 As shown, as the number of features decreases from the maximum value to 8, the performance indicators show a consistent stable trend and remain at a high level. However, when the number of features continues to decrease to 5, the model performance begins to jitter, but the change is relatively slow. When the number of features is further reduced to less than 5, the model performance drops significantly. Therefore, it can be inferred that when the number of features is about 8, the performance indicators reach saturation, and further increasing the number of features can no longer significantly improve the model performance, but may increase the complexity and computational overhead of the model. Therefore, after parameter experiments, the present invention finally selects the 8 most important features as lightweight features for abnormal traffic attack detection of PIoT edge services.

[0136] S30222. Optimize the parameter configuration inside the CatBoost model

[0137] The present invention uses an efficient grid search technique to ensure that the parameters are optimally configured. Table 1 shows the candidate values ​​of each model parameter setting when the model performs binary and multi-classification tasks. By performing a detailed grid search within the preset parameter range, the optimal model parameters in the right column are finally determined.

[0138] Table 1 Optimizing the internal parameter configuration of the CatBoost model

[0139]

[0140] S3023. Training.

[0141] The entire model is trained on the cloud server platform provided by Kaggle, where the server operating system used is Linux, the CPU is Intel Xeon series, and the graphics card is Tesla P100-PCIE-16GB. The present invention conducts experiments based on CPU, and the model design and testing are implemented based on Python3.9, using third-party libraries such as Numpy, Pandas, and Scikit-learn.

[0142] After the training is completed, the design model of the present invention is further subjected to a binary classification comparison experiment with related solutions. The model performance is evaluated by accuracy, precision, recall, F1 value, and prediction time of 10,000 data. Table 2 shows the experimental comparison results of the design model of the present invention and related models, and also lists the number of features used by each method after feature selection.

[0143] Table 2. Binary classification detection results of abnormal traffic attacks

[0144]

[0145] As can be seen from Table 2, the CatBoost classification model designed by the present invention has the best comprehensive performance on the test set, especially improving the efficiency of the model in detecting abnormal traffic attacks.

[0146] Furthermore, the design model of the present invention is subjected to a multi-classification comparison experiment with related solutions, wherein the model performance is evaluated by accuracy, weighted average precision, weighted average recall, weighted average F1 value, and prediction time of 10,000 data items. Figure 4 and Figure 5 The experimental comparison results of the model designed for the present invention and related models show that the present model can also achieve the best performance when judging multi-category abnormal traffic attacks, and shows advantages in attack detection accuracy and efficiency.

[0147] Finally, the CatBoost classification model and parameters are saved for subsequent attack detection of unknown traffic.

[0148] S4. Abnormal traffic attack detection: Use the PIoT edge service abnormal traffic attack detection model obtained in step S3 to detect unknown abnormal traffic to determine whether the access is malicious traffic for carrying out an attack.

[0149] Specifically, the PIoT edge device monitors the network traffic during the communication process when it is running, extracts 8 traffic features, and then performs data preprocessing steps in sequence to detect the standard input of the model. Then, the prediction model obtained by sending it to step S3 obtains the probability distribution of whether the traffic is normal or abnormal, and outputs the category with a higher probability as the judgment result of the model. If the traffic is judged to be abnormal attack traffic, the edge device will intercept it immediately and write the record into the log for later review.

[0150] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".

[0151] In another embodiment of the present invention, a power Internet of Things edge service abnormal traffic attack detection system is provided. The system can be used to implement the above-mentioned power Internet of Things edge service abnormal traffic attack detection method. Specifically, the power Internet of Things edge service abnormal traffic attack detection system includes a data module, a conversion module, a training module and a detection module.

[0152] Among them, the data module obtains the original network abnormal traffic attack data set;

[0153] The conversion module converts the acquired original network abnormal traffic attack data set into traffic data suitable for processing by machine learning and deep learning models;

[0154] The training module selects the set traffic features to train the optimized CatBoost classification model based on the preprocessed traffic data, and saves the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model;

[0155] The detection module uses the obtained PIoT edge service abnormal traffic attack detection model to detect unknown abnormal traffic and determine whether the access is malicious traffic for carrying out the attack.

[0156] In another embodiment of the present invention, a terminal device is provided, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the abnormal traffic attack detection method of the edge service of the power Internet of Things, including:

[0157] Obtain the original network abnormal traffic attack dataset; convert the obtained original network abnormal traffic attack dataset into traffic data suitable for machine learning and deep learning model processing; based on the preprocessed traffic data, select the set traffic features to train the optimized CatBoost classification model, and save the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model; use the obtained PIoT edge service abnormal traffic attack detection model to detect unknown abnormal traffic and determine whether the access is malicious traffic for attack.

[0158] In another embodiment of the present invention, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a terminal device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device, and can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that more specific examples (non-exhaustive list) of the computer-readable storage medium here include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0159] Computer readable storage media also include data signals propagated in baseband or as part of a carrier wave, which carry readable program codes. Such propagated data signals can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than a readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0160] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0161] The processor may load and execute one or more instructions stored in a computer-readable storage medium to implement the corresponding steps of the method for detecting abnormal traffic attacks on edge services of the power Internet of Things in the above embodiment; one or more instructions in the computer-readable storage medium are loaded and executed by the processor as follows:

[0162] Obtain the original network abnormal traffic attack dataset; convert the obtained original network abnormal traffic attack dataset into traffic data suitable for machine learning and deep learning model processing; based on the preprocessed traffic data, select the set traffic features to train the optimized CatBoost classification model, and save the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model; use the obtained PIoT edge service abnormal traffic attack detection model to detect unknown abnormal traffic and determine whether the access is malicious traffic for attack.

[0163] See also Figure 6 , the terminal device is a computer device, and the computer device 60 of this embodiment includes: a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When the computer program 63 is executed by the processor 61, the method for calculating the composition of fluid in the reservoir transformation wellbore in the embodiment is realized. To avoid repetition, it is not described one by one here. Alternatively, when the computer program 63 is executed by the processor 61, the functions of each model / unit in the calculation system for the composition of fluid in the reservoir transformation wellbore in the embodiment are realized. To avoid repetition, it is not described one by one here.

[0164] The computer device 60 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will appreciate that Figure 6 This is only an example of the computer device 60 and does not constitute a limitation of the computer device 60. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0165] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, central processing units, graphics processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, data processing logic based on quantum computing, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0166] The memory 62 may be an internal storage unit of the computer device 60, such as a hard disk or memory of the computer device 60. The memory 62 may also be an external storage device of the computer device 60, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the computer device 60.

[0167] Furthermore, the memory 62 may include both an internal storage unit of the computer device 60 and an external storage device. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 may also be used to temporarily store data that has been output or is to be output.

[0168] Any reference to memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0169] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0170] See also Figure 7 The terminal device 600 is an electronic device, and the electronic device is in the form of a general computing device. The components of the electronic device may include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0171] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps according to various exemplary embodiments of the present invention described in the above method section of this specification. For example, the processing unit 610 can perform the following steps: Figure 1 Follow the steps shown in .

[0172] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0173] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0174] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0175] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0176] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0177] Compared with binary classification, multi-class detection of abnormal traffic attacks is more difficult. Therefore, the design model of the present invention is compared with related solutions in multi-classification experiments. The accuracy, weighted average precision, weighted average recall, weighted average F1 value, and prediction time of 10,000 data are still used to evaluate the model performance.

[0178] Table 3. Abnormal traffic attack multi-classification detection results

[0179]

[0180] Table 3 is the experimental comparison results of the design model of the present invention and related models. It can be seen that the present model can also achieve the best performance when judging multi-category abnormal traffic attacks, and shows advantages in attack detection accuracy and efficiency.

[0181] In summary, the present invention provides a method and system for detecting abnormal traffic attacks in edge services of the electric power Internet of Things. By migrating the highly adaptable SHAP feature interpretation algorithm to the field of feature selection, a small number of key features can be extracted, thereby reducing the complexity of model analysis data and accelerating the detection speed. At the same time, the CatBoost lightweight model optimized from the perspective of adjusting numerical feature processing and alleviating data imbalance is used for abnormal traffic attack detection, which improves detection efficiency and robustness. Finally, while ensuring the accuracy of attack detection, the present invention can effectively reduce latency and meet the lightweight and real-time requirements of PIoT edge services for abnormal traffic attack detection.

[0182] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0183] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0184] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0185] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0186] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0187] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0188] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0189] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0190] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0191] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0192] The above contents are only for explaining the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.

Claims

1. A method for detecting abnormal traffic attacks on edge services of power Internet of Things, characterized in that: The following steps are involved: S1. Obtain the original network abnormal traffic attack data set; S2, converting the original network abnormal traffic attack data set obtained in step S1 into traffic data suitable for processing by machine learning and deep learning models; S3. Based on the traffic data preprocessed in step S2, select the set traffic features to train the optimized CatBoost classification model, and save the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model; S4. Use the PIoT edge service abnormal traffic attack detection model obtained in step S3 to detect unknown abnormal traffic and determine whether the access is malicious traffic for carrying out the attack.

2. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 1 is characterized in that: The original network abnormal traffic attack dataset includes network traffic data in the Internet of Things, Industrial Internet of Things, and traditional network environments, as well as abnormal traffic attack traffic data initiated by industrial equipment simulation.

3. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 1 is characterized in that: The traffic data converted into data suitable for processing by machine learning and deep learning models is as follows: First, all traffic data features involving flow identifiers are removed, including ID, source / destination IP addresses, source / destination ports, timestamps, and flow start / end times; Remove features related to survival time; Normal traffic samples with missing values ​​are directly deleted. For abnormal traffic attack samples, the missing feature values ​​are filled using the mean and mode based on the category. Use One-Hot for category feature encoding; Finally, the data is standardized.

4. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 1 is characterized in that: Select the set traffic features to train the optimized CatBoost classification model as follows: Build a CatBoost classification model that includes a feature selection module and an optimized CatBoost classifier module; 70% to 75% of the traffic data preprocessed in step S2 is used as a training set, 15% to 20% of the data is used as a test set, and the rest is used as a validation set. The constructed CatBoost classification model is trained, tested and validated respectively. The number of selected features is analyzed using SHAP value for feature selection. The parameters inside the CatBoost classification model are configured and optimized. The CatBoost classification model and parameters are saved and used as a PIoT edge service abnormal traffic attack detection model for subsequent attack detection of unknown traffic.

5. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 4 is characterized in that: The specific process of the SHAP feature selection module is as follows: Select the fast-trained decision tree as the preliminary classification model, and calculate the Shapley value of each feature based on the output of the model to evaluate the contribution of each feature to the model prediction; According to the calculated Shapley value and the importance of each feature I j Calculate the importance of features and sort the features by importance; Finally, the features with lower feature importance ranking are gradually eliminated, and the size of the feature set is recursively reduced until the predetermined number of features K is reached; After the above feature selection process, a list of features sorted by importance is obtained after the feature deletion step, and a set of the most representative feature subsets is selected according to the preset criteria.

6. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 5 is characterized in that: The importance of each feature I j The calculation is as follows: Among them, n represents the total number of samples to be tested, φ i,j is a single sample feature x i,j The corresponding Shapley value.

7. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 4 is characterized in that: The specific process of the CatBoost classifier module is as follows: Calculate the proportion of each type of data in the input abnormal traffic data set and find the corresponding inverse; Normalize the inverse of the proportion of all categories to determine the weight parameter α of each category in the Focal Loss loss function c ; Perform equal-width binning on the numerical type features based on SHAP feature selection to discretize continuous data; Use Focal Loss to replace the underlying loss function of CatBoost; The abnormal traffic data set is used to train the optimized CatBoost classification model to achieve classification, and the PIoT edge service abnormal traffic attack detection model is obtained.

8. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 4 is characterized in that: The parameters for configuring and optimizing the CatBoost classification model are as follows: The SHAP algorithm is used to calculate and sort the importance of classification features on the ToN-IoT dataset. The corresponding number of features are selected by recursive feature elimination. The optimal balance between the number of features and model performance is achieved by gradually removing the least important features and observing the changes in model performance indicators. The 8 most important features are selected as lightweight features for abnormal traffic attack detection on PIoT edge services. Grid search technology is used to ensure that the parameters reach the optimal configuration.

9. The method for detecting abnormal traffic attacks on edge services of the power Internet of Things according to claim 1 is characterized in that: The specific methods for determining whether access is malicious traffic for attack are: When the PIoT edge device is running, it monitors the network traffic in the communication process, extracts 8 traffic features and performs data preprocessing in sequence, and then sends them to the PIoT edge service abnormal traffic attack detection model to obtain the probability distribution of normal and abnormal traffic. The category with the highest output probability is used as the judgment result of the model. If the traffic is judged to be abnormal attack traffic, the edge device will intercept it immediately and write the record into the log.

10. A power Internet of Things edge service abnormal traffic attack detection system, characterized in that: include: Data module, obtains the original network abnormal traffic attack data set; The conversion module converts the acquired original network abnormal traffic attack data set into traffic data suitable for processing by machine learning and deep learning models; The training module selects the set traffic features to train the optimized CatBoost classification model based on the preprocessed traffic data, and saves the trained CatBoost classification model as the PIoT edge service abnormal traffic attack detection model; The detection module uses the obtained PIoT edge service abnormal traffic attack detection model to detect unknown abnormal traffic and determine whether the access is malicious traffic for carrying out the attack.

Citation Information

Cited By

  • Network attack data processing method and device, medium and program product

    CN119544371A

  • Network attack detection method and device, equipment and storage medium

    CN119814373A

  • Vegetable variety identification method and system based on deep learning, and medium

    CN120431570A

  • Networked interconnection system security distributed control method and system

    CN120508073A

  • FDIA detection method based on SHAP-LUNAR

    CN121037060A