Water quality index multi-model short-term prediction method and system
By combining local linear regression model, dynamic linear model and simple exponential smoothing model to pretreat and weighted fusion of water quality indicators, the real-time and accuracy of water quality monitoring in aquaculture is solved, and fast and accurate short-term prediction is achieved.
Patent Information
- Application Number
- CN202510413281.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-22
AI Technical Summary
The existing technology water quality monitoring methods in aquaculture have long monitoring cycles, high cost and poor real-time performance, which are difficult to meet the efficient and precise management needs of modern aquaculture. The existing models have poor prediction results in complex and variability environments.
The local linear regression model, dynamic linear model and simple exponential smoothing model are used to pre-process the time series data of water quality indexes, and short-term predicted values are obtained through weighted fusion. The Savitzky-Golay filter is used for smoothing, and the model parameters are adjusted in combination with the grid search method, and the linear regression is used to minimize the loss function to optimize the weight.
It improves the accuracy and adaptability of water quality indicator prediction, can be quickly deployed on end-side equipment, reduces computing resource requirements, and adapts to real-time changes in the aquaculture environment.
Smart Images

Figure CN120355007A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of aquaculture water quality monitoring, and more specifically, to a multi-model short-term prediction method and system for water quality indicators. Background Art
[0002] Aquaculture, as an important part of the global food supply chain, water quality regulation is crucial for ensuring the healthy growth of cultured organisms and the sustainable development of the aquaculture industry.
[0003] During the aquaculture process, water quality indicators are important factors affecting the quality of aquatic products and the aquaculture environment. Traditional aquaculture environment monitoring methods have problems such as long monitoring cycles, high costs, and poor real-time performance, and cannot meet the requirements of efficient and precise management in modern aquaculture.
[0004] With the development of computer technology, some prediction methods based on mathematical models have gradually been applied to the aquaculture field. However, these methods usually rely on the quality of historical water quality parameter data and the complexity of the growth models of cultured organisms; for example, although the ARIMA model is widely used in time series prediction, it requires a large amount of data for fitting, and the tuning process is complex, making it difficult to adapt to the real-time changes in the aquaculture environment; deep learning methods such as LSTM and GRU have high prediction accuracy, but their network structures are complex, and the training process requires a large amount of computing resources, making it difficult to be quickly deployed in actual production.
[0005] In practical applications, due to the complexity and variability of the aquaculture environment, the prediction effects of these models are often not satisfactory.
[0006] Therefore, developing a method that can accurately and quickly predict water quality indicators during the aquaculture process is of great significance for improving the aquaculture success rate. Summary of the Invention
[0007] In view of this, the present invention provides a multi-model short-term prediction method and system for water quality indicators, aiming to have the ability to short-term predict future changes only by using the historical data of water quality indicators themselves as input, and can improve the prediction accuracy and adaptability.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] In the first aspect, the present application provides a multi-model short-term prediction method for water quality indicators, and the steps include:
[0010] Obtain the time series data of water quality indicators and preprocess it;
[0011] Input the preprocessed data into multiple models respectively for prediction;
[0012] Perform weighted fusion on the prediction results to obtain short-term prediction values.
[0013] Preferably, the preprocessing includes:
[0014] Filling missing values and outliers based on the mean of adjacent front and rear data;
[0015] And smoothing the filled dataset using a Savitzky-Golay filter.
[0016] Preferably, the multiple models include a locally linear regression model, a dynamic linear model, and a simple exponential smoothing model.
[0017] Preferably, the kernel width of the locally linear regression model, the discount coefficient and weight of the second-order trend component in the dynamic linear model are adjusted by a grid search method.
[0018] Preferably, the average value of the coefficient of determination, root mean square error, and mean absolute error is calculated based on each prediction result, and adjustment is made according to the average value of the coefficient of determination, root mean square error, and mean absolute error.
[0019] Preferably, minimum value suppression is performed on the multiple models, including correcting the prediction values of each model below the threshold to the current threshold according to a preset detection lower limit threshold, so as to avoid the prediction values being too low and exceeding the detection range of the actual monitoring device or not conforming to the physical constraints of the actual application scenario.
[0020] Preferably, the weighted weights are optimized using linear regression to minimize the loss function.
[0021] In a second aspect, the present application also provides a multi-model short-term prediction system for water quality indicators, and the system includes:
[0022] A water quality indicator time series preprocessing unit for preprocessing water quality indicator time series data;
[0023] A multi-model prediction unit for making predictions using multiple models based on the preprocessed data;
[0024] A prediction result fusion unit for performing weighted fusion on multiple prediction results to obtain short-term prediction values.
[0025] Preferably, it further includes a multi-model tuning unit for adjusting the kernel width of the locally linear regression model, the discount coefficient and weight of the second-order trend component in the dynamic linear model by a grid search method.
[0026] Preferably, it further includes a weighted weight optimization unit for optimizing the weighted weights using linear regression to minimize the loss function.
[0027] The present invention discloses a multi-model short-term prediction method and system for water quality indicators. Compared with the prior art, the advantages are as follows:
[0028] 1. By combining three time series predictors, namely LWLR, DLM, and ESE, and making full use of their respective advantages, the prediction accuracy and stability are improved;
[0029] 2. A weighted summation strategy is adopted to dynamically adjust the weights according to the model prediction performance and correlation, enhancing the adaptability and robustness of the model;
[0030] 3. Linear fitting is used to automatically optimize the weights without additional manual parameter adjustment, improving the accuracy and reliability of the weights;
[0031] 4. As long as the length of the input time series is greater than 2, the predicted value can be obtained, which occupies very little computing resources and can be quickly deployed on the edge side;
[0032] 5. The present invention can be widely applied to the fields of water environment protection and treatment, providing strong support for water quality monitoring and early warning. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.
[0034] Figure 1 It is a flowchart of the multi-model short-term prediction method for water quality indicators provided by the present invention;
[0035] Figure 2 It is a fitting curve graph when predicting the nitrite content;
[0036] Figure 3 It is a fitting curve graph when predicting the ammonia nitrogen content. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0037] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0038] Embodiment 1
[0039] The embodiment of the present invention discloses a multi-model short-term prediction method for water quality indicators based on a local linear regression model (LWLR), a dynamic linear model (DLM) and a simple exponential smoothing model (ESE), wherein the water quality indicators include ammonia nitrogen or nitrite concentrations in water bodies.
[0040] Figure 1 This is a flow chart of the prediction method for this application, and the specific steps include:
[0041] 1. Obtain and preprocess the time series data of water quality indicators;
[0042] In this application, the time series data of water quality indicators are continuous in time without breakpoints, the sequence length is greater than 2, and there is no abnormal and severe jitter phenomenon.
[0043] Meanwhile, the preprocessing steps include:
[0044] Fill missing values and outliers based on the mean of the adjacent data before and after;
[0045] And use Savitzky-Golay filter to smooth the padded data set.
[0046] 2. Input the preprocessed data into multiple models for prediction;
[0047] In this embodiment, the multiple models include a local linear regression model (LWLR), a dynamic linear model (DLM) and a simple exponential smoothing model (ESE).
[0048] After constructing the three time series prediction models of LWLR, DLM, and ESE, this application uses the grid search method to fine-tune the hyperparameters of the LWLR and DLM models. Among them, the LWLR sub-model adjusts the kernel width by setting the grid search interval to 0.1-0.9 and the search step to 0.1, so that the prediction performance of the model on the data set is optimal;
[0049] The DLM sub-model optimizes model performance by setting the discount coefficient range of the second-order trend component to 0.1-0.9, the search step to 0.1, and the weight search range of the second-order trend component to 0.5-1.5, and the search step to 0.1.
[0050] In some embodiments, the discount coefficient of the DLM model is set to 0.4, and the weight is set to 1; the kernel width of the LWLR is set to 0.6, and DLM and ESE are automatically tuned using a third-party library in python.
[0051] Furthermore, in this embodiment, the basis for model adjustment is the determination coefficient (R 2) Root Mean Square Error (RMSE) and Mean Absolute Error (MAE) metrics. Specifically, the rolling calculation method is used, that is, the data of the 1st day and the 2nd day are used to predict the data of the 3rd day, the data of the 1st day to the 3rd day are used to predict the data of the 4th day, the data of the 1st to 4th days are used to predict the data of the 5th day, and so on. Finally, the coefficient of determination, root mean square error, and mean absolute error of a time series are calculated based on the corresponding predicted values and true values. Then, according to this method, the coefficient of determination, root mean square error, and mean absolute error of all time series in the training set are calculated, and then the average is taken as the final evaluation parameter of a model in the training set.
[0052] To further improve the output stability of the model, minimum value suppression is performed on the outputs of each model to meet the detection lower limit of the water quality monitoring equipment. In this embodiment, the steps include:
[0053] Set the detection lower limit threshold: According to the actual detection ability of the water quality monitoring equipment (such as the instrument detection lower limit is 0.05 mg / L), the threshold is set to 0.05;
[0054] Traverse the model prediction results: Check the output values of each model. If the predicted value of a certain model is lower than the threshold, then correct this value to the threshold;
[0055] Output the corrected results: Input the corrected predicted values of each model into the weighted fusion unit to generate the final predicted value.
[0056] Example: Assume that the predicted values of three models are 0.03, 0.06, and 0.04 respectively, and the detection lower limit threshold is 0.05. After minimum value suppression, the corrected values are 0.05, 0.06, and 0.05, and then the final predicted value is obtained by weighted fusion.
[0057] Third, perform weighted fusion on the prediction results to obtain the short-term predicted value.
[0058] In this embodiment, the weighted fusion formula is:
[0059]
[0060] Among them, X i represents the output of the i-th model, W i represents the weight of the i-th model, represents the final predicted value after weighted summation.
[0061] Furthermore, the weighted weights are optimized by minimizing the loss function using linear regression, that is, based on historical data and prediction results, a linear fitting model is established to optimize and adjust the weights to improve the prediction performance. The loss function is expressed as follows:
[0062]
[0063] Example 2
[0064] This embodiment correspondingly provides a multi-model short-term prediction system for water quality indicators, which includes:
[0065] A water quality indicator time series preprocessing unit for preprocessing water quality indicator time series data;
[0066] A multi-model prediction unit for making predictions using multiple models based on the preprocessed data;
[0067] A prediction result fusion unit for weighted fusion of multiple prediction results to obtain short-term prediction values.
[0068] Preferably, it further includes:
[0069] A multi-model tuning unit for adjusting the kernel width of the locally linear regression model, the discount coefficient and weight of the second-order trend component in the dynamic linear model through the grid search method.
[0070] A weighted weight optimization unit for optimizing the weighted weights by minimizing the loss function using linear regression.
[0071] In one embodiment, the water quality indicator content data during the aquaculture process is collected, 10 time series data sets are constructed, and the time series data sets are divided into a training set and a test set according to a ratio of 5:5.
[0072] Further, the three sub-models and the fusion model are respectively evaluated based on the training set, and the evaluation results are as follows in the table:
[0073] Model R2 MSE MAE LWLR-ESE-DLM 0.9534 0.0174 0.0733 LWLR 0.7833 0.0854 0.1202 DLM 0.9186 0.0314 0.2003 ESE 0.8908 0.0322 0.0836
[0074] It can be seen from the table that the fusion model constructed in this application absorbs the advantages of each model and the accuracy is greatly improved.
[0075] In one embodiment, taking the prediction of nitrite content as an example:
[0076] The daily change data of nitrite content during the cultivation of Litopenaeus vannamei in a certain place in Guangdong from 2023 to 2024 is collected, and a time series data set is constructed. The data set is as follows:
[0077]
[0078] After preprocessing the above data, the fusion model is used to output the predicted values of nitrite content for the next 1 day or 2 days. Specifically, the predicted nitrite content on the 45th day (next 1 day) is 0.24 mg / L, and the fitting curve is as Figure 2 shown.
[0079] In one embodiment, taking the prediction of ammonia nitrogen content in water as an example, the daily change data of ammonia nitrogen content during the culture process of mandarin fish is collected to construct a time series data set, and the data set is as follows:
[0080] Number of days Ammonia nitrogen content Number of days Ammonia nitrogen content Number of days Ammonia nitrogen content Number of days Ammonia nitrogen content 0 0.24 9 0.25 18 0.35 27 0.83 1 0.23 10 0.25 19 0.24 28 0.77 2 0.42 1 1 0.33 20 0.29 29 0.77 3 0.32 12 0.35 21 0.58 30 0.69 4 0.32 13 0.37 22 0.7 5 0.31 14 0.34 23 0.75 6 0.19 15 0.33 24 0.8 7 0.31 16 0.39 25 0.79 8 0.25 17 0.22 26 0.74
[0081] After preprocessing, the ammonia nitrogen data on the 31st day (1 day in the future) is predicted by the fusion model, that is, 0.68 mg / L, and the fitting curve is as Figure 3 shown.
[0082] As can be seen from Figure 2 and Figure 3 , the method of the present invention has high prediction accuracy and reliability when predicting ammonia nitrogen and nitrite content in the short term, and is not affected by the length of the time series.
[0083] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same and similar parts between the various embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference can be made to the description in the method part for the relevant parts.
[0084] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A multi-model short-term prediction method for water quality indicators, characterized in that Including: Obtain the time series data of water quality indicators and preprocess it; Input the preprocessed data into multiple models respectively for prediction; Perform weighted fusion on the prediction results to obtain the short-term prediction value.
2. The short-term prediction method for multiple models of water quality indicators according to claim 1, wherein The preprocessing includes: Fill in the missing values and outliers based on the mean of adjacent data before and after; And use the Savitzky-Golay filter to smooth the filled data set.
3. The short-term prediction method for multiple models of water quality indicators according to claim 1, characterized in that The multiple models include the local linear regression model, the dynamic linear model and the simple exponential smoothing model.
4. The short-term prediction method for multiple models of water quality indicators according to claim 3, characterized in that Adjust the kernel width of the local linear regression model, the discount coefficient and weight of the second-order trend component in the dynamic linear model through the grid search method.
5. The short-term prediction method for multiple models of water quality indicators according to claim 4, characterized in that, Calculate the average value of the coefficient of determination, root mean square error and mean absolute error according to each prediction result, and adjust according to the average value of the coefficient of determination, root mean square error and mean absolute error.
6. The short-term prediction method for multiple models of water quality indicators according to claim 1, characterized in that Perform minimum value suppression on multiple models.
7. The short-term multi-model prediction method for water quality indicators according to claim 1, characterized in that Optimize the weighted weights by minimizing the loss function using linear regression.
8. A multi-model short-term prediction system for water quality indicators, characterized in that, Including: The water quality indicator time series preprocessing unit is used to preprocess the water quality indicator time series data; The multi-model prediction unit is used to perform predictions using multiple models according to the preprocessed data; The prediction result fusion unit is used to perform weighted fusion on multiple prediction results to obtain the short-term prediction value.
9. The water quality index multi-model short-term prediction system according to claim 8, characterized in that It also includes a multi-model tuning unit for adjusting the kernel width of the local linear regression model, the discount coefficient and weight of the second-order trend component in the dynamic linear model through the grid search method.
10. The water quality index multi-model short-term prediction system according to claim 8, wherein It also includes a weighted weight optimization unit for optimizing the weighted weights by minimizing the loss function using linear regression.
Citation Information
Cited By
Rapid detection method and system for water activity
CN120630281A