Anomaly detection method for industrial carbon emission data

Through the combination of matrix contour technology and GRU network model, the characteristics of industrial carbon emission data are extracted and anomaly detection is performed, which solves the problem of insufficient detection accuracy in the existing technology, realizes efficient carbon emission anomaly detection, and supports the carbon management of enterprises. decision making.

CN117150407BActive Publication Date: 2024-10-01STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311134141.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2024-10-01
Estimated Expiration
2043-09-04

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively detect and analyze abnormal points in industrial carbon emission data, making it difficult for companies to accurately grasp carbon emission changes and management efficiency.

Method used

Matrix contour technology is used to extract the characteristics of industrial carbon emission time series data, and a gated recurring unit (GRU) network model is used for prediction. Anomaly detection is achieved by calculating error values ​​and setting thresholds.

Benefits of technology

It improves the accuracy of abnormal detection of industrial carbon emission data, helps enterprises better understand changes in carbon emissions, and provides objective reference for carbon management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117150407B_ABST
    Figure CN117150407B_ABST
Patent Text Reader

Abstract

The present invention relates to an abnormality detection method for industrial carbon emission data, comprising the following contents: pre-processing industrial carbon emission data to obtain a time series T of carbon emission; extracting features from time series T using matrix profile technology to obtain a feature sequence of time series T; establishing a prediction model based on the feature sequence, inputting a test set into the prediction model to obtain a prediction feature sequence of the test set; comparing the feature sequence with the prediction feature sequence, calculating a prediction error value, and taking data with an error value higher than a threshold as an abnormal data point. The present invention realizes abnormality detection of industrial carbon emission data by setting a threshold, and the detection accuracy is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial carbon emission anomaly detection, and in particular to an anomaly detection method for industrial carbon emission data based on matrix profile technology. Background Art

[0002] With the rapid economic development, different industrial systems are gradually taking shape, and the resulting carbon emissions will continue to increase and expand. It is urgent to promote carbon reduction in high-energy-consuming industries and fields. In this context, it is particularly important to classify the carbon emission data of enterprises in the industry, which will help analyze the driving factors of carbon emissions and the factors affecting carbon management efficiency, and provide enterprises and management departments with an objective reference for emission reduction decisions.

[0003] The carbon emission data of enterprises is essentially time series data, which has strong periodicity, seasonality, and a certain amount of noise. The anomaly detection of carbon emission data of enterprises is actually the anomaly detection of such time series data. For enterprises, the main sources of carbon emissions are indirect emissions generated by purchased energy (including electricity, steam, heating and cooling), and greenhouse gas emissions generated by direct combustion in industrial processes. For most enterprises, mastering abnormal information and changes in carbon emissions can achieve further control of carbon emissions. Therefore, it is necessary to effectively detect carbon emission anomalies for enterprises. Summary of the invention

[0004] The present invention proposes an anomaly detection method for industrial carbon emission data and designs a prediction model, called the MP-GRU model, which stands for Matrix Profile-Gated Recurrent Unit. The prediction model can be applied to the industrial field to realize anomaly detection of industrial carbon emissions.

[0005] The present invention introduces the matrix profile algorithm to obtain the characteristics of industrial carbon emission time series data. The gated recurrent unit (GRU) network model is used for time series prediction. Compared with the traditional RNN, the GRU network model has good support for long-term dependence and high information persistence. Compared with LSTM, the GRU network model has fewer parameters and is easier to converge. The prediction model uses the matrix profile technology to obtain the characteristics of the input industrial carbon emission time series data, and then uses the GRU network model to predict its characteristics. Finally, in the anomaly detection step, the predicted data is compared with the feature data extracted by the matrix profile technology of the original industrial carbon emission time series data, the error value of each data point is calculated, and the threshold is set to three times the standard deviation of the mean value, and the data greater than the threshold is marked as an abnormal data point.

[0006] The present invention proposes a method for detecting anomalies in industrial carbon emission data, comprising the following steps:

[0007] S1. Preprocess the industrial carbon emission data to obtain the time series T of carbon emission, T = {t 1 ,t 2 ,…,t n}, n is the length of the time series T;

[0008] S2, using matrix profile technology to extract features from time series T, and obtaining a feature sequence of time series T;

[0009] S3, establishing a prediction model according to the feature sequence of step S2, and inputting a test set into the prediction model to obtain a prediction feature sequence of the test set; the test set is the time series T of step S1;

[0010] S4. Compare the feature sequence of step S2 with the predicted feature sequence of step S4, calculate the prediction error value, and take the data with error values ​​higher than the threshold as abnormal data points.

[0011] Furthermore, the step S2 includes the following contents:

[0012] Get the Euclidean distance between all subsequences of a time series;

[0013] One of the subsequences T i,m It represents the continuous data points starting from point i and with a length of m, T i,m ={t i ,t i+1 ,…,t i+m-1}, 1≤i≤n–m+1; Euclidean distance D i ={d i,1 , d i,2 , …, d i,n-m+1}, where d i,j is a subsequence T i,m and subsequence T j,m The Euclidean distance between them, 1≤i, j≤n–m+1;

[0014] and removing overlapping parts in the range contours;

[0015] Get the matrix outline;

[0016] Matrix profile P = {min(D 1 ),min(D 2 ),…,min(D n-m+1 )}, which represents each subsequence and its closest non-self-matching subsequence in Euclidean distance.

[0017] Furthermore, the prediction model of step S3 includes a GRU layer, a dropout layer and a fully connected network layer.

[0018] Furthermore, the GRU layer has a two-layer structure, the number of GRU layer units in the first layer is 32, the number of GRU layer units in the second layer is 16, a first dropout layer is provided after the first GRU layer, and a second dropout layer is provided after the second GRU layer; the output of the second dropout layer is connected to a fully connected network layer, and the number of layers of the fully connected network layer is 2.

[0019] Furthermore, an activation function is added to the prediction model to introduce nonlinear relationships, thereby improving the learning ability of the model.

[0020] Furthermore, the activation function is a linear rectifier function ReLU, and the prediction model minimizes the loss function by using the gradient descent method, and adjusts the weights and other parameters in the network structure layer by layer in reverse, and improves the recognition accuracy of the network for the target task by continuous iterative training. The target task is the prediction feature sequence of the test set obtained in step S3

[0021] Furthermore, the parameters of the prediction model are:

[0022] The forgetting rate of the dropout layer is d = 0.1;

[0023] The number of GRU layers n = 2 and the time window windows = 5;

[0024] The model is trained with batch size batch_size = 32 and epoch = 100;

[0025] When the value of the loss function is less than 0.1, the model training is completed.

[0026] Further, the prediction model is evaluated by using indicators including precision, recall, F1 score, and MCC to evaluate the performance of the prediction model on a congestive heart failure dataset;

[0027] The precision rate represents the probability of the actual positive sample among all samples predicted to be positive, and its expression formula is:

[0028]

[0029] TP means the number of positive classes predicted as positive classes, and FP means the number of negative classes predicted as positive classes. The closer the precision is to 1, the better the prediction model performs.

[0030] The recall rate Recall represents the probability that the positive examples in the sample are predicted correctly, and the expression formula is:

[0031]

[0032] FN indicates the number of positive classes predicted as negative classes. The closer Recall is to 1, the better the prediction model performs.

[0033] The F1 score expression formula is:

[0034]

[0035] Pre represents precision, Recall represents recall, and the closer the F1 score is to 1, the better the model performance is.

[0036] MCC is a correlation coefficient describing the actual classification and the predicted classification, and the expression formula is:

[0037]

[0038] Among them, TN represents the number of negative classes predicted as negative classes, and the closer the MCC is to 1, the better the model performance.

[0039] Furthermore, the step S1 also includes the steps of deduplication, data format conversion, and data missing value processing for the industrial carbon emission data.

[0040] The present invention uses the MP-GRU model to extract the characteristics of industrial carbon emission time series data through the profile matrix algorithm, and uses the gated recurrent unit (GRU) network model for time series prediction. Finally, the anomaly detection of industrial carbon emission data is achieved by setting the threshold. The detection accuracy is high, which helps enterprises to grasp the abnormal information and changes in carbon emissions, thereby achieving further control of carbon emissions and providing an objective reference for the carbon management of enterprises. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a schematic diagram of the prediction model of the present invention;

[0042] Figure 2 It is a structural diagram of the prediction model of the present invention;

[0043] Figure 3 is a curve chart of abnormal detection results;

[0044] Figure 4 This is a flow chart of the anomaly detection method of the present invention. DETAILED DESCRIPTION

[0045] The following is a further detailed description of an abnormality detection method for industrial carbon emission data proposed by the present invention in conjunction with the accompanying drawings and specific implementation methods.

[0046] Figure 1It is the overall framework of the MP-GRU prediction model of the present invention, in which the industrial carbon emission data is the input time series T data. Therefore, in step S1, the industrial carbon emission data preprocessing step, it is first necessary to clarify the scope and objectives of the company's carbon emission data collection, such as determining the collection time period, collection area, collection emission type, etc. Then the collected data needs to be cleaned, including data deduplication, data format conversion, data missing value processing, etc. In the data cleaning process, attention should be paid to the accuracy, completeness and consistency of the data. After the data cleaning is completed, the input carbon emission time series T of the prediction model is obtained, T={t 1 ,t 2 ,…,t n}, n is the length of T.

[0047] In step S2, the carbon emission time series feature extraction step, the preprocessed time series T is input into the matrix profile unit, and the feature extraction of the time series is performed, and the output is the feature sequence of the input time series T. The specific steps of the matrix profile technology used by the matrix profile unit are:

[0048] (1) Calculate the Euclidean distance between all subsequences of the acquired time series.

[0049] For a time series T, subsequence T i,m It represents the continuous data points starting from point i and with a length of m, that is, T i,m ={t i ,t i+1 ,…,t i+m-1}, 1≤i≤n–m+1. Generally speaking, the length n of the subsequence is set based on domain knowledge.

[0050] By calculating the subsequence T i,m The Euclidean distance of all subsequences of time series T can be obtained as subsequence T i,m A distance profile D i , D i ={d i,1 , d i,2 , …, d i,n-m+1}, where d i,j (1≤i, j≤n–m+1) is T i,m and T j,m The Euclidean distance between .

[0051] (2) Ignore unimportant matches and focus on non-self matches.

[0052] For the subsequence T i,m The distance profile D i , the value d at the i-th position i,irepresents the Euler distance between the subsequence and itself, which is 0. At the same time, the values ​​before and after the i-th position are also close to 0, because the subsequence T i,m With another subsequence T j,m There are overlapping parts. If two subsequences have overlapping parts, for example, subsequence T i,m and another subsequence T j,m are all subsequences of T. If the two subsequences have overlapping parts in T, it means that the two subsequences overlap. If the length of the subsequence is m, then the front and back of i refer to i–m+1≤j≤i+m–1. The matrix profile technology used in the present invention focuses on non-self-matching, so the above two unimportant matches are ignored.

[0053] It should be noted that ignoring refers to i Remove the corresponding data points from the contour matrix P, because each item in the subsequent contour matrix P is D i If the overlapping part is not removed, that is, the match with itself, then D i The minimum value of must be 0, and the profile matrix P is meaningless. i Keep the corresponding data points in .

[0054] (3) Calculate and obtain the matrix contour.

[0055] For a time series T, the matrix profile P = {min(D 1 ),min(D 2 ),…,min(D n-m+1 )}, where 1≤i≤n–m+1, represents each subsequence and its closest non-self-matching subsequence in Euclidean distance.

[0056] From the above three steps (1)(2)(3), it can be seen that the matrix profile technology can extract the feature sequence of the input time series T, which can reflect the similarity of the subsequence to other subsequences in the entire time series T.

[0057] In the prediction of step S3, a time series prediction model based on GRU is established, such as Figure 2 As shown, it includes a GRU layer, a dropout layer and a fully connected network layer. The prediction model inputs a test set to obtain a prediction feature sequence of the test set; the test set is the time series T of step S1.

[0058] The GRU layer has a two-layer structure, the number of GRU units in the first layer is 32, the number of GRU units in the second layer is 16, and there is a dropout layer after each GRU layer. The output of the second dropout layer is connected to the fully connected network layer after the GRU unit in the second layer. The number of layers of the fully connected network layer is 2, and finally the final output of the GRU-based time series prediction model is obtained.

[0059] Since most carbon emission data are nonlinear, linear operations cannot express the calculation effect, so an activation function is added to the model to introduce a nonlinear relationship, thereby improving the learning ability of the model. The activation function of the model is ReLU, which is called "Rectified Linear Unit" in Chinese. This algorithm does not require exponential operations and has a faster operation speed, so it is selected as the activation function for training. The model minimizes the loss function through the gradient descent method. Here, the loss function is the mean square error. The weights and other parameters in the network structure are adjusted layer by layer in reverse, and the recognition accuracy of the network for the target task is improved through continuous iterative training. The target task is the predicted feature sequence of the test set obtained in step S3.

[0060] The parameters of the other prediction models are:

[0061] The forgetting rate of the dropout layer is d = 0.1;

[0062] The number of GRU layers n = 2 and the time window windows = 5;

[0063] The model is trained with batch size batch_size = 32 and epoch = 100;

[0064] When the loss function is small, the model training is completed. Use the trained prediction model to input the test set, and then use the prediction model to obtain the prediction sequence of the input test set to complete the prediction step.

[0065] In the anomaly detection step, the prediction sequence obtained in step S3 and the time series data features obtained in step S2, that is, the time series before prediction, are used to calculate a set of prediction error values: PE = {AE 1 , A.E. 2 ,…,AE n-m+1}, where AE i It is the absolute value of the difference between the predicted sequence and the value of each point in the time series before the prediction.

[0066] Finally, the present invention selects the mean value plus three times the standard deviation as the threshold, and the data above the threshold is regarded as an abnormal data point. Then the corresponding abnormal data point is matched back to the input of step S2, that is, the original time series T, and the abnormal data point of the original sequence can be obtained. The abnormal detection result is as follows: Figure 3 shown.

[0067] In order to demonstrate the feasibility and accuracy of the method described in the present invention, in the model performance evaluation part, the performance of the model is evaluated on the Chfdb_chf13 dataset using indicators such as precision, recall, F1 score, and MCC. Chfdb stands for BIDMC Congestive Heart Failure Database, and Chf13 is one of the datasets. The data comes from the public dataset: https: / / www.physionet.org / content / chfdb / 1.0.0 / .

[0068] Precision represents the probability of actual positive samples among all samples predicted to be positive, and the expression formula is as follows:

[0069]

[0070] TP represents the number of positive classes predicted as positive classes, and FP represents the number of negative classes predicted as positive classes. The closer the precision is to 1, the better the model performance is.

[0071] The recall rate Recall represents the probability that the positive example in the sample is predicted correctly, and the expression formula is as follows:

[0072]

[0073] FN indicates the number of positive classes predicted as negative classes, and the closer Recall is to 1, the better the model performance.

[0074] The F1 score takes into account both precision and recall, and the expression formula is as follows:

[0075]

[0076] Pre represents precision, Recall represents recall, and the closer the F1 Score is to 1, the better the model performance is.

[0077] MCC is a correlation coefficient describing the actual classification and the predicted classification, and the expression formula is as follows:

[0078]

[0079] Among them, TN stands for True Negative, which means that the negative class is predicted as the negative class number. The closer the MCC is to 1, the better the model performance is.

[0080] The model was trained on Jupyter using the keras2.9.0 platform. The results show that the accuracy, recall, F1 score, and MCC of the MP-GRU model used in this patent are 0.78, 1, 0.876, and 0.846, respectively, which are very close to 1, indicating that the MP-GRU model used in this patent can achieve anomaly detection of industrial carbon emission data with high accuracy. keras is the name of the Python library used to build the prediction model, and 2.9.0 is the version number. The keras library mainly contains various advanced neural network application interfaces written in Python.

[0081] The present invention has the following beneficial effects:

[0082] The present invention uses the MP-GRU model to extract the characteristics of industrial carbon emission time series data through the profile matrix algorithm, and uses the gated recurrent unit (GRU) network model for time series prediction. Finally, the anomaly detection of industrial carbon emission data is achieved by setting the threshold. The detection accuracy is high, which helps enterprises to grasp the abnormal information and changes in carbon emissions, thereby achieving further control of carbon emissions and providing an objective reference for the carbon management of enterprises.

[0083] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.

Claims

1. A method for detecting anomalies in industrial carbon emission data, comprising the following steps: S1. Preprocess the industrial carbon emission data to obtain the time series T of carbon emission, T = {t1, t2, ..., t n }, n is the length of the time series T; S2, using matrix profile technology to extract features from time series T, and obtaining a feature sequence of time series T; S3, establishing a prediction model according to the feature sequence of step S2, and inputting a test set into the prediction model to obtain a prediction feature sequence of the test set; the test set is the time series T of step S1; S4, comparing the feature sequence of step S2 with the predicted feature sequence of step S3, calculating the prediction error value, and taking the data with an error value higher than the threshold as an abnormal data point; The step S2 comprises the following contents: Get the Euclidean distance between all subsequences of time series T; One of the subsequences T i,m It represents the continuous data points starting from point i and with a length of m, T i,m ={t i ,t i+1 ,…,t i+m-1 }, 1≤i≤n–m+1; distance contour D i ={d i,1 , d i,2 , …, d i,n-m+1 }, where d i,j is a subsequence T i,m and subsequence T j,m The Euclidean distance between them, 1≤i, j≤n–m+1; and removing overlapping parts in the range contours; Get the matrix outline; Matrix profile P = {min(D1),min(D2),…,min(D n-m+1 )}, which indicates that each subsequence is the non-self-matching subsequence with the closest Euclidean distance to it; The prediction model of step S3 includes a GRU layer, a dropout layer and a fully connected network layer; The GRU layer has a two-layer structure, the number of GRU layer units in the first layer is 32, the number of GRU layer units in the second layer is 16, a first dropout layer is arranged after the GRU layer in the first layer, and a second dropout layer is arranged after the GRU layer in the second layer; the output of the second dropout layer is connected to a fully connected network layer, and the number of layers of the fully connected network layer is 2; An activation function is added to the prediction model to introduce a nonlinear relationship to improve the learning ability of the prediction model; the activation function is a linear rectification function, the prediction model minimizes the loss function by a gradient descent method, and the weight parameters in the network structure of the prediction model are adjusted layer by layer in reverse, and the recognition accuracy of the network for the target task is improved by iterative training, and the target task is the prediction feature sequence of the test set obtained in step S3; The parameters of the prediction model include: The forgetting rate of the dropout layer is d = 0.1; The number of GRU layers n = 2 and the time window windows = 5; The model is trained with batch size batch_size = 32 and epoch = 100; When the value of the loss function is less than 0.1, the prediction model training is completed; Evaluate the prediction model by using precision, recall, F1 score, and MCC indicators to evaluate the performance of the prediction model on a congestive heart failure dataset; The precision rate represents the probability of the actual positive sample among all samples predicted to be positive, and its expression formula is: TP means the number of positive classes predicted as positive classes, and FP means the number of negative classes predicted as positive classes. The closer the precision is to 1, the better the prediction model performs. The recall rate Recall represents the probability that the positive examples in the sample are predicted correctly, and the expression formula is: FN indicates the number of positive classes predicted as negative classes. The closer Recall is to 1, the better the prediction model performs. The F1 score expression formula is: Pre represents precision, Recall represents recall, and the closer the F1 score is to 1, the better the model performance is. MCC is a correlation coefficient describing the actual classification and the predicted classification, and the expression formula is: TN represents the number of negative classes predicted as negative classes, and the closer MCC is to 1, the better the model performance is; step S1 also includes the steps of deduplication, data format conversion, and data missing value processing for industrial carbon emission data.

Citation Information

Cited By

  • Carbon emission data anomaly detection system and method based on event triggering

    CN119646709A