A method for predicting river water environment quality

Through the characteristic extraction and model training of river water quality indicators, the SARIMA, Ann, and LSTM algorithm are used to predict, and the problem of insufficient accuracy of the existing water quality prediction model has been solved, and higher applicability and accuracy are achieved.

CN112966891BActive Publication Date: 2025-01-28CHENGDU ACADEMY OF ENVIRONMENTAL SCI +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110091465.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-23
Publication Date
2025-01-28
Estimated Expiration
2041-01-23

AI Technical Summary

Technical Problem

The existing mathematical models of water quality data-driven in river water quality prediction and early warning are insufficient, and cannot meet higher demands.

Method used

Through communication with online monitoring equipment, obtain historical monitoring values ​​of water quality indicators, and conduct One-Hotencoding durong coding, correlation analysis, factor analysis, and clustering analysis, and extract water quality index characteristics. Then use Sarima, Ann, and LSTM algorithms for model training and prediction, dynamically track predictive accuracy and adjust the optimal prediction model.

Benefits of technology

It improves the applicability and simulation accuracy of the quality prediction method of the river water environment. It can dynamically track and predict the accuracy and adjust the optimal prediction model to meet higher application needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112966891B_ABST
    Figure CN112966891B_ABST
Patent Text Reader

Abstract

A method for predicting river water environment quality, the method is that water quality feature extraction is through factor analysis, cluster analysis, correlation analysis, monitoring sections with similar water quality changes are regarded as one category, and the main pollution indicators corresponding to this type of monitoring sections and the indicators related to the main pollution indicators are analyzed; the main pollution indicators and the correlation indicators are used as input indicators, and the main pollution indicators are predicted through the connection between the indicators and the correlation between the data before and after the time series, so as to improve the prediction accuracy; the method can dynamically track the prediction accuracy and adjust the river water environment quality of the optimal prediction model, through the correlation analysis of water quality indicators, factor analysis and cluster analysis, for different water bodies, such as: rivers, lakes and reservoirs; for different water quality indicators, such as: dissolved oxygen, nitrogen, phosphorus, COD, SARIMA, ANN, LSTM algorithm simulation is used, and the prediction accuracy is dynamically tracked and the optimal prediction model is adjusted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of water environment prediction, in particular to a method for predicting river water environment quality. Background Art

[0002] At present, the commonly used water quality mathematical models mainly include two categories: water quality mechanism mathematical models and water quality data-driven mathematical models. The commonly used water quality mechanism mathematical models based on theoretical foundations require a large amount of appropriate historical hydrological and water quality data to calibrate the model parameters when the model is applied. At the same time, when there are many factors affecting a certain water quality indicator, the mechanism will become very complicated, which will make it difficult to establish the model and difficult to obtain relevant parameters. In recent years, with the rapid development of big data research, data-driven models based on sample data and using gray box or black box equations have been widely used in many disciplines. Similarly, data-driven models have also been used in river water quality prediction and early warning. However, most of the existing water quality data-driven mathematical models use a single static model for water quality prediction and early warning. Its applicability and simulation accuracy are far from enough to meet the needs of more people. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a method for predicting river water environment quality, which can effectively solve the problems raised in the above-mentioned background technology.

[0004] To solve the above problems, the technical solution adopted by the present invention is: a method for predicting river water environment quality, comprising the following steps:

[0005] S1, model initialization: obtain online data by establishing communication with different water quality index sensors of online monitoring equipment;

[0006] S2. Obtain historical monitoring values ​​of water quality indicators: One-Hot Encoding the monitored water body, monitored section, and monitored water quality indicators;

[0007] S3. Extraction of water quality index characteristics: Through correlation analysis, factor analysis, and polymer analysis of historical monitoring values ​​of water quality indicators:

[0008] 3-1. Correlation analysis: Conduct correlation analysis on monitoring sections and water quality indicators to obtain the correlation between water quality indicators of each monitoring section;

[0009] 3-2. Factor analysis: Conduct water quality index factor analysis on monitoring sections and monitored water quality indicators to obtain the main factors of each monitoring section and monitored water quality indicator;

[0010] 3-3. Cluster analysis: cluster analysis is performed on monitoring sections and monitoring time through the main factor numbers to obtain the categories of each monitoring section and monitoring time;

[0011] 3-4. Select the monitoring section, monitoring time, and monitoring water quality indicators after analysis;

[0012] S4, model training: SARIMA, ANN, and LSTM algorithms are used to simulate and predict the monitoring sections and water quality obtained through correlation analysis and cluster analysis, and the data predicted by the algorithms are compared with the corresponding water quality index data;

[0013] S5. Count the simulation accuracy of SARIMA, ANN and LSTM algorithms respectively, and judge whether the prediction model error rate of SARIMA, ANN and LSTM algorithms is less than 30% of the set threshold; if the prediction model error rate is less than 30% of the set threshold, it is returned to the optimization model pool and proceeds directly to the next step; if the prediction model error rate is greater than 30% of the set threshold, it is returned to the dormant model pool;

[0014] S6. According to the simulation accuracy, determine the best model in the optimization model pool, and judge whether the SARIMA, ANN, and LSTM algorithm prediction models need to be re-optimized. If the error rate of the best model in the optimization model pool is greater than 30% of the set threshold, return to S4, retrain the SARIMA, ANN, and LSTM algorithm prediction models, and optimize the parameters; if the error rate of the best model in the optimization model pool is less than 30% of the set threshold, proceed directly to the next step.

[0015] S7. When water quality prediction is used in real time, the dual-thread method is used. The water quality prediction uses the optimal model for real-time prediction and early warning, and other algorithms are used for simulation;

[0016] S8. Statistical water quality prediction is used in real time to optimize the model simulation accuracy in the model pool, while dynamically tracking the prediction accuracy to adjust the optimal prediction model;

[0017] S9. Repeated statistical water quality predictions are used in real time to optimize the model simulation accuracy in the model pool, and at the same time, the prediction accuracy is dynamically tracked to adjust the optimal prediction model, so that the water quality prediction can be used in real time.

[0018] As a further preferred embodiment of the present invention, water quality feature extraction is to classify monitoring sections with similar water quality changes through factor analysis, cluster analysis, and correlation analysis, and analyze the main pollution indicators and related indicators of the main pollution indicators corresponding to this type of monitoring sections; the main pollution indicators and correlation indicators are used as input indicators together, and the main pollution indicators are predicted through the connection between the indicators and the correlation between the data before and after the time series, thereby improving the prediction accuracy.

[0019] As a further preferred embodiment of the present invention, the cluster analysis uses the Euclidean distance d. objects and The distance between objects can be calculated by the following formula, where the object is the water quality monitoring section, and the same water quality parameters between each section are calculated accordingly:

[0020] ;

[0021] Where: For the The object's attribute values, where Each object is a water quality section or month; For the The object's attribute values, where The target water quality section or month; The attribute value is the water quality index value; d represents the degree of water quality change between adjacent water quality monitoring sections. The higher the value, the faster the water quality changes between adjacent water quality monitoring sections.

[0022] As a further preferred embodiment of the present invention, the factor analysis is represented by the following formula:

[0023] ;

[0024] Where: The factor loading refers to the influence of each variable on the factor after factor rotation; is a common factor; is the total sample size; is the cumulative error residual; is the number of factors extracted.

[0025] As a further preferred embodiment of the present invention, the calculation formula of the Pearson correlation coefficient is as follows:

[0026] ;

[0027] The significance test of the correlation coefficient uses the sample correlation coefficient r as an estimate of the overall correlation coefficient ρ, and r only indicates the degree of correlation between X and Y of the sample data.

[0028] As a further preferred embodiment of the present invention, the training model randomly splits the historical water quality data into two unequal parts, with the larger part of the data being used as a training set and the smaller part being used as a test set; SARIMA, ANN, and LSTM algorithm models are established in the training set; the model is applied to the test set, the test results are fed back in real time, and continuous model optimization is performed.

[0029] As a further preferred embodiment of the present invention, the optimal prediction model is selected to train and predict the SARIMA, ANN, and LSTM algorithm models, and the average error rate and root mean square error of the predicted values ​​and actual values ​​of the three models are calculated, and dynamically updated according to the increase of the predicted value n. The smaller the root mean square error and average error rate of the predicted value and actual value of the model, the better the model:

[0030] Average error rate = ;

[0031] Root Mean Square Error = ;

[0032] in:

[0033] Xi represents the model prediction value;

[0034] Yi represents the actual predicted value;

[0035] n represents the number of predicted values ​​and is updated dynamically.

[0036] Compared with the prior art, the present invention provides a method for predicting river water environment quality, which has the following beneficial effects:

[0037] This method can dynamically track the prediction accuracy and adjust the river water environment quality of the optimal prediction model by conducting correlation analysis, factor analysis and cluster analysis of water quality indicators. For different water bodies, such as rivers and lakes; for different water quality indicators, such as dissolved oxygen, nitrogen, phosphorus, COD, SARIMA, ANN, LSTM algorithms are used for simulation, while dynamically tracking the prediction accuracy and adjusting the optimal prediction model. This greatly improves the applicability and simulation accuracy of the river water environment quality prediction method in practical application. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0040] The present invention provides a method for predicting river water environment quality, comprising the following steps:

[0041] S1, model initialization: obtain online data by establishing communication with different water quality index sensors of online monitoring equipment;

[0042] S2. Obtain historical monitoring values ​​of water quality indicators: One-Hot Encoding the monitored water body, monitored section, and monitored water quality indicators;

[0043] S3. Extraction of water quality index characteristics: Through correlation analysis, factor analysis, and polymer analysis of historical monitoring values ​​of water quality indicators:

[0044] 3-1. Correlation analysis: Conduct correlation analysis on monitoring sections and water quality indicators to obtain the correlation between water quality indicators of each monitoring section;

[0045] 3-2. Factor analysis: Conduct water quality index factor analysis on monitoring sections and monitored water quality indicators to obtain the main factors of each monitoring section and monitored water quality indicator;

[0046] 3-3. Cluster analysis: cluster analysis is performed on monitoring sections and monitoring time through the main factor numbers to obtain the categories of each monitoring section and monitoring time;

[0047] 3-4. Select the monitoring section, monitoring time, and monitoring water quality indicators after analysis;

[0048] S4, model training: SARIMA, ANN, and LSTM algorithms are used to simulate and predict the monitoring sections and water quality obtained through correlation analysis and cluster analysis, and the data predicted by the algorithms are compared with the corresponding water quality index data;

[0049] S5. Count the simulation accuracy of SARIMA, ANN and LSTM algorithms respectively, and judge whether the prediction model error rate of SARIMA, ANN and LSTM algorithms is less than 30% of the set threshold; if the prediction model error rate is less than 30% of the set threshold, it is returned to the optimization model pool and proceeds directly to the next step; if the prediction model error rate is greater than 30% of the set threshold, it is returned to the dormant model pool;

[0050] S6. According to the simulation accuracy, determine the best model in the optimization model pool, and judge whether the SARIMA, ANN, and LSTM algorithm prediction models need to be re-optimized. If the error rate of the best model in the optimization model pool is greater than 30% of the set threshold, return to S4, retrain the SARIMA, ANN, and LSTM algorithm prediction models, and optimize the parameters; if the error rate of the best model in the optimization model pool is less than 30% of the set threshold, proceed directly to the next step.

[0051] S7. When water quality prediction is used in real time, the dual-thread method is used. The water quality prediction uses the optimal model for real-time prediction and early warning, and other algorithms are used for simulation;

[0052] S8. Statistical water quality prediction is used in real time to optimize the model simulation accuracy in the model pool, while dynamically tracking the prediction accuracy to adjust the optimal prediction model;

[0053] S9. Repeated statistical water quality predictions are used in real time to optimize the model simulation accuracy in the model pool, and at the same time, the prediction accuracy is dynamically tracked to adjust the optimal prediction model, so that the water quality prediction can be used in real time.

[0054] As a further preferred embodiment of the present invention, water quality feature extraction is to classify monitoring sections with similar water quality changes through factor analysis, cluster analysis, and correlation analysis, and analyze the main pollution indicators and related indicators of the main pollution indicators corresponding to this type of monitoring sections; the main pollution indicators and correlation indicators are used as input indicators together, and the main pollution indicators are predicted through the connection between the indicators and the correlation between the data before and after the time series, thereby improving the prediction accuracy.

[0055] As a further preferred embodiment of the present invention, the cluster analysis uses the Euclidean distance d. objects and The distance between objects can be calculated by the following formula, where the object is the water quality monitoring section, and the same water quality parameters between each section are calculated accordingly:

[0056] ;

[0057] Where: For the The object's attribute values, where Each object is a water quality section or month; For the The object's attribute values, where The target water quality section or month; The attribute value is the water quality index value; d represents the degree of water quality change between adjacent water quality monitoring sections. The higher the value, the faster the water quality changes between adjacent water quality monitoring sections.

[0058] As a further preferred embodiment of the present invention, the factor analysis is represented by the following formula:

[0059] ;

[0060] Where: The factor loading refers to the influence of each variable on the factor after factor rotation; is a common factor; is the total sample size; is the cumulative error residual; is the number of factors extracted.

[0061] As a further preferred embodiment of the present invention, the calculation formula of the Pearson correlation coefficient is as follows:

[0062] ;

[0063] The significance test of the correlation coefficient uses the sample correlation coefficient r as an estimate of the overall correlation coefficient ρ, and r only indicates the degree of correlation between X and Y of the sample data.

[0064] As a further preferred embodiment of the present invention, the training model randomly splits the historical water quality data into two unequal parts, with the larger part of the data being used as a training set and the smaller part being used as a test set; SARIMA, ANN, and LSTM algorithm models are established in the training set; the model is applied to the test set, the test results are fed back in real time, and continuous model optimization is performed.

[0065] As a further preferred embodiment of the present invention, the optimal prediction model is selected to train and predict the SARIMA, ANN, and LSTM algorithm models, and the average error rate and root mean square error of the predicted values ​​and actual values ​​of the three models are calculated, and dynamically updated according to the increase of the predicted value n. The smaller the root mean square error and average error rate of the predicted value and actual value of the model, the better the model:

[0066] Average error rate = ;

[0067] Root Mean Square Error = ;

[0068] in:

[0069] Xi represents the model prediction value;

[0070] Yi represents the actual predicted value;

[0071] n represents the number of predicted values ​​and is updated dynamically.

[0072] As a specific embodiment of the present invention:

[0073] First, the model is initialized, and communication is established with different water quality indicator sensors of online monitoring equipment to obtain online data. The concentrations of different water quality indicators in the water body are obtained through online data. Then, One-Hot is performed on the monitored water body, monitored section, and monitored water quality indicators. Encoding unique hot encoding, obtain the historical monitoring values ​​of water quality indicators; extract water quality characteristics, conduct water quality indicator correlation analysis on monitoring sections and monitoring water quality indicators, and obtain the correlation between each monitoring section and monitoring water quality indicators; conduct water quality indicator factor analysis on monitoring sections and monitoring water quality indicators, obtain the main factors of each monitoring section and monitoring water quality indicators, and perform cluster analysis on monitoring sections and monitoring time through the number of main factors to obtain the categories of each monitoring section and monitoring time; perform SARIMA, ANN, and LSTM algorithm simulation prediction on the monitoring sections and monitoring water quality indicators after correlation analysis and cluster analysis, compare the data predicted by the algorithm with the corresponding water quality indicator data, and then statistically analyze the simulation accuracy of SARIMA, ANN, and LSTM algorithms, and judge whether the error rate of the SARIMA, ANN, and LSTM algorithm prediction model is less than 30% of the set threshold; if the error rate of the prediction model is less than 30% of the set threshold, it is attributed to the optimization model pool and directly proceeds to the next step; if the error rate of the prediction model is greater than 30% of the set threshold , it is returned to the dormant model pool; then, according to the simulation accuracy, the optimal model in the optimization model pool is determined, and it is determined whether the SARIMA, ANN, and LSTM algorithm prediction models should be re-optimized. If the error rate of the optimal model in the optimization model pool is greater than 30% of the set threshold, it returns to S4, and the SARIMA, ANN, and LSTM algorithm prediction model training is re-performed to optimize the parameters; if the error rate of the optimal model in the optimization model pool is less than 30% of the set threshold, it proceeds directly to the next step; when the water quality prediction is used in real time, the dual-thread method is adopted, and the water quality prediction adopts the optimal model for real-time prediction and early warning, and other algorithms are used for simulation at the same time; finally, the water quality prediction uses the SARIMA, ANN, and LSTM algorithm simulation accuracy in real time repeatedly, and the dynamic tracking prediction accuracy is adjusted to the optimal prediction model for real-time application of water quality prediction.

[0074] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for predicting river water environment quality, comprising the following steps: S1, model initialization: obtain online data by establishing communication with different water quality index sensors of online monitoring equipment; S2. Obtain historical monitoring values ​​of water quality indicators: One-Hot Encoding the monitored water body, monitored section, and monitored water quality indicators; S3. Extraction of water quality index characteristics: Through correlation analysis, factor analysis, and polymer analysis of historical monitoring values ​​of water quality indicators: 3-1. Correlation analysis: Conduct correlation analysis on monitoring sections and water quality indicators to obtain the correlation between water quality indicators of each monitoring section; 3-2. Factor analysis: Conduct water quality index factor analysis on monitoring sections and monitored water quality indicators to obtain the main factors of each monitoring section and monitored water quality indicator; 3-3. Cluster analysis: cluster analysis is performed on monitoring sections and monitoring time through the main factor numbers to obtain the categories of each monitoring section and monitoring time; 3-4. Select the monitoring section, monitoring time, and monitoring water quality indicators after analysis; S4, model training: SARIMA, ANN, and LSTM algorithms are used to simulate and predict the monitoring sections and water quality obtained through correlation analysis and cluster analysis, and the data predicted by the algorithms are compared with the corresponding water quality index data; S5. Count the simulation accuracy of SARIMA, ANN and LSTM algorithms respectively, and judge whether the prediction model error rate of SARIMA, ANN and LSTM algorithms is less than 30% of the set threshold; if the prediction model error rate is less than 30% of the set threshold, it is classified into the optimization model pool and directly proceeds to the next step; if the prediction model error rate is greater than 30% of the set threshold, it is classified into the dormant model pool; S6. According to the simulation accuracy, determine the best model in the optimization model pool, and judge whether the SARIMA, ANN, and LSTM algorithm prediction models need to be re-optimized. If the error rate of the best model in the optimization model pool is greater than 30% of the set threshold, return to S4, retrain the SARIMA, ANN, and LSTM algorithm prediction models, and optimize the parameters. If the error rate of the best model in the optimization model pool is less than 30% of the set threshold, proceed directly to the next step; S7. When water quality prediction is used in real time, the dual-thread method is used. The water quality prediction uses the optimal model for real-time prediction and early warning, and other algorithms are used for simulation; S8. Statistical water quality prediction is used in real time to optimize the model simulation accuracy in the model pool, while dynamically tracking the prediction accuracy to adjust the optimal prediction model; S9. Repeated statistical water quality prediction and real-time application to optimize the model simulation accuracy in the model pool, and at the same time dynamically track the prediction accuracy to adjust the optimal prediction model, and apply the water quality prediction in real time; The cluster analysis uses the Euclidean distance d. The distance between the i-th object and the j-th object can be calculated by the following formula, where the object is the water quality monitoring section, and the same water quality parameters between each section are calculated accordingly: Where: xi k is the kth attribute value of the ith object, where the ith object is a water quality section or month; xj k is the kth attribute value of the jth object, where the jth object is the water quality section or month; the kth attribute value is the water quality index value; d represents the degree of water quality change between adjacent water quality monitoring sections, and the higher the value, the faster the water quality changes between adjacent water quality monitoring sections; The factor analysis is expressed as follows: Z ji =a f1 f 1i +a f2 f 2i +a f3 f 3i +…+a fm f mi +e fi ; Where: a is the factor load, which refers to the degree of influence of each variable on the factor after factor rotation; f is the common factor; i is the total number of samples; e is the total number of samples; fi is the cumulative error remainder; m is the number of factors extracted; the calculation formula of the Pearson correlation coefficient is as follows: The significance test of the correlation coefficient uses the sample correlation coefficient r as an estimate of the overall correlation coefficient ρ, and r only indicates the degree of correlation between X and Y of the sample data.

2. According to the method for predicting river water environment quality as described in claim 1, the method is that water quality feature extraction is through factor analysis, cluster analysis, correlation analysis, monitoring sections with similar water quality changes are regarded as one category, and the main pollution indicators and related indicators of the main pollution indicators corresponding to this type of monitoring sections are analyzed; the main pollution indicators and correlation indicators are used as input indicators together, and the main pollution indicators are predicted through the connection between the indicators and the correlation between the data before and after the time series, thereby improving the prediction accuracy.

3. A method for predicting river water environment quality according to claim 1, wherein the training model randomly splits historical water quality data into two unequal parts, with the larger part of the data being used as a training set and the smaller part being used as a test set; SARIMA, ANN, and LSTM algorithm models are established in the training set; the model is applied to the test set, the test results are fed back in real time, and the model is continuously optimized.

4. A method for predicting river water environment quality according to claim 1, wherein the method comprises selecting the optimal prediction model, training and predicting the SARIMA, ANN and LSTM algorithm models, calculating the average error rate and root mean square error of the predicted value and the actual value of the three models, and dynamically updating the predicted value n according to the increase of the predicted value. The smaller the root mean square error and the average error rate of the predicted value and the actual value of the model, the better the model is: in: Xi represents the model prediction value; Yi represents the actual predicted value; n represents the number of predicted values ​​and is updated dynamically.

Citation Information

Patent Citations

  • Water-quality soft measurement prediction method of chemical oxygen demand

    CN107665288A