Carbon emission data anomaly detection method and system
By dividing carbon emission data into multiple fragments and using genetic algorithm optimization, combined with FastDTW measurement and field adversarial training, the problem of degradation of detection model results caused by the time distribution of carbon emission data is solved, and effective anomaly detection in different time periods is achieved.
Patent Information
- Application Number
- CN202411931147.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-18
AI Technical Summary
The existing carbon emission data anomaly detection methods fail to effectively consider the distribution of data over time, resulting in the degradation of the detection model effect over time.
Through optimization problem solving, the data is divided into multiple fragments as diverse as possible, the FastDTW metric is used to speed up the solution, the cross-variant operation methods suitable for this problem are designed, and the genetic algorithm is used for optimization. Finally, an abnormality detection model suitable for the entire monitoring process is obtained through domain adversarial training.
Effectively respond to possible distribution changes in the data, ensure the detection effect of the model in different time periods, improve the generalization ability and detection efficiency of the model, and effectively identify and eliminate abnormalities in carbon emission data.
Smart Images

Figure CN119848729A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of carbon emission data processing, and specifically relates to a method and system for detecting anomalies in carbon emission data. Background Art
[0002] With the rapid development of economy, different industrial systems are gradually taking shape, and the carbon emissions are also increasing and expanding. The global climate is gradually warming, and human survival is facing serious challenges. It is urgent to promote carbon reduction in the field of high energy consumption in industry. To achieve this goal, timely collection and analysis of enterprise carbon emission data is the premise of carbon reduction. The carbon emission data of enterprises are essentially time series data. Since the production of enterprises has certain regularity in time, this kind of data has strong periodicity and seasonality. Inevitably, due to human or equipment factors in the data collection process, these data have certain noise and abnormalities. Timely detection and elimination of anomalies in the data is a key step to ensure the effect of subsequent analysis. The current status of existing technical research is as follows: Anomaly detection method based on matrix profile technology: This method is particularly based on matrix profile technology. The time series is obtained by preprocessing industrial carbon emission data, and the feature sequence of the time series is extracted by matrix profile technology. Then a prediction model is established, and finally the abnormal data points are identified by comparing the feature sequence with the predicted feature sequence. The researchers proposed a prediction model called MP-GRU (matrix profile-gated recurrent unit). The model uses the gated recurrent unit (GRU) network model, which has better support for long-term dependencies, fewer parameters, and is easier to converge. Existing studies have also used the SKNN-RFCM clustering algorithm for rough sample identification and anomaly detection based on the PSO-BP neural network.
[0003] However, the above method does not take into account the possibility that the distribution of carbon emission data may change over time, which may cause the effect of the anomaly detection model to degrade over time. To overcome the above problems, this patent proposes a method and system for anomaly detection of carbon emission data. The benefits of this method are: by solving the optimization problem, the data is divided into multiple fragments as diverse as possible to deal with the distribution change problem in the data; the FastDTW metric adopted can speed up the solution; the crossover and mutation operation methods suitable for the problem are designed, and the genetic algorithm is used for optimization, with strong global search capabilities; the loss function is designed for domain adversarial training, so that the model can learn the time correlation of data in different fragments, while reducing the distribution differences between different fragments, thereby obtaining an anomaly detection model suitable for the entire monitoring process. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for detecting anomalies in carbon emission data in order to solve the above-mentioned problems.
[0005] The technical solution adopted by the present invention is as follows: a method for detecting anomalies in carbon emission data, the method comprising the following steps:
[0006] S1: Collect carbon dioxide emission data, take out the gas in the flue and send it to the pretreatment unit, the pretreatment unit sends the gas in the flue to the online carbon dioxide gas analyzer after pretreatment, and the online carbon dioxide gas analyzer is used to continuously monitor the carbon dioxide in the flue gas, with a sampling frequency of one minute; the original carbon dioxide data obtained is recorded as DATA r ;
[0007] S2: The original carbon dioxide emission data collected by domain experts r Label and preprocess the labels to obtain the processed data DATA p ;
[0008] S3: DATA p Since carbon dioxide emissions change over time due to changes in combustion conditions, DATA p Divide into multiple segments, and achieve the purpose of segmentation by solving the following optimization problem. The objective formula of the optimization problem is:
[0009]
[0010] Where K is an integer between (0, K0], indicating that it is divided into K segments, K0 is a parameter to avoid over-division, n1,...,n K Indicates the starting point of each segment, i, j are integers between [1, K], FDTW (D i ,D j ) refers to D measured by FastDTW (Fast Dynamic Time Warping) i ,D j The distance between i ,D j refers to the i-th and j-th segments, Δ1 and Δ2 are preset parameters, |D| represents the length of segment D, and N is the total number of collected carbon dioxide emission data. The learning goal of the above formula is to make the distribution of each segment as diverse as possible by determining K and the corresponding segments, so as to learn an anomaly detection model that adapts to distribution changes;
[0011] S4: Use genetic algorithm to solve the optimization problem in step S3, and the individual with the maximum fitness after evolving to the maximum evolutionary number T is used as the final output partitioning scheme, and the number of partition segments of the final partitioning scheme is recorded as K* ;
[0012] S5: constructing samples according to the final division scheme;
[0013] S6: After completing the above operations, train an anomaly detection model. Since the emission data changes over time, the model to be trained should be able to learn the time correlation of data in different segments and reduce the distribution differences between different segments, so as to obtain an anomaly detection model suitable for the entire monitoring process;
[0014] S7: Feature extraction module f after the above training f and label prediction module f c That is, it can be used to detect anomalies of the mth data point based on the input carbon dioxide emission data of length m.
[0015] In a preferred embodiment, in step S1, the collection principle is through heating extraction method or extraction condensation method.
[0016] In a preferred embodiment, in step S2, the specific steps are:
[0017] Normalize the abnormal data marked by domain experts, that is, replace the abnormal data with normal data according to the data before and after the abnormal data point based on expert experience, and obtain the processed data DATA without abnormal data p .
[0018] In a preferred embodiment, in step S3, the learning goal of the objective function of the optimization problem is to make the distribution of each segment as diverse as possible by determining the number of divided segments and the corresponding segments, thereby learning an anomaly detection model that adapts to distribution changes.
[0019] In a preferred embodiment, in step S4, the random generation method of the initial population P(0) is: each individual represents a division scheme, and the number of division segments is assumed to be in the range of a to b, and a and b should be determined according to the total length of the emission data; a number c between a and b is randomly generated, and c time points are randomly selected from the collection time corresponding to the emission data, and these c time points determine c+1 division segments; the above generation process is repeated M times to obtain the initial population P(0) containing M individuals.
[0020] In a preferred embodiment, the fitness function of each individual is The selection operation is performed based on the evaluation of the individual according to the fitness function.
[0021] In a preferred embodiment, in step S4, the crossover operation adopts a single-point crossover method: for two individuals p and q that perform the crossover operation, first, in one of the individuals p (denoted as {n1, n2, ... n ω},n ω represents the starting point of the ωth segment, ω is the number of segments) and randomly selects a starting point n τ (1<τ<ω), find the starting point t=n on another individual q τ Or find two consecutive starting points t1 and t2, satisfying t1 <n τ And t2>n τ {n τ ,....,n ω} and the second half of individual q starting from t, or {n τ ,....,n ω} Cross with the second half of individual q starting from t2, check whether the individual after the crossover is within the range from a to b, if not, discard it; multi-point crossover can be operated in the same way as above;
[0022] The mutation operation is performed in the following way: for the individual p that performs the mutation operation, a starting point n is randomly selected τ (1<τ<ω), generate (n τ-1 ,n t+1 ), replace n with a random number in τ Or delete it; or for the individual p that performs the mutation operation, randomly select two adjacent starting segmentation points n τ ,n τ+1 , randomly generated (n τ ,n τ+1 ) and insert it into n τ ,n τ+1 The above operation can also be applied to multiple points on an individual.
[0023] In a preferred embodiment, in step S5, the specific steps are:
[0024] Divide the original carbon dioxide data DATA according to the final division scheme r , get K * The following operations are performed on each of the raw CO2 data segments:
[0025] The carbon dioxide emission data of length m consisting of the abnormal data point annotated by the domain expert and the m-1 data points before it is taken as feature x, and the label of the abnormal data point is taken as label y to form an abnormal sample; the carbon dioxide emission data of m consecutive normal data points annotated by the domain expert is taken as feature x, and the label of the normal data point is taken as label y to form a normal sample;
[0026] The K formed in the above manner * The normal samples and abnormal samples on the original carbon dioxide data segments together constitute the data set DATA s .
[0027] In a preferred embodiment, in step S6, the specific steps are as follows:
[0028] For the data set DATA formed above s , and further divide it into training set DATA in a ratio of 8:2 train and the test set DATA test ;
[0029] Build the model architecture, as shown in the figure, which mainly includes the feature extraction module f f , label prediction module f c And the discriminant module f d , the learnable parameters in the three modules are denoted as θ f ,θ c ,θ d The feature extraction module consists of three layers of multi-core convolution blocks and a maximum pooling layer. The label prediction module and the discrimination module adopt a fully connected layer structure. The input of the label prediction module is the feature vector of a sample after passing through the feature extraction module. The input of the discrimination module is the cascade of the feature vectors of a pair of samples after passing through the feature extraction module.
[0030] Define the following optimization objectives:
[0031]
[0032] Among them, L(θ f ,θ d ,θ c ) is the overall loss function, represents the i-th sample in the j-th segment, N j Represents the total number of samples in the jth segment in the batch; is the classification loss function, and the cross entropy loss can be used; λ is a trade-off factor, and the number of normal samples in the jth segment in the batch is recorded as is the discriminant loss function, which measures the consistency between the actual output and the expected output of the discriminant module for a pair of normal samples. For each pair of normal samples in the batch, if they come from the same segment, the expected output of the discriminant module is 1, otherwise it is 0.
[0033] Using the training set DATA train The above-mentioned model is trained alternately against each other, and the feature extraction module f is trained by minimizing the classification loss. fand label prediction module f c Perform parameter optimization by maximizing the discriminant loss for the discriminant module f d Perform parameter optimization;
[0034] And in DATA test Test the model effect on the test set DATA test If the above results are good, the model training is completed.
[0035] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0036] In the present invention, by solving the optimization problem, the data is divided into multiple fragments as diverse as possible, which can effectively deal with the distribution change problem that may exist in the data, thereby ensuring the detection effect of the model in different time periods. Secondly, the FastDTW metric method is used to speed up the solution speed and improve efficiency. In addition, this method designs crossover and mutation operation methods suitable for this problem, and uses genetic algorithms for optimization to achieve global search and improve the generalization ability of the model. Finally, through domain adversarial training, this method enables the model to learn the time correlation of data in different fragments, while reducing the distribution differences between different fragments, thereby obtaining an anomaly detection model suitable for the entire monitoring process, which can effectively identify and eliminate anomalies in carbon emission data, provide an accurate and reliable data basis for subsequent analysis, and help carbon reduction in the field of high energy consumption in industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the process principle of the present invention;
[0038] Figure 2 This is a diagram of the anomaly detection model architecture of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0040] Example: Refer to Figures 1-2 , a method for detecting anomalies in carbon emission data, comprising the following steps:
[0041] S1. Collect carbon dioxide emission data. The collection principle is to extract the gas in the flue through the heating extraction method or the extraction condensation method and transport it to the pretreatment unit. The pretreatment unit sends the gas in the flue to the online carbon dioxide gas analyzer after pretreatment. The online carbon dioxide gas analyzer continuously monitors the carbon dioxide in the flue gas with a sampling frequency of one minute. The original carbon dioxide data obtained is recorded as DATAr ;
[0042] S2. The original carbon dioxide emission data DATA collected by domain experts r Label and preprocess the labels to obtain the processed data DATA p ; The specific steps are:
[0043] Normalize the abnormal data marked by domain experts, that is, replace the abnormal data with normal data according to the data before and after the abnormal data point based on expert experience, and obtain the processed data DATA without abnormal data p ;
[0044] S3, DATA p Since carbon dioxide emissions change over time due to changes in combustion conditions, DATA p Divide into multiple segments, and achieve the purpose of segmentation by solving the following optimization problem. The goal of this optimization problem can be expressed as:
[0045]
[0046] Where K is an integer between (0, K0], indicating that it is divided into K segments, K0 is a parameter to avoid over-division, n1,...,n K Indicates the starting point of each segment, i, j are integers between [1, K], FDTW (D i ,D j ) refers to D measured by FastDTW (Fast Dynamic Time Warping) i ,D j The distance between i ,D j refers to the i-th and j-th segments, Δ1 and Δ2 are preset parameters, |D| represents the length of segment D, and N is the total number of collected carbon dioxide emission data. The learning goal of the above formula is to make the distribution of each segment as diverse as possible by determining K and the corresponding segments, so as to learn an anomaly detection model that adapts to distribution changes;
[0047] S4, using genetic algorithm to solve the optimization problem in step S3, the individual with the maximum fitness after evolving to the maximum evolutionary number T is used as the final output partitioning scheme, and the number of partition segments of the final partitioning scheme is recorded as K * ;Specifically,
[0048] The random generation method of the initial population P(0) is as follows: each individual represents a partitioning scheme, and the number of partitioning segments is set to be between a and b, where a and b should be determined based on the total length of the emission data; a number c between a and b is randomly generated, and c time points are randomly selected from the collection time corresponding to the emission data, and these c time points determine c+1 partitioning segments; the above generation process is repeated M times to obtain the initial population P(0) containing M individuals;
[0049] The fitness function of each individual is The selection operation is performed based on the evaluation of the individual according to the fitness function;
[0050] The crossover operation can be performed in a single-point crossover manner: for two individuals p and q that perform the crossover operation, first select one of the individuals p (denoted as {n1, n2, ... n ω},n ω represents the starting point of the ωth segment, ω is the number of segments) and randomly selects a starting point n τ (1<τ<ω), find the starting point t=n on another individual q τ Or find two consecutive starting points t1 and t2, satisfying t1 <n τ And t2>n τ {n τ ,....,n ω} and the second half of individual q starting from t, or {n τ ,....,n ω} Cross with the second half of individual q starting from t2, check whether the individual after the crossover is within the range from a to b, if not, discard it; multi-point crossover can be operated in the same way as above;
[0051] The mutation operation can be performed in the following way: for the individual p that performs the mutation operation, a starting point n is randomly selected τ (1<τ<ω), generate (n τ-1 ,n t+1 ), replace n with a random number in τ Or delete it; or for the individual p that performs the mutation operation, randomly select two adjacent starting segmentation points n τ ,n τ+1 , randomly generated (n τ ,n τ+1 ) and insert it into n τ ,n τ+1 The above operation can also be applied to multiple points on an individual;
[0052] S5. Construct samples according to the final partitioning scheme. The specific steps are as follows:
[0053] Divide the original carbon dioxide data DATA according to the final division scheme r , get K * The following operations are performed on each of the raw CO2 data segments:
[0054] The carbon dioxide emission data of length m consisting of the abnormal data point annotated by the domain expert and the m-1 data points before it is taken as feature x, and the label of the abnormal data point is taken as label y to form an abnormal sample; the carbon dioxide emission data of m consecutive normal data points annotated by the domain expert is taken as feature x, and the label of the normal data point is taken as label y to form a normal sample;
[0055] The K formed in the above manner * The normal samples and abnormal samples on the original carbon dioxide data segments together constitute the data set DATA s ;
[0056] S6. After completing the above operations, train the anomaly detection model. Since the emission data changes over time, the model to be trained should be able to learn the time correlation of data in different segments and reduce the distribution differences between different segments, so as to obtain an anomaly detection model suitable for the entire monitoring process;
[0057] The specific steps are as follows:
[0058] For the data set DATA formed above s , and further divide it into training set DATA in a ratio of 8:2 train and the test set DATA test ;
[0059] Build the model architecture, such as Figure 1 As shown, it mainly includes feature extraction module f f , label prediction module f c And the discriminant module f d , the learnable parameters in the three modules are denoted as θ f ,θ c ,θ d , where the feature extraction module consists of three layers of multi-core convolution blocks and a maximum pooling layer, the label prediction module and the discrimination module adopt a fully connected layer structure, the input of the label prediction module is the feature vector of a sample after passing through the feature extraction module, and the input of the discrimination module is the cascade of the feature vectors of a pair of samples after passing through the feature extraction module;
[0060] Define the following optimization objectives:
[0061]
[0062] Among them, L(θ f ,θd ,θ c ) is the overall loss function, represents the i-th sample in the j-th segment, N j Represents the total number of samples in the jth segment in the batch; is the classification loss function, and the cross entropy loss can be used; λ is a trade-off factor, and the number of normal samples in the jth segment in the batch is recorded as is the discriminant loss function, which measures the consistency between the actual output and the expected output of the discriminant module for a pair of normal samples. For each pair of normal samples in the batch, if they come from the same segment, the expected output of the discriminant module is 1, otherwise it is 0.
[0063] Using the training set DATA train The above-mentioned model is trained alternately against each other, and the feature extraction module f is trained by minimizing the classification loss. f and label prediction module f c Perform parameter optimization by maximizing the discriminant loss for the discriminant module f d Perform parameter optimization;
[0064] And in DATA test Test the model effect on the test set DATA test If the above results are good, the model training is completed;
[0065] S7, feature extraction module f after the above training f and label prediction module f c That is, it can be used to detect anomalies of the mth data point based on the input carbon dioxide emission data of length m.
[0066] From the above, we can know that: in the present invention, by solving the optimization problem, the data is divided into multiple segments as diverse as possible, which can effectively deal with the distribution change problem that may exist in the data, thereby ensuring the detection effect of the model in different time periods. Secondly, the FastDTW metric method is used to speed up the solution speed and improve efficiency. In addition, this method designs crossover and mutation operation methods suitable for this problem, and uses genetic algorithms for optimization to achieve global search and improve the generalization ability of the model. Finally, through domain adversarial training, this method enables the model to learn the time correlation of data in different segments, while reducing the distribution differences between different segments, thereby obtaining an anomaly detection model suitable for the entire monitoring process, which can effectively identify and eliminate anomalies in carbon emission data, provide an accurate and reliable data basis for subsequent analysis, and assist in carbon reduction in high-energy-consuming industrial fields.
[0067] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0068] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting anomalies in carbon emission data, characterized in that: The method comprises the following steps: S1: Collect carbon dioxide emission data, take out the gas in the flue and send it to the pretreatment unit, the pretreatment unit sends the gas in the flue to the online carbon dioxide gas analyzer after pretreatment, and the online carbon dioxide gas analyzer is used to continuously monitor the carbon dioxide in the flue gas, with a sampling frequency of one minute; the original carbon dioxide data obtained is recorded as DATA r ; S2: The original carbon dioxide emission data collected by domain experts r Label and preprocess the labels to obtain the processed data DATA p ; S3: DATA p Since carbon dioxide emissions change over time due to changes in combustion conditions, DATA p Divide into multiple segments, and achieve the purpose of segmentation by solving the following optimization problem. The objective formula of the optimization problem is: Where K is an integer between (0, K0], indicating that it is divided into K segments, K0 is a parameter to avoid over-division, n1,...,n K Indicates the starting point of each segment, i, j are integers between [1, K], FDTW (D i ,D j ) refers to D measured by FastDTW (Fast Dynamic Time Warping) i ,D j The distance between i ,D j refers to the i-th and j-th segments, Δ1 and Δ2 are preset parameters, |D| represents the length of segment D, and N is the total number of collected carbon dioxide emission data. The learning goal of the above formula is to make the distribution of each segment as diverse as possible by determining K and the corresponding segments, so as to learn an anomaly detection model that adapts to distribution changes; S4: Use genetic algorithm to solve the optimization problem in step S3, and the individual with the maximum fitness after evolving to the maximum evolutionary number T is used as the final output partitioning scheme, and the number of partition segments of the final partitioning scheme is recorded as K * ; S5: constructing samples according to the final division scheme; S6: After completing the above operations, train an anomaly detection model. Since the emission data changes over time, the model to be trained should be able to learn the time correlation of data in different segments and reduce the distribution differences between different segments, so as to obtain an anomaly detection model suitable for the entire monitoring process; S7: Feature extraction module f after the above training f and label prediction module f c That is, it can be used to detect anomalies of the mth data point based on the input carbon dioxide emission data of length m.
2. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S1, the collection principle is through heating extraction method or extraction condensation method.
3. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S2, the specific steps are: Normalize the abnormal data marked by domain experts, that is, replace the abnormal data with normal data according to the data before and after the abnormal data point based on expert experience, and obtain the processed data DATA without abnormal data p .
4. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S3, the learning goal of the objective function of the optimization problem is to make the distribution of each segment as diverse as possible by determining the number of divided segments and the corresponding segments, thereby learning an anomaly detection model that adapts to distribution changes.
5. The method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S4, the random generation method of the initial group P(0) is as follows: each individual represents a division scheme, and the number of division segments is assumed to be in the range of a to b, and a and b should be determined according to the total length of the emission data; a number c between a and b is randomly generated, and c time points are randomly selected from the collection time corresponding to the emission data, and these c time points determine c+1 division segments; the above generation process is repeated M times to obtain the initial group P(0) containing M individuals.
6. A method for detecting anomalies in carbon emission data according to claim 5, characterized in that: The fitness function of each individual is The selection operation is performed based on the evaluation of the individual according to the fitness function.
7. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S4, the crossover operation adopts a single-point crossover method: for two individuals p and q that perform the crossover operation, first, in one of the individuals p (denoted as {n1, n2, ... n ω },n ω represents the starting point of the ωth segment, ω is the number of segments) and randomly selects a starting point n τ (1<τ<ω), find the starting point t=n on another individual q τ Or find two consecutive starting points t1 and t2, satisfying t1 <n τ And t2>n τ {n τ ,....,n ω } and the second half of individual q starting from t, or {n τ ,....,n ω } Cross with the second half of individual q starting from t2, check whether the individual after the crossover is within the range from a to b, if not, discard it; multi-point crossover can be operated in the same way as above; The mutation operation is performed in the following way: for the individual p that performs the mutation operation, a starting point n is randomly selected τ (1<τ<ω), generate (n τ-1 ,n t+1 ), replace n with a random number in τ Or delete it; or for the individual p that performs the mutation operation, randomly select two adjacent starting segmentation points n τ ,n τ+1 , randomly generated (n τ ,n τ+1 ) and insert it into n τ ,n τ+1 The above operation can also be applied to multiple points on an individual.
8. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S5, the specific steps are: Divide the original carbon dioxide data DATA according to the final division scheme r , get K * The following operations are performed on each of the raw CO2 data segments: The carbon dioxide emission data of length m consisting of the abnormal data point annotated by the domain expert and the m-1 data points before it is taken as feature x, and the label of the abnormal data point is taken as label y to form an abnormal sample; the carbon dioxide emission data of m consecutive normal data points annotated by the domain expert is taken as feature x, and the label of the normal data point is taken as label y to form a normal sample; The K formed in the above manner * The normal samples and abnormal samples on the original carbon dioxide data segments together constitute the data set DATA s .
9. A method for detecting anomalies in carbon emission data according to claim 1, characterized in that: In step S6, the specific steps are as follows: For the data set DATA formed above s , and further divide it into training set DATA in a ratio of 8:2 train and the test set DATA test ; Build the model architecture, including the feature extraction module f f , label prediction module f c and the discriminant module f d , the learnable parameters in the three modules are denoted as θ f ,θ c ,θ d , where the feature extraction module consists of three layers of multi-core convolution blocks and a maximum pooling layer, the label prediction module and the discrimination module adopt a fully connected layer structure, the input of the label prediction module is the feature vector of a sample after passing through the feature extraction module, and the input of the discrimination module is the cascade of the feature vectors of a pair of samples after passing through the feature extraction module; Define the following optimization objectives: Among them, L(θ f ,θ d ,θ c ) is the overall loss function, represents the i-th sample in the j-th segment, N j represents the total number of samples in the jth segment in the batch; l c (.,.) is the classification loss function, and cross entropy loss can be used; λ is a trade-off factor, and the number of normal samples in the jth segment in the batch is recorded as l d (.,.) is the discriminant loss function, which measures the consistency between the actual output and expected output of the discriminant module for a pair of normal samples. For each pair of normal samples in the batch, if they come from the same segment, the expected output of the discriminant module is 1, otherwise it is 0. Using the training set DATA train The above-mentioned model is trained alternately against each other, and the feature extraction module f is trained by minimizing the classification loss. f and label prediction module f c Perform parameter optimization by maximizing the discriminant loss for the discriminant module f d Perform parameter optimization; And in DATA test Test the model effect on the test set DATA test If the above results are good, the model training is completed.
10. A carbon emission data anomaly detection system, characterized in that: The system uses the carbon emission data anomaly detection method as described in any one of claims 1 to 9 when running.