Short-term water quality prediction method and system based on multi-feature training and meteorological correction
Through multi-feature training and meteorological correction methods, combined with neural network model and land type adjustment, the adaptability problem of the water quality prediction model under extreme meteorological conditions is solved, and high-precision short-term change trend prediction of water quality indicators is achieved.
Patent Information
- Application Number
- CN202510588376.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-08
AI Technical Summary
The existing water quality prediction models have a single feature dependence, insufficient nonlinear relationship mining, poor model adaptability and lack of dynamic correction mechanism, which leads to low prediction accuracy under extreme meteorological conditions, making it difficult to accurately predict the short-term change trend of water quality indicators.
Multi-feature training and meteorological correction methods are adopted to collect water quality parameters and meteorological prediction data, pre-process, build a neural network model, and combine the land type adjustment prediction results to draw a chart of water quality change trends.
It significantly improves the accuracy and stability of water quality prediction, especially in special meteorological conditions such as extreme rainfall, effectively corrects the prediction results and reduces the impact of uncertainty.
Smart Images

Figure CN120508773A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of water quality detection and prediction, and in particular to a short-term water quality prediction method and system based on multi-feature training and meteorological correction. Background Art
[0002] With the rapid development of industrialization and urbanization, inland water bodies such as lakes and rivers are facing increasingly severe water pollution and ecological degradation. Eutrophication, the input of exogenous pollutants, and changes in hydrodynamic conditions significantly affect the dynamic evolution of water quality parameters, placing higher demands on water environment management. Accurately predicting the changing trends of water quality indicators is of great practical significance for formulating scientific pollution prevention and control measures and protecting the aquatic ecological environment.
[0003] Currently, water quality monitoring primarily relies on automatic ground-based water quality monitoring stations, which collect real-time data on key water quality parameters such as water temperature, dissolved oxygen, total nitrogen (TN), and total phosphorus (TP) to obtain high-temporal and spatial resolution monitoring data. However, traditional monitoring methods often focus on static observations and lack the ability to dynamically predict future trends in water quality. Furthermore, changes in water quality indicators are influenced by a combination of multiple factors, among which rainfall, as a key meteorological factor, has a significant regulatory effect on the dynamic changes in water quality parameters.
[0004] Precipitation introduces large amounts of exogenous nutrients and pollutants into water bodies through surface runoff. This can lead to significant increases in the concentrations of total nitrogen (TN) and total phosphorus (TP) in the short term, increasing the risk of eutrophication. During extreme rainfall events, the concentrated influx of pollutants can significantly impact the physical and chemical characteristics of water bodies. Furthermore, changes in the spatiotemporal distribution of rainfall can also affect the dilution effect and self-purification capacity of water bodies. Therefore, incorporating rainfall, a key meteorological factor, into models for dynamic correction in short-term water quality forecasts can effectively improve forecast accuracy and reduce uncertainty.
[0005] At present, some studies have applied machine learning models (such as support vector machines, multilayer perceptrons, and regression analysis) to short-term forecasts of water quality parameters and have made some progress. However, these methods have obvious limitations: 1. Single feature dependence: Most models rely solely on historical water quality monitoring data and do not fully consider the impact of external driving factors such as meteorology, resulting in large prediction errors; 2. Insufficient mining of nonlinear relationships: Traditional methods have difficulty fully capturing the temporal evolution of water quality parameters and the complex nonlinear correlations; 3. Poor model adaptability: The characteristics of different water bodies vary greatly, and existing models are not very versatile in various scenarios; 4. Lack of dynamic correction mechanism: Under extreme meteorological conditions (such as heavy rain and high temperature), prediction results are easily interfered with by external uncertainties, but traditional models have difficulty in effectively adjusting prediction errors.
[0006] Therefore, how to accurately predict the short-term change trend of water quality indicators based on the full integration of multi-source characteristic information and improve the adaptability of the model under extreme meteorological conditions is a key issue that technical personnel in this field urgently need to solve. Summary of the Invention
[0007] This application provides a short-term water quality prediction method and system based on multi-feature training and meteorological correction to accurately predict the short-term change trend of water quality indicators while improving the adaptability of the model under extreme meteorological conditions.
[0008] To solve the above technical problems, this application provides the following technical solutions:
[0009] A short-term water quality prediction method based on multi-feature training and meteorological correction includes the following steps: step S1, collecting water quality parameter data and meteorological forecast data; step S2, preprocessing the water quality parameter data collected during a monitoring period; step S3, inputting the collected meteorological forecast data and the preprocessed water quality parameter data into a pre-trained water quality index prediction model for prediction; step S4, adjusting the model prediction results based on the meteorological forecast data and the land type around the monitoring site; step S5, drawing and displaying a water quality change trend chart based on the adjusted values of the prediction results of different monitoring periods.
[0010] As described above, the short-term water quality prediction method based on multi-feature training and meteorological correction, wherein preferably, the water quality parameter data is preprocessed, includes the following sub-steps: step S21, detecting and eliminating outliers for all water quality parameter data collected during the monitoring period; step S22, filling missing values for various types of water quality parameter data after eliminating the abnormal data; step S23, standardizing the filled water quality parameter data to complete the preprocessing of the water quality parameter data.
[0011] As described above, the short-term water quality prediction method based on multi-feature training and meteorological correction, wherein, preferably, outlier detection and elimination, includes the following sub-steps: at the end of the current monitoring period, sorting the collected water quality parameter data from small to large according to the numerical value; dividing the sorting result into four equal parts, and obtaining three quantile values; calculating the discreteness based on the data between the first and third quantiles; identifying abnormal data based on the discreteness and quantile values, and eliminating them.
[0012] As described above, the short-term water quality prediction method based on multi-feature training and meteorological correction, wherein, preferably, the construction and training of the water quality index prediction model, includes the following sub-steps: step S31, constructing a neural network prediction model as the water quality index prediction model; step S32, training the water quality index prediction model based on the meteorological forecast data, water quality parameter data and the actual index comprehensive value in the training set; step S33, verifying the trained water quality index prediction model based on the meteorological forecast data, water quality parameter data and the actual index comprehensive value in the verification set; step S34, if the verification is passed, completing the training of the water quality index prediction model, otherwise continuing to step S32.
[0013] As described above, the short-term water quality prediction method based on multi-feature training and meteorological correction, wherein, preferably, the loss value of the water quality parameter data prediction result is calculated and compared with the standard loss range; if the loss value of the water quality parameter data prediction result is within the standard loss range, the verification is passed and the training of the water quality index prediction model is completed; otherwise, the verification fails and the process returns to step S32 to continue the training of the water quality index prediction model.
[0014] A short-term water quality prediction system based on multi-feature training and meteorological correction includes: an acquisition unit, a preprocessing unit, a prediction unit, an adjustment unit, and a drawing and display unit. The acquisition unit is used to collect water quality parameter data and meteorological forecast data; the preprocessing unit is used to preprocess the water quality parameter data collected during the monitoring period; the prediction unit is used to input the collected meteorological forecast data and the preprocessed water quality parameter data into a pre-trained water quality indicator prediction model for prediction; the adjustment unit is used to adjust the prediction results based on the meteorological forecast data and the land type around the monitoring station; and the drawing and display unit is used to draw and display water quality change trend charts based on the adjusted values of the prediction results of different monitoring periods.
[0015] As described above, in the short-term water quality prediction system based on multi-feature training and meteorological correction, preferably, the preprocessing unit includes: a detection and elimination subunit, a missing value filling subunit and a standardization processing subunit; the detection and elimination subunit is used to detect and eliminate outliers for all water quality parameter data collected during the monitoring period; the missing value filling subunit is used to fill missing values for various types of water quality parameter data after eliminating abnormal data; the standardization processing subunit performs standardization processing on the filled water quality parameter data to complete the preprocessing of the water quality parameter data.
[0016] As described above, in the short-term water quality prediction system based on multi-feature training and meteorological correction, preferably, the detection and elimination subunit sorts the various water quality parameter data in ascending order according to the numerical value at the end of the current monitoring period; the detection and elimination subunit divides the sorting result into four equal parts to obtain three quantile values; the detection and elimination subunit calculates the discreteness based on the data of the first and third quantiles; the detection and elimination subunit identifies abnormal data based on the discreteness calculated by the data of the first and third quantiles and the quantile values, and eliminates them.
[0017] The short-term water quality prediction system based on multi-feature training and meteorological correction as described above, preferably, also includes: a model construction training unit, the unit includes: a construction subunit, a training subunit and a verification subunit; the construction subunit is used to construct a neural network prediction model; the training subunit performs model training based on the meteorological forecast data, water quality parameter data and the comprehensive value of actual indicators in the training set; the verification subunit verifies the model based on the meteorological forecast data, water quality parameter data and the comprehensive value of actual indicators in the verification set; if the verification subunit passes the verification, the training of the water quality indicator prediction model is completed, otherwise the training subunit continues the training.
[0018] As described above, in the short-term water quality prediction system based on multi-feature training and meteorological correction, preferably, the verification subunit calculates the loss value of the water quality parameter data prediction result and compares it with the standard loss range. If the loss value of the water quality parameter data prediction result is within the standard loss range, the verification passes and the training of the water quality index prediction model is completed; otherwise, the verification fails and the training subunit continues to train the water quality index prediction model.
[0019] Compared with the above background technology, this application fully explores the nonlinear relationship and spatiotemporal dependence between water quality parameter data and meteorological forecast data, and can dynamically predict the water quality of lakes, rivers and other water bodies, significantly improving the accuracy and stability of water quality prediction. Especially under special meteorological conditions such as extreme rainfall, this application can effectively correct the prediction results and reduce the impact of uncertainty on prediction performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments described in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0021] Figure 1 This is a flow chart of the short-term water quality prediction method based on multi-feature training and meteorological correction in this application;
[0022] Figure 2 It is a flow chart for preprocessing water quality parameter data in this application;
[0023] Figure 3 This is a flowchart for the construction and training of the water quality index prediction model in this application;
[0024] Figure 4 This is a line graph of the accuracy evaluation of the water quality index prediction validation set in this application;
[0025] Figure 5 This is the bar chart display of the water quality prediction results system in this application;
[0026] Figure 6 is a schematic diagram of the short-term water quality prediction system based on multi-feature training and meteorological correction in this application;
[0027] Figure 7 It is an accuracy evaluation chart of the prediction results of various water quality parameters in this application. DETAILED DESCRIPTION
[0028] The following describes embodiments of the present invention in detail, with examples of the embodiments illustrated in the accompanying drawings. Throughout, identical or similar reference numerals denote identical or similar elements or elements having identical or similar functions. Spatially related terms such as "upper," "lower," "front," "rear," "left," and "right" are used to facilitate description and explain the positional relationship between two components. The embodiments described below with reference to the accompanying drawings are illustrative and intended only to explain the present invention, and are not to be construed as limiting the present invention.
[0029] Example 1
[0030] like Figure 1 As shown, this application provides a short-term water quality prediction method based on multi-feature training and meteorological correction, including the following steps:
[0031] Step S1, collecting water quality parameter data and meteorological forecast data;
[0032] Automatic water quality monitoring stations are deployed near lakes, rivers and other water bodies. During the monitoring period, the current water quality parameter data is collected through the API interface of the water quality automatic monitoring station according to the predetermined collection strategy. The collected water quality parameter data include: water temperature (TEMP), dissolved oxygen (DO), turbidity (NTU), total nitrogen (TN), total phosphorus (TP), permanganate index (CODMn), ammonia nitrogen (NH3-N), etc.
[0033] At the same time, during the monitoring period, the Open-Meteo API is used to obtain meteorological forecast data such as future cumulative rainfall (TPS) according to the predetermined collection strategy. The Open-Meteo API is an open source and free weather API that provides high-precision hourly weather forecasts and historical data worldwide.
[0034] The collection strategy for collecting water quality parameter data and the collection strategy for collecting meteorological forecast data can be the same collection strategy, that is, the number of water quality parameter data collected within a monitoring period is the same as the number of meteorological forecast data collected; in addition, the collection strategy for collecting water quality parameter data and the collection strategy for collecting meteorological forecast data can be different collection strategies, that is, the number of water quality parameter data collected within a monitoring period is different from the number of meteorological forecast data collected.
[0035] Step S2: pre-processing the water quality parameter data collected during the monitoring period;
[0036] During the monitoring period, after collecting water quality parameter data according to the predetermined collection strategy, all water quality parameter data collected during the monitoring period are preprocessed to eliminate abnormal data and complete the missing data in the water quality parameter data to ensure the quality of the water quality parameter data.
[0037] Specifically, such as Figure 2 As shown in FIG, the water quality parameter data is preprocessed, including the following sub-steps:
[0038] Step S21: Detect and remove abnormal values from all water quality parameter data collected during the monitoring period;
[0039] First, at the end of the current monitoring period, all water quality parameter data of various types collected during the current monitoring period are sorted in ascending order according to the numerical value.
[0040] Then, the sorted water quality parameter data is divided into four equal parts, and the values of the three quantiles of the four equal parts are obtained. The positions of the three quantiles are obtained, the position of the first quantile is W1 = (n+1) × 0.25, the position of the second quantile is W2 = (n+1) × 0.5, and the position of the third quantile is W3 = (n+1) × 0.75, where n is the number of water quality parameter data collected during the monitoring period. Based on the positions of the three quantiles and the water quality parameter data related to the corresponding positions, the values of each quantile are determined: the value Q1 of the first quantile, the value Q2 of the second quantile, and the value Q3 of the third quantile.
[0041] Specifically, if the water quality parameter data at a quantile position is an integer, then the value of the water quality parameter data is the value of the quantile; if the water quality parameter data at a quantile position is not an integer, the integer part and the decimal part of the water quality parameter data are separated, the value of the integer part is recorded as a, the value of the decimal part is recorded as b, and the value of the water quality parameter data at the next position of the quantile is recorded as c, then a+(ca)×b is used as the value of the quantile.
[0042] Then, the dispersion of the water quality parameter data between the first and second quantiles is calculated based on the value Q3 of the third quantile and the value Q1 of the first quantile. Specifically, according to the formula IQR 13 =Q3-Q1, the dispersion of water quality parameter data between the first quantile and the third quantile (50%) is calculated.
[0043] Finally, based on the dispersion IQR of the water quality parameter data between the first quantile and the second quantile 13 As well as the numerical value Q1 of the first quantile and the numerical value Q3 of the third quantile, abnormal data in the sorted water quality parameter data are identified and eliminated.
[0044] Specifically, according to the following formula:
[0045] lower_bound = Q1 - 1.5 × IQR 13
[0046] upper_bound=Q3+1.5×IQR 13
[0047] The lowest abnormal boundary value lower_bound and the highest abnormal boundary value upper_bound are calculated, and the data in the sorted water quality parameter data that is less than the lowest abnormal boundary value lower_bound and greater than the highest abnormal boundary value upper_bound are regarded as abnormal data.
[0048] Step S22: Fill missing values in various water quality parameter data after removing abnormal data;
[0049] After removing abnormal data, each type of water quality parameter data is sorted according to the collection time, and then the moment of missing data in each type of water quality parameter data is identified, and the water quality parameter data at the moment before this moment is used to fill in the missing values to avoid the reduction of data volume caused by removing abnormal data.
[0050] Step S23: standardize the filled water quality parameter data to complete the preprocessing of the water quality parameter data;
[0051] After filling the missing values for each type of water quality parameter data, all water quality parameter data in the set of this type of water quality parameter data are traversed to obtain the minimum value of this type of water quality parameter data and the maximum value of this type of water quality parameter data, and based on the minimum value of this type of water quality parameter data and the maximum value of this type of water quality parameter data, each water quality parameter data of this type of water quality parameter data is standardized so that the water quality parameter data is within a predetermined range, which is conducive to the convergence of subsequent water quality index prediction model training.
[0052] Specifically, according to the following formula:
[0053]
[0054] Get the standardized value x of the jth water quality parameter data of the i-th category water quality parameter data ijnorm ; where x ij is the jth water quality parameter data of the i-th category water quality parameter data; x imin is the minimum value of the water quality parameter data of category i; x imax is the maximum value of the water quality parameter data of category i.
[0055] Step S3: input the collected meteorological forecast data and pre-processed water quality parameter data into a pre-trained water quality index prediction model for prediction;
[0056] After the current monitoring period ends, the meteorological forecast data and pre-processed water quality parameter data collected during the monitoring period are input into the trained water quality index prediction model to predict the water quality through the water quality index prediction model.
[0057] Among them, Figure 3 As shown in Figure 2, the construction and training of the water quality index prediction model includes the following sub-steps:
[0058] Step S31: constructing a neural network prediction model as a water quality index prediction model;
[0059] Construct a neural network prediction model as a water quality index prediction model. Specifically, the constructed water quality index prediction model is as follows:
[0060]
[0061] Among them, x ijnormt is the standardized value of the jth water quality parameter data of the i-th water quality parameter data at time t; J is the number of water quality parameter data in the i-th water quality parameter data; α i is the weight value corresponding to the i-th type of water quality parameter data; ρ t is the weight value corresponding to time t in the monitoring period; T is the duration of the monitoring period; y mTis the mth type of meteorological forecast data collected within the monitoring period T; μ m is the weight value corresponding to the mth type of weather forecast data; M is the number of types of weather forecast data; y zb It is the comprehensive standard value of meteorological forecast data; is the actual comprehensive value of the water quality parameter data of category i in the previous monitoring period T-1; β i1 is the influence weight of the actual comprehensive value of the water quality parameter data of category i in the previous monitoring period T-1 relative to the water quality parameter data; β i2 is the influence weight of the comprehensive value of the actual index of the i-th category water quality parameter data in the previous monitoring period T-1 relative to the meteorological forecast data; β i1 +β i2 =1; ω1 is the comprehensive impact weight of the actual index comprehensive value and water quality parameter data; ω2 is the comprehensive impact weight of the actual index comprehensive value and meteorological forecast data; It is the comprehensive value of the prediction index of the i-th type of water quality parameter data in the current monitoring period T.
[0062] Since the water quality indicator prediction model inputs not only water quality parameter data but also meteorological forecast data collected using the Open-Meteo API, the prediction results obtained by this water quality indicator prediction model are more accurate and reduce the error caused by the uncertainty of meteorological data.
[0063] Step S32: training a water quality index prediction model based on the meteorological forecast data, water quality parameter data, and actual index comprehensive values in the training set;
[0064] After the water quality indicator prediction model is constructed, it is trained. Since meteorological forecast data and water quality parameter data were collected at the previous historical moment, the actual water quality situation can be known at the next historical moment. Therefore, when training the water quality indicator prediction model, the meteorological forecast data and water quality parameter data for the corresponding monitoring period in the training set, as well as the actual indicator comprehensive values for the previous monitoring period, are used as the input of the water quality indicator prediction model. The actual indicator comprehensive values for the corresponding monitoring period in the training set are used as the output of the water quality indicator prediction model. The nonlinear relationship between the time evolution characteristics of the water quality indicators and multiple features is explored to train the water quality indicator prediction model. The actual indicator comprehensive values represent the actual water quality situation, and the predicted indicator comprehensive values represent the predicted water quality situation. For example, the actual indicator comprehensive values of the i-th category of water quality parameter data represent the actual water quality situation with respect to the i-th category of indicator, and the predicted indicator comprehensive values of the i-th category of water quality parameter data represent the predicted water quality situation with respect to the i-th category of indicator.
[0065] Step S33: Validate the trained water quality index prediction model using the meteorological forecast data, water quality parameter data, and actual index comprehensive values in the validation set;
[0066] After the water quality index prediction model is trained, the meteorological forecast data and water quality parameter data of the corresponding monitoring period in the validation set and the actual index comprehensive value of the previous monitoring period are used as the input of the trained water quality index prediction model to obtain the predicted index comprehensive value of the corresponding monitoring period. Then, the predicted index comprehensive value and the actual index comprehensive value of the corresponding monitoring period in the validation set are used for verification. Figure 4 It is a line graph of the accuracy evaluation of the water quality index prediction validation set in this application.
[0067] Specifically, the water quality index prediction model is verified by the following loss function:
[0068]
[0069] Among them, YZ iw is the loss value of the prediction result of the water quality parameter data of type i; is the actual comprehensive index value of the i-th type of water quality parameter data within the monitoring period T; σ is the adjustment value, which is a positive integer 1; K is the number of verification data groups.
[0070] Step S34: If the verification is passed, the training of the water quality index prediction model is completed, otherwise continue to step S32;
[0071] The loss value YZ after obtaining the prediction result of the water quality parameter data of type i iw After that, the loss value YZ of the prediction result of the i-th type water quality parameter data is iw Compare with the standard loss range. If the loss value YZ of the predicted result of the water quality parameter data of type i iw If the loss value is within the standard loss range, the verification is passed and the training of the water quality index prediction model is completed; if the loss value YZ iw If the loss exceeds the standard range, the verification fails and the process returns to step S32 to continue training the water quality index prediction model.
[0072] Step S4: Adjust the model prediction results based on the meteorological forecast data and the land type around the monitoring site;
[0073] Based on the meteorological forecast data during the monitoring period, the adjustment weights corresponding to the corresponding meteorological types (for example, high rainfall scenarios) are obtained. According to the different land types around the monitoring points (for example, land use types and distribution characteristics), the corresponding adjustment parameters are obtained. The prediction results of the water quality index prediction model are adjusted according to the adjustment weights and adjustment parameters to more accurately reflect the pollutant input and water quality change trends caused by rainfall.
[0074] Specifically, the prediction results are adjusted according to the following formula:
[0075]
[0076] in, for Adjustment value of τ y To adjust the weight; E r is the adjustment parameter corresponding to the rth land type around the monitoring point; δ r For E r The corresponding weight; is the proportion of land area corresponding to the rth land type around the monitoring point, R is the number of land types around the monitoring point.
[0077] Step S5: based on the adjusted values of the prediction results of different monitoring periods, draw a water quality change trend chart and display it;
[0078] After obtaining the adjusted values of the prediction results of different monitoring periods, these adjusted values are used to generate a continuous time series water quality change trend chart, such as Figure 5 As shown, it can provide accuracy evaluation indicators (such as RMSE, MAPE) and display the water quality trend chart on the display screen. In addition, it can also support the download function of the water quality trend chart for users to store and further analyze.
[0079] The above steps S1 to S5 in the first embodiment are all software programs executed by a computer.
[0080] Example 2
[0081] like Figure 6 As shown, the present application provides a short-term water quality prediction system 700 based on multi-feature training and meteorological correction, including: an acquisition unit 710, a preprocessing unit 720, a prediction unit 730, an adjustment unit 740, and a drawing and display unit 750.
[0082] The collection unit 710 is used to collect water quality parameter data and meteorological forecast data.
[0083] Automatic water quality monitoring stations are deployed near water bodies such as lakes and rivers. During the monitoring period, the collection unit 710 collects current water quality parameter data through the API interface of the automatic water quality monitoring station according to a predetermined collection strategy. The collected water quality parameter data include: water temperature (TEMP), dissolved oxygen (DO), turbidity (NTU), total nitrogen (TN), total phosphorus (TP), permanganate index (CODMn), ammonia nitrogen (NH3-N), etc.
[0084] At the same time, during the monitoring period, the collection unit 710 uses the Open-Meteo API to obtain meteorological forecast data such as future cumulative rainfall (TPS) according to a predetermined collection strategy. The Open-Meteo API is an open source and free weather API that provides high-precision hourly weather forecasts and historical data worldwide.
[0085] The collection strategy for collecting water quality parameter data and the collection strategy for collecting meteorological forecast data can be the same collection strategy, that is, the number of water quality parameter data collected within a monitoring period is the same as the number of meteorological forecast data collected; in addition, the collection strategy for collecting water quality parameter data and the collection strategy for collecting meteorological forecast data can be different collection strategies, that is, the number of water quality parameter data collected within a monitoring period is different from the number of meteorological forecast data collected.
[0086] The pre-processing unit 720 is used to pre-process the water quality parameter data collected during the monitoring period.
[0087] During the monitoring period, after collecting water quality parameter data according to a predetermined collection strategy, the preprocessing unit 720 performs preprocessing operations on all water quality parameter data collected during the monitoring period, eliminates abnormal data, and completes missing data in the water quality parameter data to ensure the quality of the water quality parameter data.
[0088] Specifically, the preprocessing unit 720 includes: a detection and elimination subunit 721 , a missing value filling subunit 722 and a standardization processing subunit 723 .
[0089] The detection and elimination subunit 721 is used to detect and eliminate abnormal values in all water quality parameter data collected during the monitoring period.
[0090] First, at the end of the current monitoring period, all water quality parameter data of various types collected during the current monitoring period are sorted in ascending order according to the numerical value.
[0091] Then, the sorted water quality parameter data is divided into four equal parts, and the values of the three quantiles of the four equal parts are obtained. The positions of the three quantiles are obtained, the position of the first quantile is W1 = (n+1) × 0.25, the position of the second quantile is W2 = (n+1) × 0.5, and the position of the third quantile is W3 = (n+1) × 0.75, where n is the number of water quality parameter data collected during the monitoring period. Based on the positions of the three quantiles and the water quality parameter data related to the corresponding positions, the values of each quantile are determined: the value Q1 of the first quantile, the value Q2 of the second quantile, and the value Q3 of the third quantile.
[0092] Specifically, if the water quality parameter data at a quantile position is an integer, then the value of the water quality parameter data is the value of the quantile; if the water quality parameter data at a quantile position is not an integer, the integer part and the decimal part of the water quality parameter data are separated, the value of the integer part is recorded as a, the value of the decimal part is recorded as b, and the value of the water quality parameter data at the next position of the quantile is recorded as c, then a+(ca)×b is used as the value of the quantile.
[0093] Then, the dispersion of the water quality parameter data between the first and second quantiles is calculated based on the value Q3 of the third quantile and the value Q1 of the first quantile. Specifically, according to the formula IQR 13 =Q3-Q1, the dispersion of water quality parameter data between the first quantile and the third quantile (50%) is calculated.
[0094] Finally, based on the dispersion IQR of the water quality parameter data between the first quantile and the second quantile 13 As well as the numerical value Q1 of the first quantile and the numerical value Q3 of the third quantile, the abnormal data in the sorted water quality parameter data are identified and eliminated.
[0095] Specifically, according to the following formula:
[0096] lower_bound = Q1 - 1.5 × IQR 13
[0097] upper_bound=Q3+1.5×IQR 13
[0098] The lowest abnormal boundary value lower_bound and the highest abnormal boundary value upper_bound are calculated, and the data in the sorted water quality parameter data that is less than the lowest abnormal boundary value lower_bound and greater than the highest abnormal boundary value upper_bound are regarded as abnormal data.
[0099] The missing value filling subunit 722 is used to fill missing values in various water quality parameter data after removing abnormal data.
[0100] After removing abnormal data, each type of water quality parameter data is sorted according to the collection time, and then the moment of missing data in each type of water quality parameter data is identified, and the water quality parameter data at the moment before this moment is used to fill in the missing values to avoid the reduction of data volume caused by removing abnormal data.
[0101] The standardization processing subunit 723 is used to perform standardization processing on the water quality parameter data to complete the preprocessing of the water quality parameter data.
[0102] After filling the missing values for each type of water quality parameter data, all water quality parameter data in the set of this type of water quality parameter data are traversed to obtain the minimum value of this type of water quality parameter data and the maximum value of this type of water quality parameter data, and based on the minimum value of this type of water quality parameter data and the maximum value of this type of water quality parameter data, each water quality parameter data of this type of water quality parameter data is standardized so that the water quality parameter data is within a predetermined range, which is conducive to the convergence of subsequent water quality index prediction model training.
[0103] Specifically, according to the following formula:
[0104]
[0105] Get the standardized value x of the jth water quality parameter data of the i-th category water quality parameter data ijnorm ; where x ij is the jth water quality parameter data of the i-th category water quality parameter data; x imin is the minimum value of the water quality parameter data of category i; x imax is the maximum value of the water quality parameter data of category i.
[0106] The prediction unit 730 is used to input the collected meteorological prediction data and pre-processed water quality parameter data into a pre-trained water quality index prediction model for prediction.
[0107] After the current monitoring period ends, the meteorological forecast data and pre-processed water quality parameter data collected during the monitoring period are input into the trained water quality index prediction model to predict the water quality through the water quality index prediction model.
[0108] The short-term water quality prediction system 700 further includes a model construction and training unit 760 ; the model construction and training unit 760 includes a construction subunit 761 , a training subunit 762 and a verification subunit 763 .
[0109] The construction subunit 761 is used to construct a neural network prediction model as a water quality index prediction model.
[0110] Construct a neural network prediction model as a water quality index prediction model. Specifically, the constructed water quality index prediction model is as follows:
[0111]
[0112] Among them, x ijnormt is the standardized value of the jth water quality parameter data of the i-th water quality parameter data at time t; J is the number of water quality parameter data in the i-th water quality parameter data; α i is the weight value corresponding to the i-th type of water quality parameter data; ρ tis the weight value corresponding to time t in the monitoring period; T is the duration of the monitoring period; y mT is the mth type of meteorological forecast data collected within the monitoring period T; μ m is the weight value corresponding to the mth type of weather forecast data; M is the number of types of weather forecast data; y zb It is the comprehensive standard value of meteorological forecast data; is the actual comprehensive value of the water quality parameter data of category i in the previous monitoring period T-1; β i1 is the influence weight of the actual comprehensive value of the water quality parameter data of category i in the previous monitoring period T-1 relative to the water quality parameter data; β i2 is the influence weight of the comprehensive value of the actual index of the i-th category water quality parameter data in the previous monitoring period T-1 relative to the meteorological forecast data; β i1 +β i2 =1; ω1 is the comprehensive impact weight of the actual index comprehensive value and water quality parameter data; ω2 is the comprehensive impact weight of the actual index comprehensive value and meteorological forecast data; It is the comprehensive value of the prediction index of the i-th type of water quality parameter data in the current monitoring period T.
[0113] Since the water quality indicator prediction model inputs not only water quality parameter data but also meteorological forecast data collected using the Open-Meteo API, the prediction results obtained by this water quality indicator prediction model are more accurate and reduce the error caused by the uncertainty of meteorological data.
[0114] The training subunit 762 performs model training based on the meteorological forecast data, water quality parameter data and actual index comprehensive values in the training set.
[0115] After the water quality indicator prediction model is constructed, it is trained. Since meteorological forecast data and water quality parameter data were collected at the previous historical moment, the actual water quality situation can be known at the next historical moment. Therefore, when training the water quality indicator prediction model, the meteorological forecast data and water quality parameter data for the corresponding monitoring period in the training set, as well as the actual indicator comprehensive values for the previous monitoring period, are used as the input of the water quality indicator prediction model. The actual indicator comprehensive values for the corresponding monitoring period in the training set are used as the output of the water quality indicator prediction model. The nonlinear relationship between the time evolution characteristics of the water quality indicators and multiple features is explored to train the water quality indicator prediction model. The actual indicator comprehensive values represent the actual water quality situation, and the predicted indicator comprehensive values represent the predicted water quality situation. For example, the actual indicator comprehensive values of the i-th category of water quality parameter data represent the actual water quality situation with respect to the i-th category of indicator, and the predicted indicator comprehensive values of the i-th category of water quality parameter data represent the predicted water quality situation with respect to the i-th category of indicator.
[0116] The verification subunit 763 verifies the trained model based on the meteorological forecast data, water quality parameter data and actual index comprehensive values in the verification set.
[0117] After the water quality index prediction model is trained, the meteorological forecast data and water quality parameter data of the corresponding monitoring period in the validation set and the actual index comprehensive value of the previous monitoring period are used as the input of the trained water quality index prediction model to obtain the predicted index comprehensive value of the corresponding monitoring period. Then, the predicted index comprehensive value and the actual index comprehensive value of the corresponding monitoring period in the validation set are used for verification. Figure 4 It is a line graph of the accuracy evaluation of the water quality index prediction validation set in this application.
[0118] Specifically, the water quality index prediction model is verified by the following loss function:
[0119]
[0120] Among them, YZ iw is the loss value of the prediction result of the water quality parameter data of type i; is the actual comprehensive index value of type i water quality parameter data within the monitoring period T; σ is the adjustment value, which is a positive integer 1; K is the number of verification data groups.
[0121] If the verification subunit 763 passes the verification, the training of the water quality index prediction model is completed, otherwise the training subunit 762 continues the training.
[0122] The loss value YZ after obtaining the prediction result of the water quality parameter data of type i iw Then, the loss value YZ predicted by the i-th type water quality parameter data is iw Compare with the standard loss range. If the loss value YZ predicted by the water quality parameter data of type i iw If the loss value is within the standard loss range, the verification is passed and the training of the water quality index prediction model is completed; if the loss value YZ iw If the loss exceeds the standard range, the verification fails and the training subunit 762 continues to train the water quality index prediction model.
[0123] The adjustment unit 740 is used to adjust the prediction result according to the meteorological prediction data and the land type around the monitoring site.
[0124] Based on the meteorological forecast data during the monitoring period, the adjustment weights corresponding to the corresponding meteorological types (for example, high rainfall scenarios) are obtained. According to the different land types around the monitoring points (for example, land use types and distribution characteristics), the corresponding adjustment parameters are obtained. The prediction results of the water quality index prediction model are adjusted according to the adjustment weights and adjustment parameters to more accurately reflect the pollutant input and water quality change trends caused by rainfall.
[0125] Specifically, the prediction results are adjusted according to the following formula:
[0126]
[0127] in, for Adjustment value of τ y To adjust the weight; E r is the adjustment parameter corresponding to the rth land type around the monitoring point; δ r For E r The corresponding weight; is the proportion of land area corresponding to the rth land type around the monitoring point, R is the number of land types around the monitoring point.
[0128] The drawing and display unit 750 is used to draw and display a water quality change trend chart based on the adjustment values of the prediction results of different monitoring cycles.
[0129] After obtaining the adjusted values of the prediction results of different monitoring periods, these adjusted values are used to generate a continuous time series water quality change trend chart, such as Figure 5 It can also provide accuracy evaluation indicators (such as RMSE, MAPE) and display the water quality trend chart on the display screen. In addition, it can also support the download function of the water quality trend chart for users to store and further analyze.
[0130] The acquisition unit 710 , pre-processing unit 720 , prediction unit 730 , adjustment unit 740 , rendering and display unit 750 , and model building and training unit 760 in the second embodiment are all computer modules.
[0131] In order to verify the accuracy of the short-term water quality prediction method and system based on multi-feature training and meteorological correction described in this application, relevant data comparison is performed below.
[0132] Combine Figure 7 As shown, Figure 7 The accuracy evaluation chart for the prediction results (combined values of prediction indicators) of various water quality parameters is displayed. Based on the accuracy evaluation results of the water quality indicator prediction model proposed in this application, the water quality prediction results of the Weicun automatic water quality monitoring station from June 1 to June 10, 2024, were used as an example. By comparing the various measured values corresponding to the actual water quality indicators with the predicted values, the root mean square error (RMSE) and mean absolute percentage error (MAPE) were calculated.
[0133] The results demonstrate that the proposed water quality indicator prediction model has high prediction accuracy. Specifically, the RMSE for DO prediction is 0.081, and the MAPE is 1.02%; the RMSE for TP prediction is 0.0017, and the MAPE is 1.95%; the RMSE for TN prediction is 0.101, and the MAPE is 4.53%; and the RMSE for CODMn prediction is 0.178, and the MAPE is 8.72%. These data demonstrate that the proposed water quality indicator prediction model exhibits good fitting and reliability in predicting different water quality conditions, accurately reflects actual water quality trends, and is suitable for online water quality monitoring and management.
[0134] This application has at least the following beneficial effects:
[0135] This application utilizes water quality parameter data collected by automatic water quality monitoring stations and open source meteorological forecast data to construct an efficient short-term water quality parameter prediction model, fully exploring the nonlinear relationship and spatiotemporal dependence between water quality parameter data and meteorological forecast data, and can dynamically predict the water quality of lakes, rivers and other water bodies, significantly improving the accuracy and stability of water quality prediction. Especially under special meteorological conditions such as extreme rainfall, this application can effectively correct the prediction results and reduce the impact of uncertainty on prediction performance.
[0136] In addition, the prediction results generated by this application can be displayed intuitively in the form of charts and graphs, and support data download function, providing an efficient decision-making support tool for the scientific deployment of water pollution prevention and control measures and water ecological protection.
[0137] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
[0138] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.
Claims
1. A short-term water quality prediction method based on multi-feature training and meteorological correction, characterized in that: The steps include: Step S1, collecting water quality parameter data and meteorological forecast data; Step S2: pre-processing the water quality parameter data collected during the monitoring period; The preprocessing of the water quality parameter data includes the following sub-steps: Step S21: Detect and remove abnormal values from all water quality parameter data collected during the monitoring period; Step S22: Fill missing values in various water quality parameter data after removing abnormal data; Step S23: standardize the filled water quality parameter data to complete the preprocessing of the water quality parameter data; Step S3: input the collected meteorological forecast data and pre-processed water quality parameter data into a pre-trained water quality index prediction model for prediction; Step S4: Adjust the model prediction results based on the meteorological forecast data and the land type around the monitoring site; Step S5: Based on the adjusted values of the prediction results of different monitoring periods, a water quality change trend chart is drawn and displayed.
2. The short-term water quality prediction method based on multi-feature training and meteorological correction according to claim 1 is characterized in that: Outlier detection and removal includes the following sub-steps: At the end of the current monitoring period, the collected water quality parameter data are sorted from smallest to largest; Divide the sorting results into four equal parts and obtain three quantile values; Calculate the dispersion based on the data between the first and third quantiles; Abnormal data are identified based on the dispersion and quantile values and are eliminated.
3. The short-term water quality prediction method based on multi-feature training and meteorological correction according to claim 1 or 2, characterized in that: The construction and training of the water quality index prediction model includes the following sub-steps: Step S31: constructing a neural network prediction model as a water quality index prediction model; Step S32: training a water quality index prediction model based on the meteorological forecast data, water quality parameter data, and actual index comprehensive values in the training set; Step S33: verifying the trained water quality index prediction model based on the meteorological forecast data, water quality parameter data and actual index comprehensive values in the verification set; Step S34: If the verification is passed, the training of the water quality index prediction model is completed, otherwise continue with step S32.
4. The short-term water quality prediction method based on multi-feature training and meteorological correction according to claim 3 is characterized in that: Calculate the loss value of the predicted results of water quality parameter data and compare it with the standard loss range; If the loss value of the water quality parameter data prediction result is within the standard loss range, the verification is passed and the training of the water quality index prediction model is completed. Otherwise, the verification fails and the process returns to step S32 to continue training the water quality index prediction model.
5. A short-term water quality prediction system based on multi-feature training and meteorological correction, characterized by: include: Acquisition unit, pre-processing unit, prediction unit, adjustment unit, and rendering and display unit; The acquisition unit is used to collect water quality parameter data and meteorological forecast data; The pre-processing unit is used to pre-process the water quality parameter data collected during the monitoring period; The pre-processing unit includes: a detection and elimination sub-unit, a missing value filling sub-unit and a standardization processing sub-unit; The detection and elimination subunit is used to detect and eliminate abnormal values in all water quality parameter data collected during the monitoring period; The missing value filling subunit is used to fill missing values in various water quality parameter data after removing abnormal data; The standardization processing subunit is used to perform standardization processing on the filled water quality parameter data to complete the preprocessing of the water quality parameter data; The prediction unit is used to input the collected meteorological prediction data and the pre-processed water quality parameter data into a pre-trained water quality index prediction model for prediction; The adjustment unit is used to adjust the prediction result according to the meteorological prediction data and the land type around the monitoring site; The drawing and display unit is used to draw and display a water quality change trend chart based on the adjustment values of the prediction results of different monitoring cycles.
6. The short-term water quality prediction system based on multi-feature training and meteorological correction according to claim 5 is characterized in that: At the end of the current monitoring cycle, the detection and elimination subunit sorts the collected water quality parameter data in ascending order of value; The detection and elimination subunit divides the sorting results into four equal parts and obtains three quantile values; The detection and elimination subunit calculates the dispersion based on the data of the first and third quantiles; The detection and elimination subunit identifies abnormal data based on the discreteness calculated by the water data at the first and third quantiles, as well as the quantile values, and eliminates them.
7. The short-term water quality prediction system based on multi-feature training and meteorological correction according to claim 5 or 6, characterized in that: Also included is a model building training unit, the unit comprising: Constructing subunits for building neural network prediction models; The training subunit conducts model training based on the meteorological forecast data, water quality parameter data and actual index comprehensive values in the training set; The verification subunit verifies the model based on the meteorological forecast data, water quality parameter data and actual index comprehensive values in the verification set; If the verification subunit passes the verification, the training of the water quality index prediction model is completed, otherwise the training subunit continues the training.
8. The short-term water quality prediction system based on multi-feature training and meteorological correction according to claim 7 is characterized in that: The verification subunit calculates the loss value of the water quality parameter data prediction result and compares it with the standard loss range. If the loss value of the water quality parameter data prediction result is within the standard loss range, the verification is passed and the training of the water quality index prediction model is completed; Otherwise, if the verification fails, the training subunit continues to train the water quality index prediction model.
Citation Information
Patent Citations
River water quality prediction method based on feature engineering
CN114330904A
Water quality detection method and system
CN119046750A
Apparatus and method for prediction of influent flow rate and influent components using artificial neural network
KR1020090078501A
Natural-fission-based multi-disaster fusion early warning method and system for coal mine
WO2024222460A1
Cited By
Self-adaptive correction prediction method and system for surface water environment monitoring data abnormity
CN121117878A
A self-adaptive correction and prediction method and system for surface water environmental monitoring data anomaly
CN121117878B