Pollutant time series data anomaly identification method and system based on sliding window
Through the combination of the sliding window and the random forest model, the problem of large and inconsistent data in the identification of pollution source emission anomalies is solved, the correlation mining of pollutant emission and electricity consumption data is realized, and the accuracy and generalization of anomaly identification are improved. capability, reducing the rate of false positives and false negatives, and providing more accurate predictions of pollution discharge behavior.
Patent Information
- Application Number
- CN202410914983.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-15
AI Technical Summary
Existing pollution source emission anomaly identification technology has problems such as large data volume, difficult processing, inconsistent data, and difficulty in applying multi-source data. Especially when the power consumption data and pollutant emission systems are separated, it leads to low identification efficiency and false alarms. The false negative rate is high.
The unsupervised learning method based on the sliding window is combined with machine learning to detect data anomalies through the sliding window, and use the random forest model to predict the anomalies, identify the correlation between the enterprise's pollutant emission data and electricity consumption data, and realize abnormal emissions. accurate identification.
It improves the accuracy and generalization ability of identifying pollutant emission anomalies, reduces the rate of false positives and omissions, and enables targeted analysis based on corporate needs without relying on a database of historical anomaly rules, improving the accuracy of predictions of pollutant emission behavior. sex.
Smart Images

Figure CN118779800A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of environmental monitoring, and in particular to a method and system for identifying anomalies in pollutant time series data based on a sliding window. Background Art
[0002] Identification of abnormal pollution discharge from pollution sources is of great significance for discovering possible data tampering and data falsification by enterprises. At present, common technologies for identifying abnormal pollution discharge from pollution sources are mainly divided into two categories: traditional statistical methods and advanced data analysis technologies. Traditional statistical methods rely on basic statistical characteristics of historical data, such as mean, variance, quantile, etc., to detect abnormal emissions. These methods are relatively simple and suitable for some basic abnormal situations, but they may not be sensitive enough for complex abnormal patterns and are prone to false positives or false negatives. Compared with traditional methods, advanced data analysis technologies show higher accuracy and sensitivity in identifying abnormal pollution discharge from pollution sources. These technologies include machine learning methods, deep learning methods, and time series analysis methods. Machine learning methods can learn patterns of abnormal emissions from historical data and identify them based on new data. Deep learning models such as neural networks can capture abnormal behaviors in time series data, while time series analysis methods focus on the temporal characteristics of emission data and are used to detect seasonal or periodic emission anomalies. Regardless of which method is used, identification of abnormal pollution discharge from pollution sources requires high-quality data as input so that the model can accurately identify abnormal situations. In addition, continuous updating and improvement of the model is also key to maintain its recognition performance to adapt to changing emission situations and new abnormal patterns.
[0003] However, the prior art has the following problems:
[0004] At present, electricity consumption data has a huge amount of data and is difficult to process due to the large number of monitoring points and high frequency of data transmission. At the same time, due to the separation of electricity consumption and pollutant emission system construction, multiple systems cannot communicate with each other, and it is impossible to establish a connection between pollutant emission outlets and electricity consumption monitoring equipment. In addition, different companies have different monitoring methods, equipment, and emission limits, and the company names have not been unified, making data integration more difficult, resulting in high requirements and heavy workload for early data processing. Due to problems such as incomplete and inconsistent data, multi-source data is difficult to apply. Summary of the invention
[0005] Based on this, it is necessary to provide a pollutant time series data anomaly identification method and system based on a sliding window to address the problems of large processing volume and difficulty caused by the existing anomaly detection technology relying on historical data and inconsistent data.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A method for identifying abnormalities in pollutant time series data based on a sliding window comprises the following steps:
[0008] S1. Obtain the emission data of the pollutant outlets of the enterprise and the electricity consumption data of the electrical equipment, and after data cleaning, obtain the emission of each pollutant and the total pollution generation and treatment fee rate, and form a data set according to the time series;
[0009] S2. Use the unsupervised learning method based on sliding window to detect anomalies in the data set, and then obtain the data anomalies; the specific steps of anomaly detection are as follows:
[0010] S21. Selecting d days of data from the data set as the judgment window, dividing the d days of data into the previous data d1 and the subsequent data d2 using the preset time node as the dividing point;
[0011] S22. Calculate the average value of the total pollution generation and pollution control fee rate in the previous data d1 to obtain the average fee rate Qavgd1, calculate the average value of the key pollutant emissions exceeding type c in the previous data d1 to obtain the average emission amount Pavgd1, compare the average fee rate Qavgd1 and the average emission amount Pavgd1 with the daily total pollution generation and pollution control fee rate Qd2 and the daily key pollutant emissions exceeding type c Pd2 in the subsequent data d2, and make the following judgment based on the comparison results:
[0012] If Qd2≥Qavgd1*n1, Pd2<Pavgd1*n2, then the data in the judgment window is abnormal;
[0013] Among them, c is the low-value pollutant type limit constant, n1 and n2 are low-value limit multiplier constants;
[0014] S3. Use the machine learning model to detect anomalies in the data set, and then obtain the data anomaly period, and check it with the data anomaly in step S2 to identify the abnormal data, verify the cause of the anomaly and issue an abnormal warning.
[0015] Furthermore, the random forest model in machine learning is used to predict anomalies in the data set. The specific steps are as follows:
[0016] Bootstrap sampling is used to generate multiple different training subsets from the data set, and then T decision trees are constructed to obtain a random forest model with T decision trees.
[0017] Randomly select m features from the data set and input them into the random forest model with T decision trees for prediction, and get the predicted value of the random forest model
[0018]
[0019] Among them, y j (m) is the predicted value of the jth decision tree, j≤T.
[0020] Furthermore, in step S1, the emission data of the pollutant outlets of the enterprise and the electricity consumption data of the electrical equipment are cleaned to obtain the emission of each pollutant and the total pollution generation and treatment fee rate, and the specific steps of forming the data set according to the time series are as follows:
[0021] The average emissions of the pollutant outlets corresponding to the same pollutant of the same enterprise on the same day are summed to obtain the daily emissions of the same pollutant of the enterprise. The daily emissions of the same pollutant within the preset period are summarized in time series to obtain the pollutant emissions. Similarly, the emissions of each pollutant are calculated;
[0022] The rates of the electricity-consuming equipment used for pollution generation and pollution control of the same enterprise on the same day are summed up to obtain the total pollution generation and pollution control rate for a single day, and the total pollution generation and pollution control rates for a single day within a preset period are summarized in time series to obtain the total pollution generation and pollution control rate of the enterprise;
[0023] According to the company name, the emission amount of each pollutant and the total pollution production and pollution control fee rate are used as column attributes to integrate the data, and the null values are removed to obtain the data set.
[0024] Furthermore, the pollutants include sulfur dioxide, nitrogen oxides, non-methane total hydrocarbons, and other exhaust gas flows.
[0025] Furthermore, in step S2, before performing anomaly detection on the data set using an unsupervised learning method based on a sliding window, a separate / comprehensive time series visualization analysis is performed on the data set to preliminarily identify and mark abnormal data.
[0026] The present invention also relates to a pollutant time series data anomaly identification system based on a sliding window, which applies the aforementioned pollutant time series data anomaly identification method based on a sliding window, and includes a data acquisition and cleaning module, a first anomaly detection module, a second anomaly detection module, and an anomaly warning module.
[0027] The data collection and cleaning module is used to obtain the emission data of the enterprise's pollutant outlets and the electricity consumption data of the electrical equipment. After data cleaning, the emission of each pollutant and the total pollution generation and treatment fee rate are obtained, and the data set is formed according to the time series;
[0028] The first anomaly detection module is used to perform anomaly detection on the data set using an unsupervised learning method based on a sliding window, thereby obtaining data anomalies;
[0029] The second anomaly detection module is used to perform anomaly detection on the data set using a machine learning model, thereby obtaining data anomalies;
[0030] The abnormal warning module is used to check the data abnormalities of the first abnormal detection module and the second abnormal detection module, clarify the abnormal data, verify the abnormal cause and issue an abnormal warning.
[0031] Compared with the prior art, the beneficial effects of the present invention include:
[0032] 1. The present invention combines unsupervised learning and machine learning methods based on sliding windows to explore the correlation between electricity rates and pollutant emission data. It uses mathematical statistics-related algorithms to conduct targeted analysis and judgment based on specific abnormal states of enterprise needs without relying on the historical abnormal rule database, thereby more accurately predicting the pollution discharge behavior of enterprises.
[0033] 2. The present invention adopts the random forest model to judge abnormal time periods, which improves the generalization ability and accuracy of the recognition model. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The disclosure of the present invention is described with reference to the accompanying drawings. It should be understood that the drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. Among them:
[0035] Figure 1 This is a flow chart of a method for identifying abnormalities in pollutant time series data based on a sliding window introduced by the present invention;
[0036] Figure 2 This is a schematic diagram of the abnormal pollutant period of Company A. DETAILED DESCRIPTION
[0037] It is easy to understand that according to the technical solution of the present invention, without changing the essential spirit of the present invention, a person skilled in the art can propose a variety of interchangeable structural modes and implementation modes. Therefore, the following specific implementation modes and drawings are only exemplary descriptions of the technical solution of the present invention, and should not be regarded as the whole of the present invention or as a limitation or restriction to the technical solution of the present invention.
[0038] Example 1
[0039] See also Figure 1 This embodiment introduces a method for identifying abnormalities in pollutant time series data based on a sliding window, comprising the following steps:
[0040] Step S1. Obtain the emission data of the enterprise's pollutant outlets and the electricity consumption data of electrical equipment, obtain the emission of each pollutant and the total pollution generation and treatment fee rate after data cleaning, and form a data set in time series.
[0041] This step is mainly used to collect the enterprise's pollutant discharge data and power consumption data of electrical equipment, and provide daily power consumption and pollutant data. Due to the lack of mapping relationship between pollutant discharge outlets and specific power equipment, pre-processing operations such as cleaning are required after the data is collected.
[0042] The specific steps are as follows:
[0043] First, perform aggregation operations, conduct comprehensive statistics on the emission data from different sources of the enterprise, and calculate the total emission to observe the enterprise's pollution discharge status. For pollutant data, sum the average emissions of different outlets of the same enterprise and the same pollutant type on the same day; for electricity data, select the correct phase and divide the pollution generation and treatment types of the power equipment, and sum the total rates of different power equipment of the same enterprise on the same day according to the pollution generation and treatment types.
[0044] Then, a splicing operation is performed to correctly integrate the data according to the company name, using the amount of pollutant emissions and the total pollution production and treatment fee rate as column attributes. The integrated data can be used as data for model training.
[0045] Then perform anomaly screening operations, select appropriate abnormal data screening methods such as "eliminate null values", delete interfering data, and use the screened data set as the input for subsequent steps.
[0046] Therefore, the data set contains the daily emissions of various pollutants and the total pollution control fee value within a time period. Pollutants include sulfur dioxide, nitrogen oxides, non-methane hydrocarbons and other exhaust gas flows.
[0047] Step S2: Use an unsupervised learning method based on sliding windows to perform anomaly detection on the data set to obtain data anomalies.
[0048] By processing the sequence data in the data set, useful information is extracted, and a sliding window is used to identify periodic patterns, trends or mutation points in the time series. The principles of mathematical statistics are used to determine whether the enterprise electricity consumption data and pollutant emission data are abnormal.
[0049] Before performing anomaly detection, visual analysis can also be performed to conduct separate / comprehensive time series visual analysis of the pollutant emissions and total pollution production and treatment fee values of individual enterprises in the data set, and preliminarily identify and mark abnormal data.
[0050] The specific steps of anomaly detection are as follows:
[0051] Step S21. Select d days of data from the data set as the judgment window, and divide the d days of data into the previous data d1 and the subsequent data d2 using the preset time node as the dividing point;
[0052] Step S22. Calculate the average value of the total pollution generation and pollution control fee rate in the previous data d1 to obtain the average rate Qavgd1, calculate the average value of the key pollutant emissions exceeding c types in the previous data d1 to obtain the average emission value Pavgd1, compare the average rate Qavgd1 and the average emission value Pavgd1 with the daily total pollution generation and pollution control fee rate Qd2 and the daily key pollutant emissions exceeding c types Pd2 in the subsequent data d2, and make the following judgment based on the comparison results:
[0053] If Qd2≥Qavgd1*n1, Pd2<Pavgd1*n2, then the data in the judgment window is abnormal;
[0054] Among them, c is the low-value pollutant type limit constant, and n1 and n2 are the low-value limit multiplier constants.
[0055] This step aims to analyze whether the data in the current period has this abnormal state in response to the phenomenon that "electricity consumption data remains normal but pollutant emission data decreases for several consecutive days".
[0056] Step S3. Use the machine learning model to detect anomalies in the data set, and then obtain the data anomaly period, and check it with the data anomaly in S2 to identify the abnormal data, verify the cause of the anomaly and issue an abnormal warning.
[0057] This step builds a more sophisticated model for a single company by establishing a random forest model, capturing patterns and correlations in the data from different perspectives, and providing a deeper understanding and prediction of the company's pollution discharge. Input the data set into the random forest model for prediction and obtain the corresponding prediction value
[0058] The following is a detailed introduction to the anomaly prediction of the random forest model.
[0059] 1) Random Forest Model: The advantage of random forest is that it reduces the risk of overfitting of a single decision tree by integrating multiple decision trees. It has strong robustness and generalization ability. Measuring the contribution of features in decision tree splitting to evaluate the importance of features helps feature selection and model interpretation.
[0060] As an ensemble learning algorithm, random forest combines multiple decision trees to improve prediction performance and generalization ability. One of the core ideas of random forest is to generate multiple different training subsets from the original data set through Bootstrap sampling. This means that each decision tree uses a different data subset, increasing the diversity of the model. Suppose there is a data set containing N samples. Each time sampling is performed, N samples are randomly selected with replacement to form a new data subset.
[0061] Feature randomness: Random forest introduces feature randomness, that is, at each decision tree node, instead of using all features for segmentation, a portion of features are randomly selected from all features. This helps prevent certain features from becoming the main segmentation features in each tree and increases the diversity of the model. Assume that the data set processed by step S1 contains a total of P features. Each time a segmentation is performed, m features are randomly selected for segmentation, usually
[0062] Construction of decision tree: For each Bootstrap sample, a decision tree is constructed. The construction of decision tree follows the following principle: starting from the root node, a feature and a split point are selected to divide the data set into two subsets, and then the process is recursively repeated on each subset until the stopping condition is reached (such as the maximum depth of the tree, the number of samples in the node is lower than the threshold, etc.). The selection of the split point is usually based on a certain splitting criterion, such as Gini impurity (for classification problems) or mean square error (for regression problems).
[0063] Voting ensemble: In classification problems, each decision tree predicts a category for a new sample. The final prediction is the voting result of all decision tree predictions, that is, the category with the most votes becomes the final prediction. In regression problems, the average of all decision tree predictions is taken.
[0064] In this example, the random forest model is used for regression prediction. The model uses a random forest model that contains T decision trees. For the new input feature m, the prediction value of the random forest model is used. It can be expressed as:
[0065]
[0066] in, is the predicted value of the random forest model, y j (m) is the predicted value of the jth decision tree, j≤T, and j is an integer.
[0067] Therefore, when this embodiment is implemented, taking the daily pollutant emissions and the total pollution production and treatment fee data as an example, an unsupervised learning method based on a sliding window is adopted, and the four pollutant emission data of sulfur dioxide, exhaust gas flow, nitrogen oxides, and non-methane total hydrocarbons are selected as key pollutant data for air pollutant emissions for analysis.
[0068] The low-value limit multiplier constants n1 and n2 are set to 0.1 / 0.01, the total number of days d for judgment is set to 15, the total number of days d1 for statistical feature calculation is set to 10, the total number of days d2 is set to 5, and the number of pollutant types that are suddenly at low values is set to 2. After the collected data is cleaned accordingly, it is input into the corresponding unsupervised learning based on the sliding window for identification, and all pollution source pollution abnormal windows are obtained; the cleaned data is then input into the corresponding random forest model to identify the abnormal period of pollution discharge from the pollution source of the enterprise. Finally, the abnormal period identification results of the unsupervised learning based on the sliding window and the machine learning are combined to accurately locate the period and cause of the abnormal situation, so as to issue a warning of the problem.
[0069] The display diagram of abnormal period is as follows Figure 2 shown. Figure 2 This is a schematic diagram of the abnormal pollutant period of company A. Figure 2 It can be seen that during the time period of 177-179, when the total product equipment rate, average exhaust gas flow emissions, and average nitrogen oxide emissions remained relatively stable, the average sulfur dioxide emissions suddenly increased and then decreased, so there was an abnormal situation during this period.
[0070] Example 2
[0071] This embodiment introduces a pollutant time series data anomaly identification system based on a sliding window, including a data acquisition and cleaning module, a first anomaly detection module, a second anomaly detection module, and an anomaly warning module.
[0072] The data collection and cleaning module is used to obtain the emission data of the enterprise's pollutant outlets and the electricity consumption data of the electrical equipment. After data cleaning, the emission of each pollutant and the total pollution generation and treatment fee rate are obtained, and the data set is formed according to the time series;
[0073] The first anomaly detection module is used to perform anomaly detection on the data set using an unsupervised learning method based on a sliding window, thereby obtaining data anomalies;
[0074] The second anomaly detection module is used to perform anomaly detection on the data set using a machine learning model, thereby obtaining data anomalies;
[0075] The abnormal warning module is used to check the data abnormalities of the first abnormal detection module and the second abnormal detection module, clarify the abnormal data, verify the abnormal cause and issue an abnormal warning.
[0076] The sliding window method scales down the global point anomaly detection of the multidimensional time series of pollutant emissions and electricity consumption data to the local anomaly detection in a window, and makes full use of the relevant actual needs in the fraud scenario to complete knowledge-driven, thereby achieving the goal of combining knowledge-driven and data-driven; the unsupervised learning method does not rely on the historical anomaly rule database, and can perform targeted analysis and judgment based on the specific abnormal status of the enterprise needs, thereby improving the accuracy and practicality of the anomaly diagnosis algorithm model.
[0077] The second anomaly detection module uses the random forest model to judge abnormal periods. Compared with other traditional machine learning models, random forest can reduce the overfitting risk of a single decision tree by integrating multiple decision trees. It has strong robustness and generalization ability. Measuring the contribution of features in decision tree splits to evaluate the importance of features helps feature selection and interpretation of models.
[0078] By combining unsupervised learning based on sliding windows and random forest models, we innovatively explore the correlation between electricity consumption monitoring and pollutant emission data, thereby more accurately predicting corporate pollution discharge behavior.
[0079] When the system is actually used, a corresponding operation interface will be constructed. By inputting the data path to be processed in the corresponding data box, subsequent processing steps can be performed, such as visual processing.
[0080] The technical scope of the present invention is not limited to the contents in the above description. Those skilled in the art can make various deformations and modifications to the above embodiments without departing from the technical idea of the present invention, and these deformations and modifications should all fall within the protection scope of the present invention.
Claims
1. A method for identifying abnormalities in pollutant time series data based on a sliding window, characterized in that: It includes the following steps: S1. Obtain the emission data of the pollutant outlets of the enterprise and the electricity consumption data of the electrical equipment, and after data cleaning, obtain the emission of each pollutant and the total pollution generation and treatment fee rate, and form a data set according to the time series; S2. Use the unsupervised learning method based on sliding window to detect anomalies in the data set, and then obtain the data anomalies; the specific steps of anomaly detection are as follows: S21. Selecting d days of data from the data set as the judgment window, dividing the d days of data into the previous data d1 and the subsequent data d2 at the preset time node; S22. Calculate the average value of the total pollution generation and pollution control fee rate in the previous data d1 to obtain the average fee rate Qavgd1, calculate the average value of the key pollutant emissions exceeding type c in the previous data d1 to obtain the average emission amount Pavgd1, compare the average fee rate Qavgd1 and the average emission amount Pavgd1 with the daily total pollution generation and pollution control fee rate Qd2 and the daily key pollutant emissions exceeding type c Pd2 in the subsequent data d2, and make the following judgment based on the comparison results: If Qd2≥Qavgd1*n1, Pd2<Pavgd1*n2, then the data in the judgment window is abnormal; Among them, c is the low-value pollutant type limit constant, n1 and n2 are low-value limit multiplier constants; S3. Use the machine learning model to detect anomalies in the data set, and then obtain the data anomaly period, and check it with the data anomaly in step S2 to identify the abnormal data, verify the cause of the anomaly and issue an abnormal warning.
2. The method for identifying abnormalities in pollutant time series data based on sliding windows according to claim 1 is characterized in that: In step S3, the random forest model in machine learning is used to predict anomalies of the data set.
3. The method for identifying abnormalities in pollutant time series data based on sliding windows according to claim 2 is characterized in that: The specific steps for using the random forest model in machine learning to predict anomalies in a data set are as follows: Bootstrap sampling is used to generate multiple different training subsets from the data set, and then T decision trees are constructed to obtain a random forest model with T decision trees. Randomly select m features from the data set and input them into the random forest model with T decision trees for prediction, and get the predicted value of the random forest model Among them, y j (m) is the predicted value of the jth decision tree, j≤T.
4. The method for identifying abnormalities in pollutant time series data based on sliding windows according to claim 1 is characterized in that: In step S1, the emission data of the pollutant outlets of the enterprise and the electricity consumption data of the electrical equipment are cleaned to obtain the emission of each pollutant and the total pollution generation and treatment fee rate, and the specific steps of forming the data set according to the time series are as follows: The average emissions of the pollutant outlets corresponding to the same pollutant of the same enterprise on the same day are summed to obtain the daily emissions of the same pollutant of the enterprise. The daily emissions of the same pollutant within the preset period are summarized in time series to obtain the pollutant emissions. Similarly, the emissions of each pollutant are calculated; The rates of the electricity-consuming equipment used for pollution generation and pollution control of the same enterprise on the same day are summed up to obtain the total pollution generation and pollution control rate for a single day, and the total pollution generation and pollution control rates for a single day within a preset period are summarized in time series to obtain the total pollution generation and pollution control rate of the enterprise; According to the company name, the emission amount of each pollutant and the total pollution production and pollution control fee rate are used as column attributes to integrate the data, and the null values are removed to obtain the data set.
5. The method for identifying abnormalities in pollutant time series data based on sliding windows according to claim 4 is characterized in that: The pollutants include sulfur dioxide, nitrogen oxides, and non-methane hydrocarbons.
6. The method for identifying abnormalities in pollutant time series data based on sliding windows according to claim 2, characterized in that: In step S2, before using the unsupervised learning method based on sliding windows to perform anomaly detection on the data set, a separate / comprehensive time series visualization analysis is performed on the data set to preliminarily identify and mark abnormal data.
7. A pollutant time series data anomaly identification system based on a sliding window, which uses the pollutant time series data anomaly identification method based on a sliding window as described in any one of claims 1 to 6, characterized in that: It includes: The data collection and cleaning module is used to obtain the emission data of the enterprise's pollutant outlets and the electricity consumption data of the electrical equipment. After data cleaning, the emission of each pollutant and the total pollution generation and treatment fee rate are obtained, and the data set is formed according to the time series; A first anomaly detection module is used to perform anomaly detection on a data set using an unsupervised learning method based on a sliding window, thereby obtaining data anomalies; A second anomaly detection module is used to perform anomaly detection on the data set using a machine learning model to obtain data anomalies; The abnormal warning module is used to check the data abnormalities of the first abnormal detection module and the second abnormal detection module, clarify the abnormal data, verify the abnormal cause and issue an abnormal warning.
Citation Information
Cited By
Generation method of pollution source water quality fingerprint database, fingerprint database and application thereof
CN119339842A
