CN117273203A - Water quality prediction method and system based on GAT-transducer time sequence model - Google Patents
Water quality prediction method and system based on GAT-transducer time sequence model Download PDFInfo
- Publication number
- CN117273203A CN117273203A CN202311140729.4A CN202311140729A CN117273203A CN 117273203 A CN117273203 A CN 117273203A CN 202311140729 A CN202311140729 A CN 202311140729A CN 117273203 A CN117273203 A CN 117273203A
- Authority
- CN
- China
- Prior art keywords
- water quality
- water
- data
- quality prediction
- gat
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 title claims abstract description 212
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000012544 monitoring process Methods 0.000 claims abstract description 44
- 238000001514 detection method Methods 0.000 claims abstract description 16
- 239000011159 matrix material Substances 0.000 claims description 47
- IJGRMHOSHXDMSA-UHFFFAOYSA-N Atomic nitrogen Chemical compound N#N IJGRMHOSHXDMSA-UHFFFAOYSA-N 0.000 claims description 23
- 238000004364 calculation method Methods 0.000 claims description 22
- 230000008859 change Effects 0.000 claims description 16
- OAICVXFJPJFONN-UHFFFAOYSA-N Phosphorus Chemical compound [P] OAICVXFJPJFONN-UHFFFAOYSA-N 0.000 claims description 12
- QVGXLLKOCUKJST-UHFFFAOYSA-N atomic oxygen Chemical compound [O] QVGXLLKOCUKJST-UHFFFAOYSA-N 0.000 claims description 12
- 239000001301 oxygen Substances 0.000 claims description 12
- 229910052760 oxygen Inorganic materials 0.000 claims description 12
- 229910052698 phosphorus Inorganic materials 0.000 claims description 12
- 239000011574 phosphorus Substances 0.000 claims description 12
- 238000013527 convolutional neural network Methods 0.000 claims description 11
- 229910052757 nitrogen Inorganic materials 0.000 claims description 11
- 239000003643 water by type Substances 0.000 claims description 11
- 230000005540 biological transmission Effects 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 9
- 230000005856 abnormality Effects 0.000 claims description 8
- 239000010865 sewage Substances 0.000 claims description 8
- 230000006855 networking Effects 0.000 claims description 7
- XKMRRTOUMJRJIA-UHFFFAOYSA-N ammonia nh3 Chemical compound N.N XKMRRTOUMJRJIA-UHFFFAOYSA-N 0.000 claims description 6
- 238000010606 normalization Methods 0.000 claims description 6
- 238000012549 training Methods 0.000 claims description 6
- 238000007781 pre-processing Methods 0.000 claims description 5
- 238000011144 upstream manufacturing Methods 0.000 claims description 4
- 230000002159 abnormal effect Effects 0.000 claims description 3
- 238000003064 k means clustering Methods 0.000 claims description 2
- 230000001419 dependent effect Effects 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 10
- 238000013528 artificial neural network Methods 0.000 description 5
- 239000008358 core component Substances 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 230000004913 activation Effects 0.000 description 2
- 238000007405 data analysis Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 238000002474 experimental method Methods 0.000 description 2
- 238000011998 interferon-gamma release assay Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 101100498818 Arabidopsis thaliana DDR4 gene Proteins 0.000 description 1
- 241000196324 Embryophyta Species 0.000 description 1
- 241000512668 Eunectes Species 0.000 description 1
- 208000025174 PANDAS Diseases 0.000 description 1
- 208000021155 Paediatric autoimmune neuropsychiatric disorders associated with streptococcal infection Diseases 0.000 description 1
- 240000000220 Panda oleosa Species 0.000 description 1
- 235000016496 Panda oleosa Nutrition 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 239000013043 chemical agent Substances 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000008213 purified water Substances 0.000 description 1
- 238000011897 real-time detection Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012731 temporal analysis Methods 0.000 description 1
- 238000000700 time series analysis Methods 0.000 description 1
- 238000003911 water pollution Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/047—Probabilistic or stochastic networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0475—Generative networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0499—Feedforward networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0639—Performance analysis of employees; Performance analysis of enterprise or organisation operations
- G06Q10/06395—Quality analysis or management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/06—Energy or water supply
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Human Resources & Organizations (AREA)
- Computing Systems (AREA)
- Biophysics (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- General Engineering & Computer Science (AREA)
- Molecular Biology (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Economics (AREA)
- Strategic Management (AREA)
- Marketing (AREA)
- Development Economics (AREA)
- Tourism & Hospitality (AREA)
- Entrepreneurship & Innovation (AREA)
- General Business, Economics & Management (AREA)
- Game Theory and Decision Science (AREA)
- Educational Administration (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Public Health (AREA)
- Probability & Statistics with Applications (AREA)
- Water Supply & Treatment (AREA)
- Primary Health Care (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention provides a water quality prediction method based on a GAT-transducer time sequence model, which is characterized in that water quality monitoring data are respectively input into a graph attention layer (GrapH attention network, GAT) and a multi-head attention layer, multi-element correlation among multiple indexes of the water quality data is captured through the GAT layer, time sequence of the water quality data is captured through the multi-head attention layer, then output of the GAT layer and output of the multi-head attention layer are combined, and finally prediction output is carried out through a transducer, so that water quality prediction is realized. The invention can effectively predict the water quality through the time sequence data of water quality detection by solving the problems that the current water quality time sequence data is predicted to be dependent on long distance and the relationship among various indexes is not considered sufficiently based on the GAT-transducer model.
Description
Technical Field
The invention belongs to the technical field of water quality prediction, belongs to the technical field of time series data analysis and mining, and also belongs to the technical field of big data analysis and application, and particularly relates to a water quality prediction method and system based on a GAT-transducer time series model.
Background
The water pollution phenomenon is more serious, and the water quality prediction is particularly important for protecting the water quality. However, the water quality is affected by various water quality indexes, and the water quality monitoring data is time sequence data, and complex relations exist among various indexes, so that the existing method cannot fully capture the complex relations among various indexes in the water.
The water quality detection work is an important part of environmental treatment, and with the application of the sensor, the time efficiency of the water quality detection work is greatly improved compared with the traditional manual detection work, but how to transmit the obtained data through the sensor and effectively judge whether the water quality is normal or not, and certain difficulties such as low speed, low accuracy and the like still exist at the present stage. The sensor detects the generated time series data for continuously detecting the water quality environment to detect the abnormality. However, most of the existing anomaly detection methods are probability statistics-based methods, distance-based methods and linear model-based methods, which cannot process time-series data well and cannot consider correlation in time steps, and therefore are not suitable for anomaly detection of water quality data.
On the other hand, the current water quality prediction results are limited to self-study judgment of the management side, and cannot be issued to related persons through effective means. The traditional information release means needs a large amount of data transmission and has higher requirements on the performance of the network and the equipment. In practice, however, such data is not necessarily all that is required by the relevant person. Therefore, how to reasonably and quickly provide the water quality prediction result to related people is also a problem to be solved.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide a water quality prediction method and a water quality prediction system based on a GAT-transducer time sequence model, which mainly solve the problem of poor prediction accuracy caused by long-distance dependence of current water quality time sequence data prediction, insufficient consideration of various indexes and the like, and solve the problem of quick and effective transmission of a prediction result on the basis.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
a water quality prediction method based on a GAT-transducer time sequence model comprises the following steps:
step 1, acquiring water quality monitoring data, wherein the water quality monitoring data is a group of time series data;
step 2, preprocessing the water quality monitoring data, firstly performing anomaly detection, then performing interpolation operation, and finally performing normalization processing;
step 3, constructing a GAT-transducer-based water quality prediction model, wherein the water quality prediction model comprises an encoder and a decoder; the encoder comprises a convolutional neural network, and a parallel graph attention layer and a multi-head attention layer; the decoder comprises a convolutional neural network, a parallel graph attention layer and a mask multi-head attention layer; obtaining a decoding matrix using an output of the decoder; the decoding matrix is calculated by a multi-layer perceptron and a softMax function to obtain prediction data;
and step 4, training the water quality prediction model, and carrying out water quality prediction by using the trained water quality prediction model.
The encoder is based on a transducer, and is added with a drawing attention layer parallel to a multi-head attention layer of the encoder to construct a first time sequence and multi-element feature capturing module; the time sequence and multi-element feature capturing module firstly uses a CNN network to extract time sequence features and index multi-element related features in input data to obtain a feature matrix containing the time sequence features and the index multi-element related features, wherein the time sequence features refer to the law and trend of the change of water quality monitoring data along with time, and the index multi-element related features refer to the mutual influence and association degree between different water quality indexes; the characteristic matrix passes through a forward propagation network, and finally summation and regularization are carried out to obtain a coding matrix;
the decoder is based on a transducer, and is added with a drawing attention layer parallel to a mask multi-head attention layer to construct a time sequence and multi-element feature capturing module II; the second time sequence and multi-element feature capturing module adopts the same input data as the first time sequence and multi-element feature capturing module to extract time sequence features and index multi-element related features in the input data to obtain a mask feature matrix containing the time sequence features and the index multi-element related features; inputting the mask feature matrix and the coding matrix into a multi-head attention layer simultaneously to obtain a final feature matrix; and sequentially carrying out first summation and regularization, forward propagation and second summation and regularization on the final feature matrix to obtain a decoding matrix.
And step 3, firstly, enabling the decoding matrix to pass through a multi-layer perceptron layer, then, passing through a softMax layer, and finally, obtaining the output of the predicted data.
The invention also provides a water quality prediction system based on the GAT-transducer time sequence model, which comprises a distributed sensor, a network module, a calculation module and a display module;
the distributed sensor is distributed in a monitored water area and is used for collecting pH value, turbidity, dissolved oxygen, water temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen and total phosphorus;
the network module is used for realizing the transmission of the data acquired by the distributed sensor to the calculation module and the transmission of the output result of the calculation module to the display module;
the calculation module carries a water quality prediction model obtained through training, takes collected data of the distributed sensor as input, and obtains a water quality prediction result by using the water quality prediction model;
and the display module displays the water quality prediction result.
Compared with the prior art, the invention inputs water quality monitoring data into the graph attention layer (GrapH attention network, GAT) and the multi-head attention layer respectively, captures multi-element correlation among multiple indexes of the water quality data through the GAT layer, captures time sequence of the water quality data through the multi-head attention layer, combines output of the GAT layer and the multi-head attention layer, and finally predicts and outputs through a transducer, thereby realizing water quality prediction. According to the invention, the problem that the current water quality time sequence data is insufficient in dependence on long distance and consideration of various indexes is solved through the GAT-transducer model, so that the purpose of accurately predicting water quality is achieved, and the water quality can be effectively predicted through the time sequence data of water quality detection.
Meanwhile, a set of corresponding prediction system is built, and the system realizes monitoring prediction of the subareas by dividing the monitored water area and arranging the distributed sensors, and can perform trend research and judgment by combining the characteristics of the subareas. Furthermore, the display modules are expanded and authentication processing is added in the system, and different display modules can select the prediction results of different monitoring water areas, so that on one hand, the results are opened to related people and are not only used for the manager to study and judge, and on the other hand, the network and equipment loads during the result transmission are reduced.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
FIG. 2 is a graph showing the predicted result of Dissolved Oxygen (DO) in the embodiment of the present invention.
FIG. 3 is a graph showing the prediction result of total phosphorus (TN) in the example of the present invention.
FIG. 4 is a graph of total nitrogen (TP) predictions in an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
Aiming at the problems of long-distance dependence of current water quality time sequence data prediction and insufficient consideration of the relation among various indexes, the invention provides a water quality prediction method based on a GAT-transducer time sequence model for better predicting water quality. Firstly, introducing a Convolutional Neural Network (CNN) to extract advanced features of each water quality time series data input; then inputting the data output by CNN into GAT layer and multi-head self-attention layer, capturing complex relationship between each element in water by GAT; and finally, combining the output of the GAT layer and the multi-head self-attention layer, and carrying out prediction output through a transducer.
Specifically, as shown in fig. 1, the method of the present invention comprises the following steps:
and step 1, acquiring water quality monitoring data.
The water quality monitoring data is a group of time series data. In one embodiment, the real recorded data of a certain water area in the Mongolia of the Yi-Nernst is used as water quality monitoring data, the data is stored in an Excel table form and recorded once every four hours, and the acquisition indexes mainly comprise pH value, turbidity, dissolved oxygen, water temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen, total phosphorus and the like, and the dissolved oxygen, the total nitrogen and the total phosphorus are predicted. That is, in the present invention, dissolved oxygen, total nitrogen, and total phosphorus are used as main indicators for prediction.
And 2, preprocessing the water quality monitoring data.
The preprocessing step of the invention is to firstly detect the abnormality, then perform interpolation operation and finally perform normalization processing.
Specifically, firstly, abnormality detection is carried out on water quality data by using a K-means clustering abnormality detection method, and abnormal data in the water quality data are marked, wherein the specific formula is as follows:
wherein x is i Representing the objects in the ith cluster; c j Representing the j-th cluster center. The data determined to be abnormal after the detection is deleted as missing data.
Then, the water quality data is subjected to interpolation processing by using a mean value interpolation method, so that a complete water quality monitoring data set is obtained, and the calculation formula is shown as follows:
wherein x is t The value of the absence is indicated as such,the average value of the columns in which the missing data are located.
Finally, the min-max method is used for carrying out standardized operation on the water quality data to obtain a data set for eliminating the influence of the water quality index dimension, and the specific formula is as follows:
wherein x is min And x max Respectively represent the minimum and maximum values in a set of data, x represents the data to be normalized,representing the data after normalization.
And 3, constructing a GAT-transducer water quality prediction model, wherein the water quality prediction model mainly comprises an encoder and a decoder. And obtaining a decoding matrix by using the output number of the decoder, and obtaining prediction data after the decoding matrix is calculated by a multi-layer perceptron and a softMax function.
The encoder mainly comprises a convolutional neural network, and a parallel graph attention layer and a multi-head attention layer; the decoder mainly comprises a convolutional neural network and a parallel graph attention mechanism and a mask multi-head attention mechanism.
Specifically:
an encoder: and (3) improving the model on the basis of a transducer, adding a parallel GAT layer on the basis of a transducer multi-head attention layer, and constructing a timing sequence and multi-element feature capturing module I. The specific flow is as follows:
(1) Firstly, inputting the data obtained after abnormality detection, mean value interpolation and normalization into a time sequence and multi-element feature capturing module I of a GAT-transducer water quality prediction method, wherein the function of the module I is to extract time sequence features and index multi-element related features in the data. The time sequence characteristic refers to the law and trend of the change of the water quality index along with time, and the index multi-element related characteristic refers to the mutual influence and association degree between different water quality indexes. To extract these features, a GAT layer and a multi-headed attention layer are used.
The GAT layer is a core component of the graph annotation force network (GrapH Attention Network), and can consider the water quality index as nodes in the graph, calculate the attention weight of each node to other nodes according to the connection relation and attribute information among the nodes, and aggregate information according to the weight, so as to obtain a new representation of each node. The multi-head attention layer is a core component of a transducer model, and can consider water quality indexes as elements in a sequence, calculate attention weights of each element to other elements according to the position relation and semantic information among the elements, and aggregate information according to the weights so as to obtain new representation of each element. By combining the GAT layer and the multi-head attention layer, the characteristics of the water quality index under the graph structure and the sequence structure can be considered simultaneously, and a characteristic matrix containing time sequence characteristics and index multi-element related characteristics can be obtained.
(2) The characteristic matrix passes through a forward propagation network, which is a simple and effective neural network structure, and consists of a plurality of full-connection layers, and can perform nonlinear transformation and dimension reduction operation on an input matrix.
(3) And finally, carrying out summation and regularization to obtain a coding matrix which can be used as the output of a water quality prediction model or the input of a downstream task.
A decoder: and (3) improving the mask on the basis of a transducer, adding a GAT layer on the basis of the multi-head attention of the transducer mask, and constructing a second time sequence and multi-element feature capturing module. The specific flow is as follows:
(1) Firstly, inputting the data obtained after abnormality detection, mean value interpolation and normalization into a time sequence and multi-element feature capturing module II of the GAT-transducer water quality prediction method, wherein the time sequence and multi-element feature capturing module II adopts the same input as the time sequence and multi-element feature capturing module I. The data passes through a GAT layer and a mask multi-head attention layer to obtain a mask feature matrix containing time sequence features and index multi-element related features;
(2) The mask feature matrix and the code matrix are then simultaneously input into the multi-headed attention layer, resulting in a richer and more complete feature representation. The multi-head attention layer is a core component of a transducer model, and can consider a mask feature matrix and an encoder matrix as elements in a sequence, calculate attention weights of each element to other elements according to the position relation and semantic information among the elements, and aggregate information according to the weights so as to obtain a new representation of each element. Through the multi-headed attention layer, the mask features and the encoder features under the sequence structure can be considered simultaneously, and a final feature matrix is obtained.
(3) The final feature matrix is subjected to first summation and regularization, forward propagation, second summation and regularization in sequence, and a decoding matrix is obtained through output, and the effect of the step is to further transform and compress the final feature matrix, so that a more compact and high-dimensional matrix is obtained. Summing and regularization are a common operation that sums each row in the input matrix and regularizes it to obtain a one-dimensional vector. The forward propagation network is a simple and effective neural network structure, and is composed of a plurality of full-connection layers, and can perform nonlinear transformation and dimension reduction operation on an input matrix.
The prediction data is obtained after the decoding matrix is calculated by the multi-layer perceptron and the softMax function, and the function of the step is to carry out regression on the decoding matrix so as to obtain the prediction data. The multi-layer perceptron is a common neural network structure, which consists of a plurality of full-connection layers and an activation function, and can perform nonlinear transformation and mapping on an input matrix so as to obtain an output matrix. The SoftMax function is a commonly used activation function that indexes and normalizes each element in the output matrix to obtain a probability distribution vector. After calculation by the multi-layer perceptron and SoftMax functions, a prediction data is obtained, which can represent the prediction value of the model for each category.
And step 4, training the water quality prediction model, and carrying out water quality prediction by using the trained water quality prediction model.
The invention further aims at providing a water quality prediction system based on a GAT-transducer time sequence model, which comprises a distributed sensor, a network module, a calculation module, a display module and the like.
Wherein, distributed sensor arranges in the monitoring waters, gathers pH value, turbidity, dissolved oxygen, temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen and total phosphorus. In the invention, the distributed sensor means that each sensor can independently acquire and process own information and can acquire certain classification characteristics according to the needs. The preprocessing step in the step 2 can be realized through a small local area network, namely, a processing unit is independently arranged for detecting one or a plurality of sensors in the water area, so that the data transmission quantity can be reduced, and the network load is reduced.
The network module is used for realizing the transmission of the data acquired by the distributed sensor to the calculation module and the transmission of the output result of the calculation module to the display module. At present, the wireless network module and the networking mode thereof are mature, so the wireless network module and the networking mode thereof, such as zigbee technology, are selected.
The calculation module carries the water quality prediction model trained in the method, takes the collected data of the distributed sensor as input, and can obtain a water quality prediction result by using the water quality prediction model. The calculation module of the invention can be a central computer or local computers which are independently distributed in a certain monitored water area, and the local computers can upload the prediction results to the central computer. The two modes have advantages and disadvantages, and can be specifically selected according to factors such as physical distance between monitored water areas.
The display module is used for displaying the water quality prediction result.
In some embodiments of the present invention, a plurality of monitoring waters are divided according to the water flow direction, and the distributed sensors of each monitoring waters are grouped separately, and if each group of distributed sensors collect data at the same time and respectively obtain a water quality prediction result, a water quality prediction result under static state can be obtained. If the water flow arrival time of the adjacent area is calculated according to the flow speed and the distance, each group of distributed sensors acquire data according to the 'running water code', and a water quality prediction result is obtained respectively, so that the water quality prediction result under the dynamic state can be obtained. And the calculation module acquires the water quality change trend along the water flow direction according to each water quality prediction result.
The method has the significance that the water quality is predicted according to the data of different monitored water areas at the same time under static state, and the water quality is predicted according to the influence of different monitored water areas under dynamic state. The latter can also obtain the associated feature while realizing the prediction, further according to the associated feature, can judge the inherent relation between the index.
In some embodiments of the present invention, according to the water quality prediction result, intervention measures, such as adding chemical agents, planting aquatic plants, etc., can be taken in advance in the corresponding monitored water area, the intervention measures take a small number of times as a principle, and after the effective time of the intervention measures is reached, the prediction is collected again in the monitored water area and at least two monitored water areas downstream of the monitored water area, so as to perform feedback adjustment for a plurality of times according to the water quality prediction result.
The feedback adjustment concept is introduced in the embodiment, but the traditional adjustment is based on 'real-time detection data', but the embodiment is based on 'predicted future data', and the method can purposefully advance the processing based on the future data, so that the effectiveness and timeliness of the processing are improved.
In some embodiments of the present invention, the distributed sensor further includes a water level gauge, and for two adjacent monitored waters into which no branch flows are collected according to the water flow direction, if the water level of the downstream monitored waters does not exceed the normal water flow level, but the water quality change trend is "bad" with respect to the upstream monitored waters, it can be primarily determined that there is sewage inflow; if the water level of the downstream monitoring water area exceeds the normal water flow level, but the water quality change trend of the upstream monitoring water area is 'good', the water level can be preliminarily judged to be rainwater-in, and if no rainwater is actually in the water level, the alarm is manually processed.
The significance of the embodiment is that based on the prediction of water quality and the combination of water level change, whether sewage is stolen or out of standard and hidden is possible is judged. In the first condition of this embodiment, under the condition that the water level of the downstream monitoring water area does not change significantly, there is no effective water replenishing source, and the water quality is seriously deteriorated, which indicates that there is a high probability of hidden sewage discharge between the monitoring water areas, or that there is excessive user discharge in the original sewage pipe, at this time, manual intervention can be performed in advance. In the second condition of this embodiment, the general water quality change is not too obvious, which means that there may be rainwater draining, and if there is no rainwater, the manual treatment is needed to judge whether there is a great deal of sewage which is not out of standard by the user or whether there is purified water draining into the water area.
Unlike conventional central display modules, in some embodiments of the present invention, a smart phone terminal or a sewage enterprise control terminal is added as a display module, and the display module can send a request for adding a system networking to the calculation module, and the calculation module agrees with the request after authenticating the display module, and the display module in the system networking can select one or more water quality prediction results of the monitored water areas as receiving information.
That is, in this embodiment, from the viewpoint of system load and convenience in use, on one hand, the architecture of multiple display modules is expanded, and on the other hand, authentication networking is performed on different display modules. The display module in the network can select the water quality prediction results of certain monitoring water areas, and for a manager, the result of the monitoring water areas with related persons can be selectively opened in a targeted manner, and the related persons can acquire the prediction results so as to adjust the behavior of the manager. In the present invention, the related person refers to a person having an interest in monitoring water quality in a water area, such as a sewage disposal company, a surrounding resident, and the like.
In a specific embodiment of the present invention, to train the water quality prediction module, the hardware is selected as a computer, and the configuration includes a hardware environment: CPU:2 Intel Xeon 6130 processors (2.1 GHz/16 c)/2666 MHz/10.4GT; GPU:6 blocks 16G_TESLA-P100_4096b_P_CAC; memory: 16 roots 32G ECC Registered DDR4 2666; software environment: operating system: ubuntu16.04; deep learning framework: tensorFlow, pandas, scikit-learn; language and development environment: python 3.6, anaconda 3, pycnarm 2020.
The data set used for training is real data record between 2019 and 2020 of a certain water area of inner Mongolia, and the data record is carried out every 4 hours, and the acquisition indexes of water quality comprise nine characteristics of pH value, turbidity, dissolved oxygen, water temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen and total phosphorus. The experiment predicts three elements of dissolved oxygen, total nitrogen and total phosphorus.
The prediction results of the GAT-transducer water quality prediction model provided by the invention for Dissolved Oxygen (DO), total Nitrogen (TN) and Total Phosphorus (TP) are shown in figures 2, 3 and 4, and total 336 data of each element are predicted for 14 days. As can be seen from fig. 2, 3 and 4, the water quality data predicted by the water quality prediction model provided by the invention is more consistent with the actual data, and for the case of abrupt change of the water quality time series data, although more accurate values are not predicted, the case of abrupt change of the data is also predicted.
From this experiment and table 1, it can be seen that the GAT-transducer model proposed by the present invention predicts performance comparisons of the three indices of DO, TP, TN by other six time series analysis methods, we use red bold to represent the optimal result, blue font inferior. It can be seen from Table 1 that the GAT-transducer model is superior to the other predictive models in all cases. In the aspect of machine learning, the prediction result of XGBoost obtains better results; in the field of deep learning, the prediction result of the model is improved to a great extent. Analysis was performed using DO as an example: compared with a widely applied cyclic neural network prediction method, the evaluation index MAE and the RMSE are respectively reduced by 88 to 89 percent and 80 to 85 percent, and the main reasons are as follows: the self-attention can change the dependent calculation between any two time nodes into a constant, the self-attention is stronger than the circulating neural network on long distance, compared with the methods such as IGRA, SAE and the like, the GAT can well capture the correlation between water quality indexes, the IGRA is only suitable for approximate exponential functions and is not suitable for complex nonlinear data, and the SAE ignores the multi-index correlation of water quality change; compared with the Informir prediction method, the MAE and RMSE indexes are respectively reduced by 79.59 percent and 68.55 percent, compared with Log Sparse Transformer, the MAE and RMSE indexes are respectively reduced by 76.47 percent and 62.14 percent, and compared with the two methods, the method also achieves good effects, and the main reason is that the Informir and Log Sparse Transformer are also improvements on the Transformer, but do not consider the correlation among water quality parameter indexes, and the prediction effect is not as good as that of the method provided by the invention.
TABLE 1DO prediction results comparison
While the invention has been described in terms of preferred embodiments, the invention is not limited to the embodiments described herein, but encompasses various changes and modifications that may be made without departing from the scope of the invention.
Claims (10)
1. A water quality prediction method based on a GAT-transducer time sequence model is characterized by comprising the following steps:
step 1, acquiring water quality monitoring data, wherein the water quality monitoring data is a group of time series data;
step 2, preprocessing the water quality monitoring data, firstly performing anomaly detection, then performing interpolation operation, and finally performing normalization processing;
step 3, constructing a GAT-transducer-based water quality prediction model, wherein the water quality prediction model comprises an encoder and a decoder; the encoder comprises a convolutional neural network, and a parallel graph attention layer and a multi-head attention layer; the decoder comprises a convolutional neural network, a parallel graph attention layer and a mask multi-head attention layer; obtaining a decoding matrix using an output of the decoder; the decoding matrix is calculated by a multi-layer perceptron and a softMax function to obtain prediction data;
and step 4, training the water quality prediction model, and carrying out water quality prediction by using the trained water quality prediction model.
2. The water quality prediction method based on the GAT-transducer time series model according to claim 1, wherein the collection indexes of the water quality monitoring data in step 1 include pH, turbidity, dissolved oxygen, water temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen and total phosphorus, and the dissolved oxygen, total nitrogen and total phosphorus are predicted.
3. The water quality prediction method based on the GAT-Transformer time series model according to claim 1, wherein the step 2 is characterized in that firstly, abnormality detection is carried out on water quality monitoring data by using a K-means clustering abnormality detection method, and abnormal data in the water quality monitoring data are marked; then, performing interpolation processing on the water quality monitoring data by using a mean value interpolation method to obtain a complete water quality monitoring data set; and finally, carrying out standardized operation on water quality monitoring by using a min-max method to obtain a data set for eliminating the influence of the water quality index dimension.
4. The water quality prediction method based on the GAT-transducer time sequence model according to claim 1, wherein the encoder is based on a transducer, adds a drawing attention layer parallel to a multi-head attention layer of the encoder, and constructs a time sequence and multi-element feature capturing module I; the time sequence and multi-element feature capturing module firstly uses a CNN network to extract time sequence features and index multi-element related features in input data to obtain a feature matrix containing the time sequence features and the index multi-element related features, wherein the time sequence features refer to the law and trend of the change of water quality monitoring data along with time, and the index multi-element related features refer to the mutual influence and association degree between different water quality indexes; the characteristic matrix passes through a forward propagation network, and finally summation and regularization are carried out to obtain a coding matrix;
the decoder is based on a transducer, and is added with a drawing attention layer parallel to a mask multi-head attention layer to construct a time sequence and multi-element feature capturing module II; the second time sequence and multi-element feature capturing module adopts the same input data as the first time sequence and multi-element feature capturing module to extract time sequence features and index multi-element related features in the input data to obtain a mask feature matrix containing the time sequence features and the index multi-element related features; inputting the mask feature matrix and the coding matrix into a multi-head attention layer simultaneously to obtain a final feature matrix; and sequentially carrying out first summation and regularization, forward propagation and second summation and regularization on the final feature matrix to obtain a decoding matrix.
5. The water quality prediction method based on the GAT-transducer time series model according to claim 1, wherein in the step 3, the decoding matrix is first passed through a multi-layer perceptron layer, then passed through a SoftMax layer, and finally the output of the predicted data is obtained.
6. A water quality prediction system based on a GAT-transducer time sequence model is characterized by comprising a distributed sensor, a network module, a calculation module and a display module;
the distributed sensor is distributed in a monitored water area and is used for collecting pH value, turbidity, dissolved oxygen, water temperature, conductivity, permanganate index, total nitrogen, ammonia nitrogen and total phosphorus;
the network module is used for realizing the transmission of the data acquired by the distributed sensor to the calculation module and the transmission of the output result of the calculation module to the display module;
the calculation module carries a water quality prediction model obtained by training the water quality prediction method based on the GAT-transducer time sequence model according to any one of claims 1 to 5, takes the data collected by the distributed sensor as input, and obtains a water quality prediction result by using the water quality prediction model;
and the display module displays the water quality prediction result.
7. The water quality prediction system based on the GAT-transducer time series model according to claim 6, wherein a plurality of monitoring waters are divided according to the water flow direction, distributed sensors in each monitoring waters are grouped, and the water flow arrival time of adjacent areas is calculated at the same time or according to the flow rate and the distance, and the acquired data of each group of distributed sensors obtain a water quality prediction result; and the calculation module acquires the water quality change trend along the water flow direction according to each water quality prediction result.
8. The water quality prediction system based on the GAT-transducer time series model according to claim 7, wherein intervention is performed in the corresponding monitoring water area in advance according to the water quality prediction result, the intervention is performed on a principle of a small number of times, and the prediction is collected again in the monitoring water area and at least two monitoring water areas downstream thereof after the time of the intervention is effective, so as to perform feedback adjustment for a plurality of times according to the water quality prediction result.
9. The water quality prediction system based on the GAT-transducer time series model according to claim 7, wherein the distributed sensor further comprises a water level gauge, wherein for two adjacent monitoring waters to which no branches are collected, according to the water flow direction, if the water level of the downstream monitoring waters does not exceed the normal water flow level, but the water quality change trend is "bad" with respect to the upstream monitoring waters, it is determined that there is sewage collection; if the water level of the downstream monitoring water area exceeds the normal water flow level, but the water quality change trend of the upstream monitoring water area is 'good', rainwater is judged to be imported, and if no rainwater is actually imported, the alarm is manually processed.
10. The water quality prediction system based on the GAT-transducer time series model according to claim 7, wherein the display module is a smart phone terminal or a pollution discharge enterprise control terminal, the display module sends a request for joining a system networking to the calculation module, the calculation module agrees with the request after authenticating the display module, and the display module in the networking selects the water quality prediction result of one or several monitored water areas as the receiving information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311140729.4A CN117273203A (en) | 2023-09-05 | 2023-09-05 | Water quality prediction method and system based on GAT-transducer time sequence model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311140729.4A CN117273203A (en) | 2023-09-05 | 2023-09-05 | Water quality prediction method and system based on GAT-transducer time sequence model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117273203A true CN117273203A (en) | 2023-12-22 |
Family
ID=89215122
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311140729.4A Pending CN117273203A (en) | 2023-09-05 | 2023-09-05 | Water quality prediction method and system based on GAT-transducer time sequence model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117273203A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117671507A (en) * | 2024-01-29 | 2024-03-08 | 南昌大学 | River water quality prediction method combining meteorological data |
CN117830031A (en) * | 2024-03-05 | 2024-04-05 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Water supply network terminal water quality turbidity prediction method and related equipment |
CN118070021A (en) * | 2024-04-22 | 2024-05-24 | 广东慧航天唯科技有限公司 | Sporadic industrial enterprise wastewater discharge detection and early warning method |
-
2023
- 2023-09-05 CN CN202311140729.4A patent/CN117273203A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117671507A (en) * | 2024-01-29 | 2024-03-08 | 南昌大学 | River water quality prediction method combining meteorological data |
CN117671507B (en) * | 2024-01-29 | 2024-05-10 | 南昌大学 | River water quality prediction method combining meteorological data |
CN117830031A (en) * | 2024-03-05 | 2024-04-05 | 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) | Water supply network terminal water quality turbidity prediction method and related equipment |
CN118070021A (en) * | 2024-04-22 | 2024-05-24 | 广东慧航天唯科技有限公司 | Sporadic industrial enterprise wastewater discharge detection and early warning method |
CN118070021B (en) * | 2024-04-22 | 2024-07-23 | 广东慧航天唯科技有限公司 | Sporadic industrial enterprise wastewater discharge detection and early warning method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117273203A (en) | Water quality prediction method and system based on GAT-transducer time sequence model | |
CN111337768B (en) | Deep parallel fault diagnosis method and system for dissolved gas in transformer oil | |
US20220082545A1 (en) | Total Nitrogen Intelligent Detection Method Based on Multi-objective Optimized Fuzzy Neural Network | |
CN108197648A (en) | A kind of Fault Diagnosis Method of Hydro-generating Unit and system based on LSTM deep learning models | |
CN115688035A (en) | Time sequence power data anomaly detection method based on self-supervision learning | |
CN112863134A (en) | Intelligent diagnosis system and method for rural sewage treatment facility abnormal operation | |
CN107895100B (en) | Drainage basin water quality comprehensive evaluation method and system | |
CN113494939A (en) | Distributed monitoring method for rural domestic sewage | |
CN114169638A (en) | Water quality prediction method and device | |
CN110377605A (en) | A kind of Sensitive Attributes identification of structural data and classification stage division | |
CN115561416A (en) | Method and device for detecting inlet water quality of sewage treatment plant in real time | |
CN109784668A (en) | A kind of sample characteristics dimension-reduction treatment method for electric power monitoring system unusual checking | |
CN112836809A (en) | Device characteristic extraction method and fault prediction method of convolutional neural network based on differential feature fusion | |
CN117370919B (en) | Remote monitoring system for sewage treatment equipment | |
CN117725491A (en) | SCITET-based power system fault state detection and classification method | |
Tian et al. | Operation status monitoring of reciprocating compressors based on the fusion of spatio-temporal multiple information | |
CN117272230A (en) | Non-invasive load monitoring method and system based on multi-task learning model | |
Babu et al. | Water quality prediction using neural networks | |
Yin et al. | A multivariate time series prediction schema based on multi-attention in recurrent neural network | |
CN112418623A (en) | Anti-electricity-stealing identification method based on bidirectional long-time and short-time memory network and sliding window input | |
Li et al. | Tadl: Fault localization with transformer-based anomaly detection for dynamic microservice systems | |
Kang et al. | Research on forecasting method for effluent ammonia nitrogen concentration based on GRA-TCN | |
Qu et al. | Remaining Useful Life Prediction of High-Speed Railroad Contact Network Based on Stacking Integrated Attention-LSTM-CNN Deep Learning | |
CN111210147B (en) | Sintering process operation performance evaluation method and system based on time sequence feature extraction | |
CN114266925B (en) | DLSTM-RF-based user electricity stealing detection method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |