A Prediction Method, Device, Equipment and Medium for Sequential Data of Sewage Treatment Process
The time sequence data of the sewage treatment process is reconstructed through adaptive sliding window division and representation learning technology, and combined with self-supervised comparison reconstruction network and embedded learning network, the problem of insufficient prediction accuracy of timing data in the existing technology is solved, and the accuracy and robustness of the prediction model are improved.
Patent Information
- Application Number
- CN202510199938.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2045-02-24
AI Technical Summary
The prior art is difficult to achieve sufficiently high accuracy when processing time sequence data of sewage treatment processes, especially when processing data with long sequences, high dimensions and complex dynamic characteristics, the prediction accuracy will be greatly reduced.
Data partitioning is performed through an adaptive sliding window, and patch reconstruction is carried out in combination with representation learning technology. The reconstructed patch blocks are randomly masked by self-supervised comparison reconstruction network, and the reconstructed patch blocks are mapped into feature vectors by embedding the learning network, and the prediction output layer is input to obtain predicted timing data.
It improves the capture ability of time-mode features of time-sequential variables and the recognition accuracy of the connections between variables, and improves the accuracy, robustness and generalization capabilities of the prediction model.
Smart Images

Figure CN119720043B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of time series prediction, and particularly relates to a method, device, equipment and medium for predicting time series data of a sewage treatment process. Background Art
[0002] In recent years, with the rapid development of deep learning technology, remarkable achievements have been made in time series prediction in multiple fields. However, in the field of time series prediction for sewage treatment processes, there are still many challenges. Traditional time series prediction methods often struggle to achieve a high enough accuracy when dealing with long sequences, high dimensions, and sewage data with complex dynamic characteristics, making it difficult to meet the requirements of actual production. Facing such complex time series data, front-line sewage treatment workers usually need to rely on their excellent perception and analysis capabilities, combined with rich work experience, to extract valuable information from it.
[0003] With the rapid development of artificial intelligence technology, especially the wide application of deep learning technology, some researchers have begun to try using deep learning models, such as recurrent neural networks (RNN) and their variants long short-term memory networks (LSTM) and gated recurrent units (GRU), to process time series data and capture its potential features. These models can capture the time-dependent relationships in the data through a recurrent connection structure and improve the prediction accuracy to a certain extent. However, existing deep learning models still face some challenges when dealing with time series data of sewage treatment processes. First, the data in the sewage treatment process often contains missing values and outliers, and these incomplete data will directly affect the training effect and prediction accuracy of the model. Second, the sewage treatment process involves multiple variables, and there are complex interactions between these variables, while existing models still have deficiencies in capturing the abstract representations of these multivariate variables. In addition, as the length of the input sequence increases, the computational complexity and memory consumption of the model will also increase significantly, thus affecting the prediction efficiency. Therefore, the time series prediction methods in the prior art will have a significant drop in prediction accuracy when dealing with time series data such as sewage treatment processes with complex spatial structures and long sequence characteristics. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, device, equipment and medium for predicting time series data of a sewage treatment process. By performing data partitioning through an adaptive sliding window and combining representation learning technology for patch reconstruction, the technical problem of insufficient accuracy faced by the prior art in predicting complex time series data in the sewage field is solved.
[0005] To solve the above technical problems, the present invention is realized through the following technical solutions:
[0006] The present invention provides a method for predicting time series data of a sewage treatment process, which includes:
[0007] Obtain historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters;
[0008] Preprocess the historical data to obtain preprocessed data;
[0009] Perform adaptive sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain multiple temporal patch blocks;
[0010] Randomly mask some of the temporal patch blocks through a self-supervised contrastive reconstruction network and reconstruct the masked temporal patch blocks to obtain multiple corresponding reconstructed temporal patch blocks;
[0011] Map multiple reconstructed temporal patch blocks into feature vectors through an embedding learning network and input the feature vectors into a prediction output layer to obtain predicted temporal data of the sewage treatment process.
[0012] In an embodiment of the present invention, the preprocessing of the historical data to obtain preprocessed data includes:
[0013] Perform normalization processing on the historical data and implement anomaly detection, where the anomaly detection includes outlier detection and blank value detection;
[0014] Eliminate the detected outliers and interpolate the missing data points using a PatchTST model to obtain the preprocessed data.
[0015] In an embodiment of the present invention, the performing adaptive sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain multiple temporal patch blocks includes:
[0016] Calculate the standard deviation of the data within the current window according to a preset initial window length, and dynamically adjust the window length according to the standard deviation of the data within the current window;
[0017] Calculate the similarity between adjacent windows according to a preset initial step size, and dynamically adjust the step size according to the similarity between the adjacent windows;
[0018] Partition the preprocessed data according to the dynamically adjusted window length and step size to obtain multiple temporal patch blocks.
[0019] In an embodiment of the present invention, the calculating the standard deviation of the data within the current window according to a preset initial window length, and dynamically adjusting the window length according to the standard deviation of the data within the current window includes:
[0020] After calculating the standard deviation of the data within the current window, if the standard deviation of the data within the current window is large, then reduce the window length;
[0021] After calculating the standard deviation of the data within the current window, if the standard deviation of the data within the current window is small, then increase the window length.
[0022] In one embodiment of the present invention, the calculating the similarity between adjacent windows according to a preset initial step size and dynamically adjusting the step size according to the similarity between the adjacent windows includes:
[0023] After calculating the similarity between the adjacent windows, if the similarity between the adjacent windows is high, then reduce the step size;
[0024] After calculating the similarity between the adjacent windows, if the similarity between the adjacent windows is low, then increase the step size.
[0025] In one embodiment of the present invention, the randomly masking some of the temporal patch blocks by a self-supervised contrastive reconstruction network and reconstructing the masked temporal patch blocks to obtain a plurality of corresponding reconstructed temporal patch blocks includes:
[0026] The self-supervised contrastive reconstruction network includes an encoder, a mask generator, a contrastive learning module, and a decoder;
[0027] Encoding a plurality of the temporal patch blocks into low-dimensional representations by using the encoder;
[0028] Generating a mask by using the mask generator in a way of randomly setting zeros to indicate masking the corresponding temporal patch blocks;
[0029] Maximizing the similarity between the low-dimensional representations of the unmasked temporal patch blocks and the low-dimensional representations obtained after reconstruction of the masked temporal patch blocks by using the contrastive learning module;
[0030] Reconstructing the masked temporal patch blocks by using the decoder to obtain a plurality of corresponding reconstructed temporal patch blocks.
[0031] In one embodiment of the present invention, the mapping a plurality of the reconstructed temporal patch blocks into feature vectors by an embedding learning network and inputting the feature vectors into a prediction output layer to obtain predicted temporal data of a sewage treatment process includes:
[0032] Input multiple of the reconstructed temporal patch blocks into an embedding learning network. The embedding learning network uses the contrastive learning loss function defined in the contrastive learning module to measure the effects of the multiple reconstructed temporal patch blocks, and maps the multiple reconstructed temporal patch blocks into feature vectors;
[0033] Input the feature vectors into a prediction output layer to obtain the predicted temporal data of the sewage treatment process.
[0034] Based on the same inventive concept, another embodiment of the present invention further provides a device for predicting temporal data of a sewage treatment process. The device includes:
[0035] A data acquisition module, configured to acquire historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters;
[0036] A data preprocessing module, configured to preprocess the historical data to obtain preprocessed data;
[0037] A data partitioning module, configured to adaptively perform sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain multiple temporal patch blocks;
[0038] A data reconstruction module, configured to randomly mask some of the temporal patch blocks through a self-supervised contrastive reconstruction network and reconstruct the masked temporal patch blocks to obtain multiple corresponding reconstructed temporal patch blocks;
[0039] A data output module, configured to map the multiple reconstructed temporal patch blocks into feature vectors through an embedding learning network, and input the feature vectors into a prediction output layer to obtain the predicted temporal data of the sewage treatment process.
[0040] Based on the same inventive concept, another embodiment of the present invention further provides an electronic device. The electronic device includes:
[0041] One or more processors;
[0042] A storage device, configured to store one or more programs. When the one or more programs are executed by the one or more processors, the electronic device implements the method for predicting temporal data of a sewage treatment process as described in any of the above embodiments.
[0043] Based on the same inventive concept, another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer is caused to execute the method for predicting temporal data of a sewage treatment process as described in any of the above embodiments.
[0044] As described above, a method for predicting time - series data of a sewage treatment process provided by the present invention obtains historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters, pre - processes the historical data to obtain pre - processed data, adaptively divides the pre - processed data into sliding window patches through a data partitioning network to obtain multiple time - series patches, randomly masks some of the time - series patches through a self - supervised contrastive reconstruction network, and reconstructs the masked time - series patches to obtain multiple corresponding reconstructed time - series patches, maps the multiple reconstructed time - series patches into feature vectors through an embedding learning network, and inputs the feature vectors into a prediction output layer to obtain the predicted time - series data of the sewage treatment process. Through the adaptive window partitioning technology, the method can dynamically adjust the length and step size of the window, thereby optimizing the partitioning of time - series patches, improving the ability to capture time - mode features of time - series variables, and the recognition accuracy of the relationships between variables. In addition, by randomly masking the divided time - series patches, the aim is to maximize the information difference between the masked and un - masked time - series patches, efficiently capture the internal relationships of adjacent time series, and improve the accuracy, robustness, and generalization ability of the prediction model. Of course, it is not necessary for any product implementing the present invention to achieve all the above - mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts based on these drawings.
[0046] Figure 1 It is a flowchart of a method for predicting time - series data of a sewage treatment process provided by an exemplary embodiment of the present application.
[0047] Figure 2 It is an overall block diagram of a method for predicting time - series data of a sewage treatment process provided by an exemplary embodiment of the present application.
[0048] Figure 3 It is a structural diagram of a device for predicting time - series data of a sewage treatment process provided by another exemplary embodiment of the present application.
[0049] Figure 4 It is a structural diagram of an electronic device provided by another exemplary embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0050] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand the other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0051] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner. Therefore, only the components related to the present invention are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and proportion of each component in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0052] In the following description, a large number of details are explored to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0053] To solve the problem of insufficient accuracy faced by the prior art in predicting complex time-series data in the field of sewage, the present invention provides a method for predicting time-series data of a sewage treatment process, and the following will discuss these embodiments in detail.
[0054] Please refer to Figure 1 as shown, the method for predicting time-series data of the sewage treatment process includes the following steps:
[0055] S100: Obtain historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters;
[0056] S200: Preprocess the historical data to obtain preprocessed data;
[0057] S300: Perform adaptive sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain multiple time-series patch blocks;
[0058] S400: Randomly mask some of the time-series patch blocks through a self-supervised contrastive reconstruction network and reconstruct the masked time-series patch blocks to obtain multiple corresponding reconstructed time-series patch blocks;
[0059] S500: Mapping the plurality of reconstructed time series patch blocks into feature vectors through an embedded learning network, and inputting the feature vectors into a prediction output layer to obtain predicted time series data of a sewage treatment process.
[0060] First, step S100 is executed to obtain historical data of the sewage treatment process, wherein the historical data includes influent water quality parameters, treatment process parameters and effluent water quality parameters.
[0061] Specifically, in this embodiment, the influent water quality parameters include monitoring time, influent flow, chemical oxygen demand (COD) and ammonia nitrogen (NH3-N). Of course, according to different application scenarios and actual needs, in other embodiments, the influent water quality parameters may also include biochemical oxygen demand (BOD), total nitrogen (TN), total phosphorus (TP), suspended solids (SS), pH value and heavy metal concentration. In this embodiment, the treatment process parameters include dissolved oxygen (DO), suspended solids (SS), sludge pump room return flow, improved influent nitrate nitrogen concentration, improved effluent nitrate nitrogen concentration, aeration time and aerator current. Of course, according to different application scenarios and actual needs, in other embodiments, the treatment process parameters may also include aeration volume, sludge settling ratio and sludge age. In this embodiment, the effluent water quality parameters include effluent flow rate, pH value, chemical oxygen demand (COD), ammonia nitrogen (NH3-N), total nitrogen (TN), and total phosphorus (TP). Of course, according to different application scenarios and actual needs, in other embodiments, the effluent water quality parameters may also include biochemical oxygen demand (BOD), suspended solids (SS), and heavy metal concentration.
[0062] Next, step S200 is executed, that is, preprocessing the historical data to obtain preprocessed data.
[0063] In an exemplary embodiment of the present application, in step S200, the preprocessing of the historical data to obtain preprocessed data further includes the following steps:
[0064] S210: normalizing the historical data and performing anomaly detection, wherein the anomaly detection includes outlier detection and blank value detection;
[0065] S220: Eliminate the detected outliers and interpolate the missing data points using the PatchTST model to obtain the preprocessed data.
[0066] For details, please refer to Figure 1 and Figure 2As shown, the historical data is normalized. It should be noted that the normalization methods include but are not limited to Min-Max normalization and Z-score normalization. In this embodiment, the Min-Max normalization method is adopted. It should be noted that the purpose of the normalization process is to scale the historical data to a specific range or make it have the same statistical characteristics for subsequent data analysis and model training. After the normalization process, anomaly detection is performed on the data. The anomaly detection mainly includes outlier detection and blank value detection. The detected outliers are removed, and the PatchTST model is used to interpolate the missing data points to obtain the preprocessed data.
[0067] Immediately afterwards, step S300 is executed, that is, the preprocessed data is adaptively divided into sliding window patches through a data division network to obtain multiple temporal patches.
[0068] In an exemplary embodiment of the present application, in step S300, the step of adaptively dividing the preprocessed data into sliding window patches through a data division network to obtain multiple temporal patches further includes the following steps:
[0069] S310: Calculate the standard deviation of the data within the current window according to a preset initial window length, and dynamically adjust the window length according to the standard deviation of the data within the current window;
[0070] S320: Calculate the similarity between adjacent windows according to a preset initial step size, and dynamically adjust the step size according to the similarity between the adjacent windows;
[0071] S330: Divide the preprocessed data according to the dynamically adjusted window length and step size to obtain multiple temporal patches.
[0072] It should be noted that after calculating the standard deviation of the data within the current window, if the standard deviation of the data within the current window is large, the window length is reduced; if the standard deviation of the data within the current window is small, the window length is increased. After calculating the similarity between the adjacent windows, if the similarity between the adjacent windows is high, the step size is reduced; if the similarity between the adjacent windows is low, the step size is increased.
[0073] Specifically, please refer to Figure 1 and Figure 2As shown, the preprocessed data is input into a pre-trained data partitioning network, and the data partitioning network performs regularization processing on the preprocessed data. The regularization processing aims to reduce the risk of overfitting of the model by adjusting the distribution or characteristics of the data. The regularized data is adaptively partitioned into sliding windows and patches. The standard deviation of the data in the current window is calculated based on the preset initial window length, and the window length is dynamically adjusted based on the standard deviation of the data in the current window. It is worth noting that the larger the standard deviation, the more drastic the data changes, and thus a shorter window is required to capture the details. The step size adjustment coefficient k is determined based on historical experience, and the adjacent windows are calculated based on the preset initial step size. and The similarity between the two windows is determined, and the step size is dynamically adjusted according to the similarity between the adjacent windows. It is worth noting that if the similarity between the adjacent windows is high, the step size is reduced to retain more details. If the similarity between the adjacent windows is low, the step size is increased to reduce redundancy. More specifically, the standard deviation moving average of the first N windows of historical data is obtained as the standard deviation reference value σ_base, where the value of N can be customized according to actual needs. If the standard deviation σ_current of the data in the current window is greater than 1.5σ_base, it is determined that the standard deviation is large and the window length is reduced. If the standard deviation σ_current of the data in the current window is less than 0.5σ_base, it is determined that the standard deviation is small and the window length is increased. If the standard deviation σ_current of the data in the current window is between 0.5σ_base and 1.5σ_base, the current window length is kept unchanged. In addition, it should be noted that the preset initial window length and the preset initial step size are set based on historical experience. In this embodiment, if the similarity between adjacent windows is greater than 0.85, it is determined that the similarity is high and the step size is reduced. If the similarity between adjacent windows is less than 0.35, it is determined that the similarity is low and the step size is increased. If the similarity between adjacent windows is between 0.35 and 0.85, the current step size is kept unchanged. Let the initial step size be S_base and the new step size be S_new.
[0074] The similarity function based on the Pearson correlation coefficient is as follows:
[0075]
[0076] The intelligent step size update function based on the similarity of adjacent windows is as follows:
[0077]
[0078] It should be noted that the window length refers to the number of data points or the time span included in each window. In a time-based window, the window length may be measured in time units such as seconds, minutes, hours, etc. The step size determines the degree of overlap between adjacent windows. The smaller the step size, the more overlap there is between windows; the larger the step size, the less overlap there is between windows. When the step size is equal to the window length, there is no overlap between adjacent windows. When the step size is less than the window length, there is overlap between adjacent windows. When the step size is greater than the window length, there are gaps between adjacent windows, that is, some data points may not be included in any window. Specifically, if the standard deviation of the data within the current window is large, it indicates that the data within this time window fluctuates significantly, and there may be noise or outliers. This kind of fluctuation may reveal certain patterns in the time series, such as periodic changes, trend changes, or random fluctuations. In order to weaken the influence of these factors, the window length is appropriately shortened so that the window focuses more on the local characteristics of the data, thereby improving the accuracy of the analysis. If the standard deviation of the data within the current window is small, it indicates that the data within this time window is relatively stable and has a high information density. This kind of stability may also reflect a certain pattern in the time series, such as a stationary process or a stable stage in a trend change. In order to capture and utilize more information, the window length is appropriately increased so as to analyze the characteristics of the data within a wider time range. If the similarity between adjacent windows is high, it means that the data within these two time windows has similar change trends or patterns. This similarity may stem from periodic changes, trend changes in the time series, or common influencing factors. In order to reduce redundant information and improve the analysis efficiency, the step size is appropriately reduced so that the windows cover the data more densely, thereby capturing the changes in the data more carefully. If the similarity between adjacent windows is low, it indicates that the data within these two time windows is quite different and may have different change trends or patterns. This kind of difference may reflect mutations, turns in the time series, or the effects of different influencing factors. In order to capture these important changes, the step size is appropriately increased so that the windows can span these different change regions, thereby analyzing the dynamic characteristics of the time series more comprehensively.
[0079] Next, step S400 is executed, that is, a part of the temporal patch blocks are randomly masked through a self-supervised contrastive reconstruction network, and the masked temporal patch blocks are reconstructed to obtain a plurality of corresponding reconstructed temporal patch blocks.
[0080] In an exemplary embodiment of the present application, the self-supervised contrastive reconstruction network includes an encoder, a mask generator, a contrastive learning module, and a decoder. In step S400, the process of randomly masking a part of the temporal patch blocks through the self-supervised contrastive reconstruction network and reconstructing the masked temporal patch blocks to obtain a plurality of corresponding reconstructed temporal patch blocks further includes the following steps:
[0081] S410: Encode multiple of the temporal patch blocks into a low-dimensional representation using the encoder;
[0082] S420: Generate a mask by randomly setting values to zero using the mask generator to indicate masking of the corresponding temporal patch blocks;
[0083] S430: Maximize the similarity between the low-dimensional representation of the unmasked temporal patch blocks and the low-dimensional representation obtained after reconstruction of the masked temporal patch blocks using the contrastive learning module;
[0084] S440: Reconstruct the masked temporal patch blocks using the decoder to obtain multiple corresponding reconstructed temporal patch blocks.
[0085] Specifically, please refer to Figure 1 and Figure 2 As shown, input the divided temporal patch blocks into the encoder, and use the encoder to encode multiple of the temporal patch blocks into a low-dimensional representation to extract the time patterns and feature information of the original temporal data. Generate a mask by randomly setting values to zero using the mask generator to indicate which temporal patch blocks need to be masked. Maximize the similarity between the low-dimensional representation of the unmasked temporal patch blocks and the low-dimensional representation obtained after reconstruction of the masked temporal patch blocks using the contrastive learning module to enhance the ability of representation learning. Reconstruct the masked temporal patch blocks using the decoder to obtain multiple corresponding reconstructed temporal patch blocks.
[0086] It should be noted that the contrastive learning module also defines a contrastive learning loss function , which is used to enhance the robustness and generalization ability of representation learning:
[0087]
[0088] In the formula, is the low-dimensional representation of the unmasked temporal patch blocks; is the low-dimensional representation obtained after reconstruction of the masked temporal patch blocks; is the temperature parameter that controls the smoothness of the similarity distribution; is the total number of samples.
[0089] Finally, execute step S500, that is, map multiple of the reconstructed temporal patch blocks into feature vectors through the embedding learning network, and input the feature vectors into the prediction output layer to obtain the predicted temporal data of the sewage treatment process.
[0090] In an exemplary embodiment of the present application, in step S500, the process of mapping multiple reconstructed temporal patch blocks into feature vectors through an embedding learning network and inputting the feature vectors into a prediction output layer to obtain predicted temporal data of the sewage treatment process includes:
[0091] Input multiple reconstructed temporal patch blocks into the embedding learning network. The embedding learning network uses the contrastive learning loss function defined in the contrastive learning module to measure the effects of multiple reconstructed temporal patch blocks, maps multiple reconstructed temporal patch blocks into feature vectors, and then inputs the feature vectors into the prediction output layer to obtain the predicted temporal data of the sewage treatment process.
[0092] Specifically, please refer to Figure 1 and Figure 2 As shown, the reconstructed temporal patch blocks are sent into the embedding learning network together to efficiently capture the information of adjacent time series. It should be noted that the embedding learning network is a neural network constructed based on a multi-layer perceptron (MLP). This neural network consists of multiple fully connected layers, and the layers are connected by non-linear activation functions. The embedding learning network uses the contrastive learning loss function defined in the contrastive learning module to measure the effects of multiple reconstructed temporal patch blocks, maps the reconstructed temporal patch blocks into feature vector tokens, and then inputs the feature vector tokens into the prediction output layer to obtain the predicted temporal data of the sewage treatment process. It should be noted that the prediction output layer consists of an encoder layer and a linear layer, which are used to predict new feature vectors and decode and output prediction values. The prediction values are the predicted temporal data of the sewage treatment process.
[0093] In summary, a method for predicting time series data of a sewage treatment process provided by the present invention obtains historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters, preprocesses the historical data to obtain preprocessed data, adaptively slides a window patch on the preprocessed data through a data partitioning network to obtain multiple time series patch blocks, randomly masks some of the time series patch blocks through a self-supervised contrast reconstruction network, and reconstructs the masked time series patch blocks to obtain multiple corresponding reconstructed time series patch blocks, maps the multiple reconstructed time series patch blocks into feature vectors through an embedding learning network, and inputs the feature vectors into a prediction output layer to obtain predicted time series data of the sewage treatment process. Through the adaptive window partitioning technology, the method can dynamically adjust the length and step size of the window, thereby optimizing the partitioning of time series patch blocks, improving the ability to capture time pattern features of time series variables, and the recognition accuracy of the relationship between variables. In addition, by randomly masking the obtained time series patch blocks, the aim is to maximize the information difference between the masked and unmasked time series patch blocks, efficiently capture the internal relationship of adjacent time series, and improve the accuracy, robustness, and generalization ability of the prediction model.
[0094] Based on the same inventive concept, please refer to Figure 3 as shown, another embodiment of the present invention further provides a device 11 for predicting time series data of a sewage treatment process, and the device includes:
[0095] A data acquisition module 111, configured to acquire historical data of the sewage treatment process, where the historical data includes influent water quality parameters, treatment process parameters, and effluent water quality parameters;
[0096] A data preprocessing module 112, configured to preprocess the historical data to obtain preprocessed data;
[0097] A data partitioning module 113, configured to adaptively slide a window patch on the preprocessed data through a data partitioning network to obtain multiple time series patch blocks;
[0098] A data reconstruction module 114, configured to randomly mask some of the time series patch blocks through a self-supervised contrast reconstruction network, and reconstruct the masked time series patch blocks to obtain multiple corresponding reconstructed time series patch blocks;
[0099] A data output module 115, configured to map the multiple reconstructed time series patch blocks into feature vectors through an embedding learning network, and input the feature vectors into a prediction output layer to obtain predicted time series data of the sewage treatment process.
[0100] Based on the same inventive concept, please refer to Figure 4 As shown, another embodiment of the present invention further provides an electronic device 1, which may include a memory 12, a processor 13, and a bus. It may also include a computer program stored in the memory 12 and executable on the processor 13, such as a sewage treatment process time series data prediction program.
[0101] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disc, etc. The memory 12 may be an internal storage unit of the electronic device 1 in some embodiments, such as the mobile hard disk of the electronic device 1. The memory 12 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 1. Further, the memory 12 may include both the internal storage unit and the external storage device of the electronic device 1. The memory 12 can be used not only to store application software installed on the electronic device 1 and various types of data, such as the code for sewage treatment process time series data prediction, etc., but also to temporarily store data that has been output or will be output.
[0102] The processor 13 may be composed of integrated circuits in some embodiments. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more Central Processing Units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips, etc. The processor 13 is the control core (Control Unit) of the electronic device 1, connecting various components of the entire electronic device 1 through various interfaces and lines. By running or executing programs or modules stored in the memory 12 (such as the sewage treatment process time series data prediction program, etc.), and by calling data stored in the memory 12, it executes various functions of the electronic device 1 and processes data.
[0103] The processor 13 executes the operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the above-mentioned sewage treatment process time series data prediction method.
[0104] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a data acquisition module 111, a data preprocessing module 112, a data partitioning module 113, a data reconstruction module 114, and a data output module 115.
[0105] The above-mentioned integrated units implemented in the form of software function modules may be stored in a computer-readable storage medium, and the computer-readable storage medium may be non-volatile or volatile. The above-mentioned software function modules are stored in a storage medium and include several instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor to execute some functions of the sewage treatment process time series data prediction method described in various embodiments of the present application.
[0106] The above embodiments are only illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical idea disclosed by the present invention should still be covered by the claims of the present invention.
Claims
1. A method for predicting time series data of a sewage treatment process, characterized in that: include: Obtaining historical data of the sewage treatment process, the historical data including influent water quality parameters, treatment process parameters and effluent water quality parameters; Preprocessing the historical data to obtain preprocessed data; Performing adaptive sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain a plurality of time series patch blocks; Randomly masking part of the time series patch blocks through a self-supervised contrast reconstruction network, and reconstructing the masked time series patch blocks to obtain a plurality of corresponding reconstructed time series patch blocks; Mapping the plurality of reconstructed time series patch blocks into feature vectors through an embedded learning network, and inputting the feature vectors into a prediction output layer to obtain predicted time series data of the sewage treatment process; The step of performing adaptive sliding window patch partitioning on the preprocessed data through a data partitioning network to obtain a plurality of time series patch blocks includes: Calculating the standard deviation of the data in the current window according to a preset initial window length, and dynamically adjusting the window length according to the standard deviation of the data in the current window; Calculating the similarity between adjacent windows according to a preset initial step size, and dynamically adjusting the step size according to the similarity between the adjacent windows; The preprocessed data is divided according to the dynamically adjusted window length and the step size to obtain a plurality of the time series patch blocks.
2. The method for predicting time series data of sewage treatment process according to claim 1, characterized in that: The preprocessing of the historical data to obtain preprocessed data includes: Normalizing the historical data and performing anomaly detection, wherein the anomaly detection includes outlier detection and blank value detection; The detected outliers are eliminated, and the missing data points are interpolated using the PatchTST model to obtain the preprocessed data.
3. The method for predicting time series data of sewage treatment process according to claim 1, characterized in that: The step of calculating the standard deviation of the data in the current window according to the preset initial window length, and dynamically adjusting the window length according to the standard deviation of the data in the current window, comprises: After calculating the standard deviation of the data in the current window, if the standard deviation of the data in the current window is large, reducing the window length; After calculating the standard deviation of the data in the current window, if the standard deviation of the data in the current window is small, the window length is increased.
4. The method for predicting time series data of sewage treatment process according to claim 1, characterized in that: The calculating the similarity between adjacent windows according to a preset initial step size, and dynamically adjusting the step size according to the similarity between the adjacent windows, comprises: After calculating the similarity between the adjacent windows, if the similarity between the adjacent windows is high, reducing the step size; After calculating the similarity between the adjacent windows, if the similarity between the adjacent windows is low, the step size is increased.
5. The method for predicting time series data of sewage treatment process according to claim 1, characterized in that: The method of randomly masking part of the time series patch blocks through the self-supervised contrast reconstruction network and reconstructing the masked time series patch blocks to obtain a plurality of corresponding reconstructed time series patch blocks includes: The self-supervised contrastive reconstruction network includes an encoder, a mask generator, a contrastive learning module and a decoder; Encoding the plurality of temporal patch blocks into a low-dimensional representation using the encoder; Using the mask generator to generate a mask by randomly setting zeros to indicate masking the corresponding timing patch block; Using the contrastive learning module to maximize the similarity between the low-dimensional representation of the unmasked temporal patch block and the low-dimensional representation of the masked temporal patch block after reconstruction; The decoder is used to reconstruct the masked timing patch blocks to obtain a plurality of corresponding reconstructed timing patch blocks.
6. The method for predicting time series data of sewage treatment process according to claim 5, characterized in that: The method maps the plurality of reconstructed time series patch blocks into feature vectors through an embedded learning network, and inputs the feature vectors into a prediction output layer to obtain predicted time series data of a sewage treatment process, including: Inputting the plurality of reconstructed time series patch blocks into an embedding learning network, wherein the embedding learning network uses a contrastive learning loss function defined in the contrastive learning module to measure the effects of the plurality of reconstructed time series patch blocks, and maps the plurality of reconstructed time series patch blocks into feature vectors; The feature vector is input into the prediction output layer to obtain the predicted time series data of the sewage treatment process.
7. A sewage treatment process time series data prediction device, characterized in that: The device comprises: A data acquisition module is used to acquire historical data of the sewage treatment process, wherein the historical data includes influent water quality parameters, treatment process parameters and effluent water quality parameters; A data preprocessing module, used for preprocessing the historical data to obtain preprocessed data; A data partitioning module, used for performing adaptive sliding window patch partitioning on the pre-processed data through a data partitioning network to obtain a plurality of time series patch blocks, including calculating the standard deviation of the data in the current window according to a preset initial window length, and dynamically adjusting the window length according to the standard deviation of the data in the current window, calculating the similarity between adjacent windows according to a preset initial step length, and dynamically adjusting the step length according to the similarity between the adjacent windows, and partitioning the pre-processed data according to the dynamically adjusted window length and step length to obtain a plurality of the time series patch blocks; A data reconstruction module, used to randomly mask part of the time series patch blocks through a self-supervised contrast reconstruction network, and reconstruct the masked time series patch blocks to obtain a plurality of corresponding reconstructed time series patch blocks; The data output module is used to map the multiple reconstructed time series patch blocks into feature vectors through an embedded learning network, and input the feature vectors into a prediction output layer to obtain predicted time series data of the sewage treatment process.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the sewage treatment process time series data prediction method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method for predicting time series data of a sewage treatment process as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Power grid time sequence data decoupling self-supervision pre-training method and system
CN116776228A
Sewage treatment fault diagnosis method based on stacking meta learning strategy
CN118133206A