Water quality prediction method and system in combination with time-frequency characteristics and deep margin learning network

Through the combination of variable mode decomposition and deep margin learning network, the problems of multi-scale feature extraction and fusion in water quality prediction are solved, and a higher precision water quality prediction effect is achieved.

CN120509529APending Publication Date: 2025-08-19GUANGDONG LABORATORY OF SOUTHERN OCEAN SCIENCE AND ENGINEERING (GUANGZHOU)

Patent Information

Application Number
CN202510608724.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

Existing deep learning models have problems such as multi-scale feature extraction complexity and insufficient fusion of cross-scale feature in water quality prediction, resulting in the key trend information being flooded with noise and limited prediction accuracy.

Method used

The variable mode decomposition algorithm is used to decompose the time series signals of hydrological and water quality indexes into multi-band IMF components, and a deep margin learning network based on iTransformer is built to learn the change laws of each IMF component layer by layer, and the under-extracted feature information is transmitted through margin learning, and the water quality prediction results are finally output.

Benefits of technology

It improves the accuracy and robustness of water quality prediction, can effectively separate multi-scale features, integrate global and local interaction processes, suppress high-frequency noise, and improve prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509529A_ABST
    Figure CN120509529A_ABST
Patent Text Reader

Abstract

The invention discloses a water quality prediction method and system combining time-frequency characteristics and a depth margin learning network, and the method comprises the steps: monitoring and obtaining original hydrology and water quality index time sequence data, and carrying out the preprocessing; decomposing the hydrological and water quality index time sequence signal into a multi-band IMF component based on a variable mode decomposition algorithm; the method comprises the following steps: constructing and training a depth allowance learning network model based on iTransform, inputting IMF components into the depth allowance learning network in sequence from low frequency to high frequency, learning a change rule in each IMF layer by layer from low frequency to high frequency, and transmitting feature information which is not fully extracted in each layer to a next layer through allowance learning to continue learning, and finally outputting to obtain a water quality prediction result in future time. According to the method, the defects of an existing method in the aspects of key feature extraction and cross-scale feature fusion are overcome, and a new technical path is provided for accurate prediction of complex water quality data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water quality prediction, and in particular to a water quality prediction method and system combining time-frequency features with a deep margin learning network. Background Art

[0002] Water resources are a key element supporting ecological security and social development. Accurate river water quality prediction is crucial for water resource protection. Previous studies have used various prediction models to predict key water quality parameters for pollution early warning and ecological risk assessment. Deep learning models, with their powerful feature extraction capabilities, have demonstrated significant advantages. However, hydrological systems are influenced by multiple factors, including natural processes, seasonal variations, and human activities. Furthermore, noise interference introduced by emergencies or monitoring errors can lead to a mixture of multiscale signals and noise in water quality data, complicating feature extraction. Furthermore, single deep learning models have limitations in integrating cross-scale features, limiting their ability to capture diverse water quality evolution patterns. Therefore, effectively separating multiscale features from water quality time series data, integrating the global and local interactions of these multiscale features, and suppressing high-frequency noise have become key to improving water quality prediction accuracy. In recent years, methods combining modal decomposition techniques with deep learning models have begun to be applied to water quality prediction. However, most existing methods adopt a simple "decomposition-prediction-reconstruction" paradigm, which fails to fully consider the interaction process of the frequency band characteristics of each IMF component and the differences in their contributions to the final prediction, resulting in key trend information being submerged by noise, thereby limiting the improvement of prediction accuracy. Summary of the Invention

[0003] The present invention provides a water quality prediction method and system that combines time-frequency features with a deep margin learning network to solve the above technical problems existing in the existing water quality prediction methods based on deep learning models.

[0004] According to the first aspect, an embodiment provides a water quality prediction method combining time-frequency features with a deep margin learning network, the method comprising:

[0005] Monitor and obtain original hydrological and water quality index time series data and perform preprocessing;

[0006] Based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components;

[0007] A deep residual learning network model based on iTransformer is constructed and trained. The IMF components are input into the deep residual learning network in sequence from low to high frequency. The change pattern of each IMF is learned layer by layer from low frequency to high frequency. At the same time, the feature information that is not fully extracted in each layer is passed to the next layer for further learning through residual learning, and the final output is the water quality prediction result for the future time.

[0008] Furthermore, the original hydrological and water quality index time series data are monitored and pre-processed, including:

[0009] The monitored hydrological and water quality index data include total phosphorus TP, total nitrogen TN, permanganate index COD Mn , ammonia nitrogen NH3-N, dissolved oxygen DO, electrical conductivity EC, pH, water temperature WT, turbidity TB and rainfall PCP;

[0010] The monitoring data were cleaned and standardized, including first using the box plot method to identify outliers, and then using the piecewise cubic Hermite interpolation method to fill in outliers and missing data values; and using the z-score standardization method to transform the data into a standard normal distribution according to the mean and standard deviation.

[0011] Furthermore, the method further comprises:

[0012] Key water quality indicators were selected as target variables for water quality prediction, including dissolved oxygen (DO) and total nitrogen (TN);

[0013] The Pearson correlation coefficient and heat map method were used to analyze and verify the correlation distribution between key water quality indicators and other indicator variables in each IMF frequency band.

[0014] Furthermore, based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components, including:

[0015] In the signal decomposition process, the number of modes is first set and the modal components and center frequencies are initialized. Frequency modulation is used to separate the frequency band areas of different modes. Then, a constrained variational model is constructed with the goal of minimizing the bandwidth of each mode, thereby converting the decomposition problem of water quality time series data into a variational model for solution.

[0016] Furthermore, based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components, including:

[0017] In order to find the optimal solution to the problem, the Lagrange multiplier method is introduced to transform the constrained optimization problem into an unconstrained problem; the alternating direction multiplier method is used to repeatedly iteratively optimize and determine the modal components of the time series and their central frequencies.

[0018] Furthermore, we build and train a deep residual learning network model based on iTransformer, specifically including:

[0019] The iTransformer-based deep residual learning network model includes a multi-layer encoding module, an iTransformer module, a residual learning module, and a linear mapping module;

[0020] The multi-layer encoding module is used to perform inverse encoding on each input IMF component, and the encoding results are used as input to each layer of iTransformer units;

[0021] The iTransformer module includes multiple layers of parallel iTransformer units. Each layer of iTransformer units is used to first map the input to query Q, key K and value V through linear transformation, then calculate the correlation of each water quality variable within the time span through a multi-head self-attention mechanism, then use layer normalization technology to smooth the attention output, and decode it into the predicted target representation through a feedforward neural network, and finally obtain the output of each layer through re-normalization.

[0022] The residual learning module is used to copy the output of each layer of iTransformer unit into two copies. One copy is mapped to the prediction target dimension through the linear mapping module, and the other copy is subtracted from the corresponding input IMF component to obtain the learning residual. The learning residual captures the feature information that is not fully modeled in the IMF component of the current layer input and is passed to the next layer of iTransformer unit for further extraction and optimization.

[0023] Finally, the outputs of each layer are integrated to obtain the water quality prediction results for the future time.

[0024] Furthermore, we build and train a deep residual learning network model based on iTransformer, specifically including:

[0025] Construct training and test sets, and train and test the iTransformer-based deep residual learning network model;

[0026] The model performance is evaluated using evaluation indicators including root mean square error (RMSE), mean absolute error (MAE) and symmetric mean absolute percentage error (SMAPE).

[0027] Furthermore, we build and train a deep residual learning network model based on iTransformer, specifically including:

[0028] The small batch gradient descent algorithm is used for parameter optimization, and the batch size, training cycle and learning rate are set. The Adam algorithm is used as the optimizer, and the MSE loss function is used.

[0029] According to the second aspect, an embodiment provides a water quality prediction system combining time-frequency features and a deep margin learning network, the system comprising:

[0030] Data acquisition and preprocessing module, used to monitor and obtain original hydrological and water quality index time series data and perform preprocessing;

[0031] VMD decomposition module, used to decompose the time series signals of hydrological and water quality indicators into multi-band IMF components based on variable mode decomposition algorithm;

[0032] The water quality prediction module is used to build and train a deep residual learning network model based on iTransformer. Each IMF component is input into the deep residual learning network in order from low to high frequency, and the change pattern of each IMF is learned layer by layer from low frequency to high frequency. At the same time, through residual learning, the feature information that has not been fully extracted in each layer is passed to the next layer for further learning, and finally the water quality prediction result for the future time is output.

[0033] According to a third aspect, an embodiment provides an electronic device, the device comprising: a processor and a memory;

[0034] The memory is used to store one or more program instructions;

[0035] The processor is used to run one or more program instructions to execute the steps of a water quality prediction method combining time-frequency features and a deep margin learning network as described in any of the above items.

[0036] According to the fourth aspect, an embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a water quality prediction method combining time-frequency features and a deep margin learning network as described in any one of the above items are implemented.

[0037] The present invention provides a water quality prediction method and system that combines time-frequency features with a deep residual learning network. The system monitors and obtains original hydrological and water quality indicator time series data and performs preprocessing. The hydrological and water quality indicator time series signals are decomposed into multi-band IMF components based on the variable mode decomposition algorithm. A deep residual learning network model based on iTransformer is constructed and trained. Each IMF component is input into the deep residual learning network in order from low to high frequency. The changing patterns in each IMF are learned layer by layer from low frequency to high frequency. At the same time, the feature information that is not fully extracted in each layer is passed to the next layer for further learning through residual learning, and the final output is the water quality prediction result for the future time. The method of the present invention solves the shortcomings of existing methods in key feature extraction and cross-scale feature fusion, and provides a new technical path for the accurate prediction of complex water quality data. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A flow chart of a water quality prediction method combining time-frequency features and a deep margin learning network provided by one embodiment of the present invention;

[0039] Figure 2A prediction network architecture diagram of a water quality prediction method combining time-frequency features and a deep margin learning network provided by one embodiment of the present invention;

[0040] Figure 3 The correlation between DO and TN in different frequency bands and other influencing factors in a water quality prediction method combining time-frequency features and deep margin learning network provided by one embodiment of the present invention;

[0041] Figure 4 The sequence decomposition result of input data in a water quality prediction method combining time-frequency features and a deep margin learning network provided by one embodiment of the present invention;

[0042] Figure 5 The water pollution concentration prediction result of a water quality prediction method combining time-frequency features and a deep margin learning network provided by one embodiment of the present invention;

[0043] Figure 6 Comparison of the predicted results and measured values of water quality indicators DO and TN of different models in a water quality prediction method combining time-frequency features and deep margin learning network provided by one embodiment of the present invention;

[0044] Figure 7 A schematic diagram of the structure of a water quality prediction system that combines time-frequency features with a deep margin learning network, provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0045] The present invention will be further described in detail below by means of specific embodiments in conjunction with the accompanying drawings. Similar elements in different embodiments are numbered with associated similar elements. In the following embodiments, many detailed descriptions are provided to enable the present invention to be better understood. However, those skilled in the art will readily appreciate that some of the features may be omitted under different circumstances, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the present invention are not shown or described in the specification. This is to avoid the core of the present invention being overwhelmed by excessive descriptions, and for those skilled in the art, it is not necessary to describe these related operations in detail. They can fully understand the related operations based on the description in the specification and the general technical knowledge in the art.

[0046] In addition, the features, operations, or characteristics described in the specification may be combined in any appropriate manner to form various embodiments. Furthermore, the steps or actions in the method description may be reordered or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various sequences in the specification and drawings are provided solely for the purpose of clearly describing a particular embodiment and are not intended to be mandatory, unless otherwise specified.

[0047] The first embodiment of the present invention provides a water quality prediction method that combines time-frequency features with a deep residual learning network, covering four parts: data collection and preprocessing, deep residual learning network design, decomposition results and analysis, and model performance evaluation. First, in the data collection and preprocessing stage, hydrological and pollutant data are collected as samples, and are cleaned and standardized; secondly, the VMD algorithm is applied to decompose the original signal into a series of IMFs with specific frequency characteristics as network input; thirdly, a deep residual learning network based on iTransformer is designed to learn the association representation of each IMF with the prediction target, and construct a residual learning structure to strengthen the long-term evolution law learning of the low-frequency component; then, after determining the optimal parameters and obtaining the VMD decomposition results, the intrinsic connection between water quality variables is deeply explored from a modal perspective, and the analysis results verify the rationality of the model design; finally, RMSE, MAE and MAPE are used as evaluation indicators to evaluate the performance of the method, and compared with the performance of other baseline models to verify the superiority of the proposed method. The following is combined with Figure 1 Provide detailed explanation.

[0048] S100: monitor and obtain original hydrological and water quality index time series data, and perform preprocessing.

[0049] Specifically, this embodiment selects the Lijiang River Basin in Guilin, China as the research area. The basin is a typical karst river system with unique hydrological characteristics. The water quality dynamics of the Lijiang River are affected by multiple environmental factors, including karst groundwater recharge, seasonal tourism activities, and subtropical monsoon climate; the water quality data show typical dynamic characteristics, which provides a good data basis for verifying the performance of the multi-scale water quality prediction model. The experimental data comes from monitoring stations along the Lijiang River Basin in Guilin, China. The data set contains total phosphorus (TP), total nitrogen (TN), permanganate index (COD Mn ), ammonia nitrogen (NH3-N), dissolved oxygen (DO), electrical conductivity (EC), pH, water temperature (WT), turbidity (TB) and rainfall (PCP). Table 1 shows the specific content of the dataset. The experiment selected 4-hour data from Yangshuo Station from June 1, 2019 to December 31, 2022 for model construction and verification analysis. Dissolved oxygen (DO) and total nitrogen (TN) were used as key water quality indicators. The dataset was divided into a training set and a test set in a ratio of 8:2 in chronological order. The training set was used for model parameter training, and the test set was used for model performance evaluation.

[0050] Table 1 List of pollutants and meteorological variables in the dataset

[0051]

[0052]

[0053] During the actual collection process of river hydrological and water quality monitoring data, due to factors such as environmental interference and equipment maintenance, missing data and outliers are inevitable. To ensure the integrity and reliability of the modeled data, we first used the box plot method to identify outliers, and then used the piecewise cubic Hermite interpolation method (PCHIP) to fill in outliers and missing data. In addition, to eliminate the influence of data dimension, we used the z-score normalization method to transform the data to a standard normal distribution with a mean and standard deviation.

[0054] S200 decomposes the time series signals of hydrological and water quality indicators into multi-band IMF components based on the variable mode decomposition algorithm.

[0055] Modal decomposition technology reveals the multi-scale intrinsic laws of data by adaptively decomposing non-stationary time series into intrinsic mode components (IMFs) of limited bandwidth, and is of great value in time series data analysis. Traditional modal decomposition methods such as wavelet transform and empirical mode decomposition have been widely used in the field of water quality prediction. Wavelet transform can provide time-frequency localized information on sudden changes in water pollutant concentrations through multi-scale analysis. However, its fixed basis function design is difficult to adapt to the sudden fluctuation characteristics of watershed pollution events. EMD is a data-driven decomposition method. Although it can achieve adaptive decomposition based on the inherent characteristics of the water quality parameter series, it relies too much on the extraction of local features and is prone to problems such as mode aliasing, boundary effects, and unstable results.

[0056] Variational mode decomposition (VMD) is an adaptive and fully non-recursive signal decomposition method that achieves adaptive mode separation through frequency domain constraints and variational optimization. In water quality prediction, it can not only preserve the time-frequency characteristics of the signal, but also overcome the stability defects of traditional methods when decomposing high-noise water quality data.

[0057] Specifically, in response to the nonlinear and non-stationary characteristics of water quality time series, this embodiment adopts variational mode decomposition (VMD) technology to perform modal separation on water quality parameter sequences such as dissolved oxygen and total nitrogen through its frequency domain constrained optimization mechanism, and decomposes the complex nonlinear original sequence into more stable intrinsic mode components (IMFs).

[0058] In the signal decomposition process, the number of modes is first set and the modal components and center frequencies are initialized. Frequency modulation is used to separate the frequency band areas of different modes. Then, a constrained variational model is constructed with the goal of minimizing the bandwidth of each mode, thereby converting the decomposition problem of water quality time series data into a variational model for solution.

[0059] Assuming that the original hydrological and water quality signal is f(t), it needs to be decomposed into K intrinsic mode components. The calculation of the VMD constrained variation problem is as follows:

[0060]

[0061] Where K represents the total number of decompositions, u k (t) represents the kth modal component obtained by decomposition, ω k represents the center frequency of the kth component, represents the time derivative operator, t represents the time parameter, δ(t) represents the Dirac distribution, j represents the imaginary unit, where π is the circumference of the circle, represents the Hilbert transform kernel, "*" represents the convolution operator, and e is the base of the natural logarithm. Represents the complex exponential basis function in Fourier transform.

[0062] In order to find the optimal solution to the problem, the Lagrange multiplier method is introduced to transform the constrained optimization problem into an unconstrained problem. The formula is as follows:

[0063]

[0064] Where λ(t) represents the Lagrangian operator and α represents the penalty factor.

[0065] The alternating direction multiplier method (ADMM) is used to iteratively optimize and determine the modal components of the time series. and its center frequency The formula is as follows:

[0066]

[0067] in Respectively represent f(t), u i (t), the Fourier transform of λ(t), and ω represents the frequency.

[0068] Lagrange multiplication operator The update expression is:

[0069]

[0070] Where n represents the number of updates and τ represents the update step size.

[0071] S300, build and train a deep residual learning network model based on iTransformer, input each IMF component into the deep residual learning network in order from low to high frequency, learn the change pattern of each IMF layer by layer from low frequency to high frequency, and at the same time pass the feature information that is not fully extracted in each layer to the next layer for further learning through residual learning, and finally output the water quality prediction result for the future time.

[0072] iTransformer is an improved Transformer architecture for multivariate time series prediction, which solves the limitations of traditional Transformer in processing multivariate time series data. iTransformer only uses the encoder part of Transformer, which consists of Embedding, multi-layer stacked TrmBlock and Projection. Among them, the multi-head self-attention mechanism captures the correlation between multiple variables through variable labeling, and layer normalization is used to standardize variables to reduce the difference between variables; at the same time, the feedforward neural network is applied to each variable token to learn nonlinear representation, extract the global features of the sequence in the time dimension, and decode the future sequence through the stacking structure. Based on the lookback sequence X :,n , iTransformer predicts the future sequence of each variable The process can be briefly described by the following equation.

[0073]

[0074] H l+1 =TrmBlock(H l ),l=0,…,L-1

[0075]

[0076] in Contains N embedding representations of dimension D, where the superscript represents the layer index. Embedding: and projection: Both are implemented by Multi-Layer Perceptron (MLP).

[0077] Based on the modal decomposition results, a deep residual learning network is proposed to fully explore the predictive value of each frequency band feature. It consists of a multi-layer encoding module, iTransformer, residual learning structure and linear module. Figure 2As shown. The network inherits the frequency domain characteristics of VMD, introduces iTransformer as a feature extraction unit to enhance the model's learning ability for water quality time-frequency characteristics, and designs a residual learning structure to extract insufficiently learned feature information layer by layer to further improve the prediction performance. Each water quality time series IMF component is input into the network in order from low to high frequency for prediction. The specific process is as follows. First, in the transpose encoding module, each IMF component time series is converted into an independent token representation, which is used as the input of each layer of iTransformer unit. Second, in the iTransformer unit, each token is linearly transformed and mapped to a query (Q), key (K), and value (V) vector. The correlation of each water quality variable within the time span is calculated through a multi-head self-attention mechanism. Subsequently, the attention output is smoothed using layer normalization technology and decoded into a prediction target representation through a feedforward neural network. Finally, the final output is obtained after re-normalization. Third, in the residual learning architecture, the output of the iTransformer unit is replicated in two: one is directly fed into a linear module to map it to the target dimension, while the other is calculated by subtracting the input IMF components to generate a learned residual. This residual captures features not fully modeled in the current IMF and is passed to the next layer for further extraction and optimization. This process iterates continuously until feature learning is complete for all scales of IMF. Finally, the outputs of each layer are integrated to produce a forecast of the future water quality time series.

[0078] In this example, key water quality indicators, including dissolved oxygen (DO) and total nitrogen (TN), were selected as target variables for water quality prediction. DO and TN are key parameters for measuring water ecological health and eutrophication, respectively. To evaluate the performance of the proposed model in water quality prediction, DO and TN were selected as target variables.

[0079] This example also uses Pearson correlation coefficients and heatmaps to analyze and verify the correlation distribution between key water quality indicators and other indicator variables in various IMF frequency bands. In natural environments, hydrological conditions and pollutants interact to jointly drive water quality changes. This example analyzes the correlation between water quality pollutant variables and hydrological variables from a modal perspective. Figure 3 The Pearson correlation coefficient and heat map show the correlation distribution of DO, TN and other variables in each IMF frequency band. The results show that DO and TN are strongly correlated with other variables in the low frequency band. Among them, the strong positive correlation between DO and pH reflects the close relationship between dissolved oxygen and water pH, indicating that pH indirectly regulates DO concentration by affecting chemical balance; TN and COD MnThe strong positive correlations among NH3-N, EC, and TB indicate that these variables may be affected by similar pollution sources and exhibit the same variation patterns over the long term. In contrast, the correlations in the high-frequency bands are weaker, and the linear relationship is not obvious. The strong correlations among low-frequency components reveal the co-evolution of hydrological conditions and pollutant concentrations over the long term, highlighting the core driving mechanism of water quality evolution. This analysis verifies the importance of low-frequency components in water quality prediction and supports the design of the deep residual learning network in the method of this embodiment.

[0080] In this embodiment, all models are implemented in the PyCharm integrated development environment based on Python 3.11 and PyTorch2.2 deep learning library. In order to balance computational efficiency and gradient stability, a small batch gradient descent algorithm is used for parameter optimization, the batch size is set to 32, and the training cycle is set to 200 rounds. The optimizer uses the Adam algorithm, adopts the MSE loss function, and the learning rate is set to 0.005. In view of the overfitting phenomenon that may occur during the training process, an early stopping mechanism is introduced. When the validation set loss function value does not show a significant decrease for 5 consecutive training cycles, the model is judged to converge and the training process is terminated. The model architecture design is based on the single-layer encoder structure of iTransformer, integrating 6 parallelized multi-head self-attention mechanisms, and capturing the long-range spatiotemporal dependencies in the water quality sequence through dynamic weight distribution.

[0081] In the data preprocessing stage, variational mode decomposition is used to perform frequency domain decoupling on the original water quality signal. The decomposition scale value directly affects the number of intrinsic mode components and the frequency band separation effect. Improper scale may lead to insufficient separation of frequency components or the introduction of too many noise components. The influence of decomposition scale on prediction performance was quantified by controlling variable experiments. The results showed that when the decomposition scale was 8, the RMSE and MAE indicators of the model on the test set reached the lowest values, respectively, proving that this scale setting can achieve the optimal balance between signal decomposition accuracy and computational complexity. Therefore, the optimal decomposition scale was selected as 8. The VMD algorithm was applied to the modal decomposition of the research data set, and the decomposition results are shown in Figure 2. Figure 4As shown. The time series data of the original river water quality is decomposed into 8 intrinsic mode components (IMFs). Among them, the low-frequency modes (IMF1 and IMF2) change slowly and have small amplitudes, reflecting seasonal fluctuations and long-term trends, corresponding to the overall trend of the data; the medium-frequency modes (IMF3 to IMF6) change moderately, with obvious regularity and periodicity, and contain the main characteristics of the original signal; with the increase of the order, the high-frequency modes (IMF7 and IMF8) change rapidly, with large amplitude fluctuations, usually containing noise in the data, short-term interference factors or local features with rapid changes. Through VMD decomposition, the original data is separated into different frequency components, providing multi-scale feature inputs for subsequent water quality prediction, thus laying a solid foundation for the model to learn the laws of water quality evolution at different time scales.

[0082] In the performance evaluation of the model, the evaluation index can directly reflect the accuracy and reliability of the model in the prediction task. This embodiment selects three widely used evaluation indicators: mean absolute error (MAE), root mean square error (RMSE) and symmetric mean absolute percentage error (SMAPE). These indicators provide a comprehensive evaluation of the model prediction performance from different perspectives. MAE provides a stable estimate of the overall error level, RMSE emphasizes the sensitivity to large errors, and SMAPE gives a more intuitive and consistent evaluation in the form of relative error. The methods of the three measurement methods are expressed as follows:

[0083]

[0084] Where n is the total number of samples, y` i To predict the time series, y i is the observed time series.

[0085] This model is trained using water quality monitoring data from the Yangshuo station from June 2019 to March 2022, with the goal of predicting DO and TN concentrations from April to December 2022. Figure 5 The model's predictions and corresponding observations are presented from April 24 to June 29, 2022. The results demonstrate that the VResiTNet model effectively captures the overall dynamic trends and local fluctuations of DO and TN. Notably, VResiTNet accurately captures peak changes in water quality parameters when predicting extreme values. The model's predictions closely match the observed trends, both in scenarios with large abrupt changes and in cases of continuous changes over a short period of time.

[0086] To systematically evaluate the comprehensive performance of VResiTNet, we selected MLP, LSTM, Transformer, iTransformer, and VMD-iTransformer as baseline models, using the same training settings for comparative experiments. Table 2 shows the quantitative RMSE, MAE, and SMAPE results for each model on DO and TN. These results demonstrate that the model (VResiTNet) of this embodiment outperforms the baseline models in both accuracy and robustness in water quality prediction.

[0087] Table 2 Comparison of the evaluation values of the model in DO and TN

[0088]

[0089]

[0090] In order to further verify the effectiveness of the residual learning structure in the proposed model VResiTNet and more clearly reflect the accuracy and stability of the model's prediction when the data fluctuates, a week of data with drastic fluctuations in DO and TN in the test set was selected to compare the fitting effects of VResiTNet and VMD-iTransformer models in the water quality prediction task. Figure 6 It can be seen that VMD-iTransformer can ignore noise and random fluctuations by introducing VMD, and better focus on the main trends or cyclical changes. The prediction of the overall trend of DO and TN is relatively accurate, but there are still deficiencies in the detailed fitting of the short-term concentration fluctuation stage of DO and TN. In contrast, the VResiTNet model proposed in this embodiment inherits the advantages of VMD and iTransformer, and innovatively introduces a deep margin learning structure to achieve frequency band optimization. The predicted curves and measured values on DO and TN have achieved the best fit, and have high accuracy and stability in overall trend fitting and detail capture.

[0091] Corresponding to the above-disclosed method for predicting water quality by combining time-frequency features with a deep margin learning network, an embodiment of the present invention further discloses a system for predicting water quality by combining time-frequency features with a deep margin learning network, such as Figure 7 As shown, it specifically includes:

[0092] Data acquisition and preprocessing module, used to monitor and obtain original hydrological and water quality index time series data and perform preprocessing;

[0093] VMD decomposition module, used to decompose the time series signals of hydrological and water quality indicators into multi-band IMF components based on variable mode decomposition algorithm;

[0094] The water quality prediction module is used to build and train a deep residual learning network model based on iTransformer. Each IMF component is input into the deep residual learning network in order from low to high frequency, and the change pattern of each IMF is learned layer by layer from low frequency to high frequency. At the same time, through residual learning, the feature information that has not been fully extracted in each layer is passed to the next layer for further learning, and finally the water quality prediction result for the future time is output.

[0095] It should be noted that for a detailed description of a water quality prediction system that combines time-frequency features and a deep margin learning network provided in an embodiment of the present invention, reference can be made to the relevant description of a water quality prediction method that combines time-frequency features and a deep margin learning network provided in an embodiment of the present invention, which will not be repeated here.

[0096] In addition, an embodiment of the present invention also provides an electronic device, comprising: a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to execute the steps of a water quality prediction method combining time-frequency features and a deep margin learning network as described in any of the above items.

[0097] It should be noted that for the detailed description of an electronic device provided in an embodiment of the present invention, reference can be made to the relevant description of a water quality prediction method combining time-frequency features and a deep margin learning network provided in an embodiment of the present application, which will not be repeated here.

[0098] In addition, an embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a water quality prediction method combining time-frequency features and a deep margin learning network as described in any of the above items are implemented.

[0099] It should be noted that for a detailed description of a computer-readable storage medium provided in an embodiment of the present invention, reference can be made to the relevant description of a water quality prediction method combining time-frequency features and a deep margin learning network provided in an embodiment of the present application, which will not be repeated here.

[0100] Those skilled in the art will appreciate that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer program. When all or part of the functions in the above embodiments are implemented by computer program, the program can be stored in a computer-readable storage medium, and the storage medium can include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to implement the above functions. For example, the program is stored in the memory of the device, and when the program in the memory is executed by the processor, all or part of the above functions can be implemented. In addition, when all or part of the functions in the above embodiments are implemented by computer program, the program can also be stored in a storage medium such as a server, another computer, disk, optical disk, flash disk or mobile hard disk, and saved in the memory of the local device by downloading or copying, or the system of the local device is updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be implemented.

[0101] The above examples are used to illustrate the present invention, which are only used to help understand the present invention and are not intended to limit the present invention. Those skilled in the art can make several simple deductions, modifications or substitutions based on the concept of the present invention.

Claims

1. A water quality prediction method combining time-frequency features with deep margin learning network, characterized in that: The method comprises: Monitor and obtain original hydrological and water quality index time series data and perform preprocessing; Based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components; A deep residual learning network model based on iTransformer is constructed and trained. The IMF components are input into the deep residual learning network in sequence from low to high frequency. The change pattern of each IMF is learned layer by layer from low frequency to high frequency. At the same time, the feature information that is not fully extracted in each layer is passed to the next layer for further learning through residual learning, and the final output is the water quality prediction result for the future time.

2. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 1 is characterized in that: Monitor and obtain original hydrological and water quality indicator time series data and perform preprocessing, including: The monitored hydrological and water quality index data include total phosphorus TP, total nitrogen TN, permanganate index COD Mn , ammonia nitrogen NH3-N, dissolved oxygen DO, electrical conductivity EC, pH, water temperature WT, turbidity TB and rainfall PCP; The monitoring data were cleaned and standardized, including first using the box plot method to identify outliers, and then using the piecewise cubic Hermite interpolation method to fill in outliers and missing data values; and using the z-score standardization method to transform the data into a standard normal distribution according to the mean and standard deviation.

3. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 2 is characterized in that: The method further comprises: Key water quality indicators were selected as target variables for water quality prediction, including dissolved oxygen (DO) and total nitrogen (TN); The Pearson correlation coefficient and heat map method were used to analyze and verify the correlation distribution between key water quality indicators and other indicator variables in each IMF frequency band.

4. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 1, characterized in that: Based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components, including: In the signal decomposition process, the number of modes is first set and the modal components and center frequencies are initialized. Frequency modulation is used to separate the frequency band areas of different modes. Then, a constrained variational model is constructed with the goal of minimizing the bandwidth of each mode, thereby converting the decomposition problem of water quality time series data into a variational model for solution.

5. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 4 is characterized in that: Based on the variable mode decomposition algorithm, the time series signals of hydrological and water quality indicators are decomposed into multi-band IMF components, including: In order to find the optimal solution to the problem, the Lagrange multiplier method is introduced to transform the constrained optimization problem into an unconstrained problem; the alternating direction multiplier method is used to repeatedly iteratively optimize and determine the modal components of the time series and their central frequencies.

6. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 1, characterized in that: Build and train a deep residual learning network model based on iTransformer, including: The iTransformer-based deep residual learning network model includes a multi-layer encoding module, an iTransformer module, a residual learning module, and a linear mapping module; The multi-layer encoding module is used to perform inverse encoding on each input IMF component, and the encoding results are used as input to each layer of iTransformer units; The iTransformer module includes multiple layers of parallel iTransformer units. Each layer of iTransformer units is used to first map the input to query Q, key K and value V through linear transformation, then calculate the correlation of each water quality variable within the time span through a multi-head self-attention mechanism, then use layer normalization technology to smooth the attention output, and decode it into the predicted target representation through a feedforward neural network, and finally obtain the output of each layer through re-normalization. The residual learning module is used to copy the output of each layer of iTransformer unit into two copies. One copy is mapped to the prediction target dimension through the linear mapping module, and the other copy is subtracted from the corresponding input IMF component to obtain the learning residual. The learning residual captures the feature information that is not fully modeled in the IMF component of the current layer input and is passed to the next layer of iTransformer unit for further extraction and optimization. Finally, the outputs of each layer are integrated to obtain the water quality prediction results for the future time.

7. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 1, characterized in that: Build and train a deep residual learning network model based on iTransformer, including: Construct training and test sets, and train and test the iTransformer-based deep residual learning network model; The model performance is evaluated using evaluation indicators including root mean square error (RMSE), mean absolute error (MAE) and symmetric mean absolute percentage error (SMAPE).

8. The water quality prediction method combining time-frequency features and deep margin learning network according to claim 1, characterized in that: Build and train a deep residual learning network model based on iTransformer, including: The small batch gradient descent algorithm is used for parameter optimization, and the batch size, training cycle and learning rate are set. The Adam algorithm is used as the optimizer, and the MSE loss function is used.

9. A water quality prediction system combining time-frequency features with deep margin learning network, characterized in that: The system comprises: Data acquisition and preprocessing module, used to monitor and obtain original hydrological and water quality index time series data and perform preprocessing; VMD decomposition module, used to decompose the time series signals of hydrological and water quality indicators into multi-band IMF components based on variable mode decomposition algorithm; The water quality prediction module is used to build and train a deep residual learning network model based on iTransformer. Each IMF component is input into the deep residual learning network in order from low to high frequency, and the change pattern of each IMF is learned layer by layer from low frequency to high frequency. At the same time, through residual learning, the feature information that has not been fully extracted in each layer is passed to the next layer for further learning, and finally the water quality prediction result for the future time is output.

10. An electronic device, characterized in that: The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is used to run one or more program instructions to execute the steps of a water quality prediction method combining time-frequency features and a deep margin learning network as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Sea area surface layer water temperature prediction method and device

    CN112884249A

  • Mixed deep learning water quality prediction method based on time-frequency feature extraction

    CN117194954A

  • Water quality prediction method based on double decomposition and hybrid model and related device

    CN119673325A

  • Water quality time sequence prediction method and system based on fusion whale optimization algorithm

    CN119724430A

Cited By

  • Water quality detection method and system

    CN121141981A