Water quality dissolved oxygen prediction method based on hybrid machine learning model

By combining CEEMDAN, CNN, and LSTM models and introducing a self-attention mechanism, the noise pollution and stability problems of water quality prediction models when dealing with nonlinear and non-stationary signals are solved, achieving efficient and accurate prediction of dissolved oxygen.

CN119829944BActive Publication Date: 2026-04-28BEIHANG UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIHANG UNIV
Filing Date
2024-12-23
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing water quality prediction models suffer from noise pollution and insufficient stability when dealing with nonlinear and non-stationary signals, making it difficult to accurately predict the temporal characteristics of dissolved oxygen.

Method used

We employ an adaptive noise complete set empirical mode decomposition algorithm (CEEMDAN) combined with convolutional neural networks (CNN) and long short-term memory neural networks (LSTM), and introduce a self-attention mechanism to enhance the model's feature representation ability and prediction accuracy by decomposing and extracting features from water quality time series data.

Benefits of technology

It effectively captures local features in time series data, reduces dependence on long-series data, and improves the stability and prediction accuracy of the model, especially showing greater flexibility and accuracy in long-term prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829944B_ABST
    Figure CN119829944B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a water quality dissolved oxygen prediction method based on a hybrid machine learning model. The specific implementation of the method comprises: preprocessing an original dissolved oxygen data sequence obtained by a water quality detection sensor to generate a preprocessed dissolved oxygen data sequence; decomposing the preprocessed dissolved oxygen data sequence to generate a plurality of intrinsic mode functions and a residual part; inputting each intrinsic mode function generated into a pre-trained water quality dissolved oxygen prediction model to obtain an intrinsic mode function prediction result group; and performing weighted addition processing on each intrinsic mode function prediction result in the intrinsic mode function prediction result group to generate a final water quality dissolved oxygen prediction result. The implementation accurately monitors the dissolved oxygen in the water body.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments disclosed herein relate to the field of water quality monitoring technology, specifically to a method for predicting dissolved oxygen in water based on a hybrid machine learning model. Background Technology

[0002] In the field of computer science, the development of water quality prediction mainly involves innovations in data processing, model building, and prediction optimization. Starting with the initial data acquisition and processing stage of water quality prediction in the computer field, large-scale water quality data began to be digitally recorded and stored. The application of sensor networks and remote monitoring technologies has made water quality data acquisition more efficient and continuous. For this massive amount of data, researchers use methods such as data cleaning, feature extraction, and data integration to preprocess the data, helping to improve the performance and stability of models and reduce uncertainties during model training. With the application of computer technology in water quality prediction, traditional statistical models have gradually been replaced by machine learning and deep learning methods. These methods can better capture the complex relationships between data and improve the accuracy of predictions. For example, algorithms such as Support Vector Machines (SVM), Artificial Neural Networks (ANN), and Deep Neural Networks (DNN) are widely used in the establishment of water quality prediction models. To better assist managers in taking appropriate measures to deal with emergencies or pollution sources, real-time monitoring and early warning systems have been continuously improved. These systems can collect water quality data in real time and perform real-time analysis and prediction, not only improving the frequency and accuracy of water quality monitoring but also issuing timely warnings. The widespread use of the internet has generated massive amounts of data, leading to the popularization of big data technology. Data-driven decision support systems are beginning to play a crucial role in water quality management. These systems can integrate multi-source data and utilize data mining and machine learning techniques to provide decision-makers with comprehensive water quality information and forecasts, helping managers formulate more scientific and effective management strategies.

[0003] The information disclosed in this background section is only intended to enhance the understanding of the background of the inventive concept, and therefore may contain information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0004] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion that follows. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.

[0005] Some embodiments of this disclosure propose a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model, in order to solve one or more of the technical problems mentioned in the background section above.

[0006] Some embodiments of this disclosure provide a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model. The method includes: preprocessing the raw dissolved oxygen data sequence obtained from a water quality detection sensor to generate a preprocessed dissolved oxygen data sequence; decomposing the preprocessed dissolved oxygen data sequence to generate at least one intrinsic mode function (IMF) and a residual part; inputting each generated IMF into a pre-trained dissolved oxygen prediction model to obtain an IMF prediction result set; and performing a weighted summation of the IMF prediction results in the IMF prediction result set to generate a final prediction result.

[0007] The various embodiments disclosed above have the following beneficial effects: To address the issues of temporal sequence and noise pollution, a model combining the Adaptive Noise Complete Set Empirical Mode Decomposition (CEEMDAN), Convolutional Neural Network (CNN), and Long Short-Term Memory Neural Network (LSTM) is proposed, and a self-attention mechanism is introduced. First, the CEEMDAN algorithm is used to decompose the water quality time series data, obtaining a set of Intrinsic Mode Functions (IMFs), thereby effectively extracting features at different time scales and ignoring irrelevant noise. Then, the decomposed IMFs are input into the CNN-LSTM deep learning prediction model incorporating the self-attention mechanism to better capture the spatial and temporal features of the data. The self-attention mechanism further enhances the model's feature representation ability, enabling it to dynamically focus on key features.

[0008] The principle of some embodiments of this disclosure is as follows:

[0009] Dissolved oxygen is the most important characteristic of water quality data. A water quality dissolved oxygen prediction method based on a hybrid machine learning model is proposed. In this hybrid model, CNN effectively captures local features in time-series data, reducing the dependence of LSTM on long-series data. Simultaneously, CNN performs dimensionality reduction and feature extraction, helping to alleviate model complexity and overfitting issues. The parallel computation of convolution operations accelerates the entire model training process. Complete Ensemble Empirical Mode Decomposition with Adaptive Noise (CEEMDAN) is a signal processing method used to decompose nonlinear and non-stationary signals into multiple intrinsic mode functions (IMFs) and a residual term (Res). It is an improvement and extension of the classical Empirical Mode Decomposition (EMD) method. Using CEEMDAN as a preprocessing step can effectively decompose complex signals, providing more accurate input data, thus compensating for the limitations of the CNN-LSTM model in handling nonlinear and non-stationary signals. Adaptive noise adjustment reduces the impact of noise on the signal, improving model stability and prediction accuracy. To further enhance model performance, a self-attention mechanism is introduced into the CEEMDAN-CNN-LSTM model. This mechanism enables the model to dynamically focus on key features in the sequence, fully utilize global information, and better capture long-distance dependencies. Combined with the self-attention mechanism, the model exhibits greater flexibility and accuracy when processing long sequence data.

[0010] Some advantages of embodiments of this disclosure are as follows:

[0011] 1. Some embodiments of the present disclosure utilize a hybrid model that employs a CNN convolutional neural network, which can effectively capture local features in time-series dissolved oxygen data and reduce the dependence of LSTM on long-series data.

[0012] 2. Using CEEMDAN as a preprocessing step can effectively decompose complex signals, providing more accurate input data, thereby compensating for the limitations of CNN-LSTM models in processing nonlinear and non-stationary signals. Furthermore, adaptive noise adjustment reduces the impact of noise on the signal, improving the model's stability and prediction accuracy.

[0013] 3. The introduction of self-attention mechanism enables the model to dynamically focus on key features in the sequence, fully utilize global information, and better capture long-distance dependencies. Combined with self-attention mechanism, the model exhibits greater flexibility and accuracy when processing long sequence data. Attached Figure Description

[0014] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.

[0015] Figure 1 This is a flowchart of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0016] Figure 2 This is a schematic diagram of the convolutional neural network layer architecture according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0017] Figure 3 This is a schematic diagram of a long short-term memory network layer architecture according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0018] Figure 4 This is a schematic diagram of a nonlinear generalized Maxwell model architecture according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model, as disclosed herein.

[0019] Figure 5 This is a schematic diagram of dissolved oxygen prediction results according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure.

[0020] Figure 6 This is a schematic diagram comparing dissolved oxygen prediction results with real data from some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure.

[0021] Figure 7 This is a comparison chart of model performance of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0022] Figure 8 This is a schematic diagram comparing the prediction results of different periods with real data of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0023] Figure 9 This is a comparison chart of model performance under different prediction cycles for some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure;

[0024] Figure 10 This is a framework diagram of a hybrid machine learning model based on some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to the present disclosure. Detailed Implementation

[0025] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0026] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.

[0027] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0028] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0029] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0030] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.

[0031] Figure 1 A flowchart 100 is shown, illustrating some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model according to this disclosure. This water quality dissolved oxygen prediction method based on a hybrid machine learning model includes the following steps:

[0032] Step 101: Preprocess the raw dissolved oxygen data sequence obtained from the water quality detection sensor to generate a preprocessed dissolved oxygen data sequence.

[0033] In some embodiments, the execution entity (e.g., a server) of the water quality dissolved oxygen prediction method based on a hybrid machine learning model can preprocess the raw dissolved oxygen data sequence obtained from the water quality detection sensor to generate a preprocessed dissolved oxygen data sequence.

[0034] In practice, the raw dissolved oxygen data sequence obtained from water quality sensors can be preprocessed using the following steps:

[0035] The first step is to convert the original dissolved oxygen data in the original dissolved oxygen data sequence into floating-point format, resulting in the converted dissolved oxygen data sequence. This ensures that the model can perform accurate calculations during training.

[0036] The second step is to reshape the converted dissolved oxygen data in the converted dissolved oxygen data sequence to obtain the reshaped dissolved oxygen data sequence.

[0037] The third step involves normalizing the remodeled dissolved oxygen data in the remodeled dissolved oxygen data sequence to generate normalized remodeled dissolved oxygen data for each sequence, which serves as the preprocessed dissolved oxygen data sequence. This normalization scales the data to the [0, 1] interval, accelerating model convergence and improving model performance.

[0038] Step 102: Decompose the preprocessed dissolved oxygen data sequence to generate at least one intrinsic mode function and a residual part.

[0039] In some embodiments, the execution entity may decompose the preprocessed dissolved oxygen data sequence to generate at least one intrinsic mode function and a residual part.

[0040]

[0041] Where x(t) represents the preprocessed dissolved oxygen data. t represents the time step. n represents the number of intrinsic mode functions (IMFs) derived from a single preprocessed dissolved oxygen dataset. i Represents the intrinsic mode function. Res(t) represents the residual part, i.e., the residual.

[0042] In practice, the preprocessed dissolved oxygen data sequence can be decomposed using the following steps:

[0043] The first step is to perform data expansion processing on the preprocessed dissolved oxygen data sequence to generate an expanded dissolved oxygen data sequence.

[0044] The second step involves performing the following decomposition steps based on the expanded dissolved oxygen data sequence:

[0045] The first decomposition step is to generate a random noise sequence.

[0046] The second decomposition step involves adding each expanded dissolved oxygen data point in the expanded dissolved oxygen data sequence to each random noise point in the aforementioned random noise sequence to generate multiple simulation data points, thus obtaining a simulation dataset.

[0047] The third decomposition step involves performing multiple empirical mode decompositions on the above simulation dataset to obtain a set of intrinsic mode functions.

[0048] The fourth decomposition step involves averaging the intrinsic mode functions in the aforementioned intrinsic mode function set to generate an average intrinsic mode function.

[0049] The fifth decomposition step is to determine the residual as the difference between the expanded dissolved oxygen data sequence and the average intrinsic mode function.

[0050] The sixth decomposition step, in response to the failure to meet any of the preset stopping conditions in the preset stopping condition group, uses the residual as the expanded dissolved oxygen data sequence and executes the above decomposition steps again. The preset stopping conditions in the preset stopping condition group are pre-set conditions for stopping the decomposition. For example, the preset stopping conditions in the preset stopping condition group could be: 1. The number of intrinsic mode functions reaches the maximum number of intrinsic mode functions. 2. By calculating the residual and performing an empirical mode decomposition, if the residual signal produces only one component, it indicates that it does not have enough extrema, suggesting that the signal is close to pure noise, and the decomposition stops at this point. 3. If the difference between the maximum and minimum values ​​of the residual is less than a preset range threshold (self.range_thr = 0.01), it indicates that the signal is close to flat, and the algorithm stops. 4. If the total power of the residual signal is less than a preset total power threshold (self.total_power_th = 0.05), it also indicates that the signal is close to noise, and the algorithm stops.

[0051] The third step involves determining at least one average intrinsic mode function as at least one eigenmode function in response to the satisfaction of any preset stopping condition in the preset stopping condition group, thereby obtaining at least one eigenmode function and a residual part.

[0052] Step 103: Input the generated intrinsic mode functions into the pre-trained dissolved oxygen prediction model to obtain the intrinsic mode function prediction result set.

[0053] In some embodiments, the aforementioned executing entity can input the generated intrinsic mode functions into a pre-trained dissolved oxygen prediction model to obtain a set of intrinsic mode function prediction results.

[0054] In practice, the generated intrinsic mode functions can be input into a pre-trained dissolved oxygen prediction model through the following steps to obtain a set of intrinsic mode function prediction results:

[0055] The first step involves inputting each of the aforementioned intrinsic mode functions (IMFs) into the long short-term memory (LSTM) network layer of the dissolved oxygen prediction model to obtain a set of hidden feature states. Assuming the shape of each IMF component is (batch_size_steps, features), the hidden state H at each time step t can be obtained after calculation by the LTM network layer. t Each Ht The shape is (batch_size, features), representing the feature information at that time step. The output set of all time steps yields the output H. LSTM :

[0056] H t =LSTM(x t h t-1 C t-1 ).

[0057] H LSTM = [H1, H2, ... H t 〕.

[0058] Here, LSTM stands for Long Short-Term Memory network layer. t This represents the input at the current time step t. t-1 This indicates the hidden state at the previous time step. (C) t-1 This indicates the cell state at the previous time step. H LSTM Let T represent the set of hidden states generated by the LSTM at each time step t, with shape (batch_size, T, features), where T is the total number of time steps. This allows for the extraction of long-term dependency features from the time series. By introducing forget gates, input gates, and output gates to control the flow of information, effective dissolved oxygen data can be selectively retained, forgotten, and output. This can help solve the gradient vanishing and gradient exploding problems in traditional RNNs, enabling them to more effectively process time series dissolved oxygen data resulting from decomposition, thereby achieving the capture and processing of long-term dependencies.

[0059] The second step is to input the above hidden feature state group into the convolutional neural network layer to obtain the feature map group.

[0060] N = Activation(H LSTM *W+B)

[0061] Where N represents the feature map, Activation represents the activation function, W represents the weight vector of the convolution kernel, and B represents the offset of the convolution kernel. This allows for the capture of local features.

[0062] The third step is to input the above feature map group into the self-attention mechanism layer to obtain the attention feature group.

[0063]

[0064] Where Attention(Q, K, V) represents the attention feature, d k Indicates the dimension of the key. Q represents the query matrix, K represents the key matrix, and V represents the value matrix. T represents the transpose.

[0065] Here, the above feature map set can be input into the self-attention mechanism layer through the following sub-steps to obtain the attention feature set:

[0066] The first sub-step involves multiplying each feature map in the feature map group by the pre-trained weight matrix to generate a query vector group, a key vector group, and a value vector group.

[0067]

[0068] Wherein, the weight matrix W q W k W v It is randomly generated by the initializer glorot_uniform. Q represents the query matrix, K represents the key matrix, V represents the value matrix, and N represents the feature map.

[0069] The second sub-step involves determining the dot product between each query vector in the query vector group and each key vector in the key vector group, using this product as the attention score to generate an attention score matrix. This attention score matrix is ​​a two-dimensional matrix.

[0070] The third sub-step involves normalizing each attention score in the attention score matrix to generate a normalized attention score matrix.

[0071] The fourth sub-step involves performing a weighted summation of each normalized attention score in the normalized attention score matrix and each value vector in the value vector group to generate attention features.

[0072] The fourth step is to flatten the above attention feature groups to generate flattened attention feature groups.

[0073]

[0074] Flatten is used to transform a multidimensional array into a one-dimensional array. Attention(Q, K, V) represents the attention feature.

[0075] The fifth step is to input the flattened attention feature set into the fully connected layer to obtain the intrinsic mode function prediction result set.

[0076] IMF P =Dens(F flatten )=σ(W dense F flatten +b dense ).

[0077] Among them, IMF P This represents the prediction result of the intrinsic mode function. σ represents the activation function. W denseThis represents the weights of the fully connected layer. dense This represents the bias term. Dense is used for linear transformations.

[0078] The sixth step is to weight and sum the prediction results of each generated intrinsic mode function to obtain the water quality dissolved oxygen prediction result.

[0079] Step 104: The prediction results of each intrinsic mode function in the intrinsic mode function prediction result group are weighted and summed to generate the final water quality dissolved oxygen prediction result.

[0080]

[0081] Where Total_P represents the final predicted dissolved oxygen level in the water. This represents the prediction result of the i-th intrinsic mode function. ω represents the nonlinear accumulated weight value. Therefore, by using nonlinear weights ω to achieve nonlinear accumulation of prediction results, the influence of location, flow velocity, and water pressure information on sensor-collected data can be better considered.

[0082] In some embodiments, the execution entity may perform a weighted summation of the intrinsic mode function prediction results in the intrinsic mode function prediction result group to generate the final dissolved oxygen prediction result. A framework diagram of a hybrid machine learning model-based method for predicting dissolved oxygen in water quality, based on some embodiments of this disclosure, is shown below. Figure 10 As shown.

[0083] Further reference Figure 2 The diagram illustrates a convolutional layer architecture of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed herein. It includes:

[0084] A convolutional neural network (CNN) consists of five layers: an input layer, convolutional layers, pooling layers, fully connected layers, and an output layer. When processing time-series data, a CNN treats the data as a one-dimensional signal and uses one-dimensional convolutional kernels to extract local features. These kernels slide along the time axis, identifying patterns and features at different time scales. In time-series prediction tasks, CNNs typically combine fully connected layers and an output layer to further process the extracted features and output prediction results.

[0085] During the training of a convolutional neural network, the weights W and offsets B are continuously updated using an optimization algorithm to gradually reduce the loss function L. Given input data X, the feature map N of the convolutional layer can be represented as follows:

[0086]

[0087] Where W represents the weight vector of the convolutional kernel, initialized with random values ​​at the start of training. B represents the offset, initialized to zero. η represents the learning rate. Let L represent the partial derivative. Let L represent the loss function. Let X represent the input data. This represents the convolution operation. N represents the feature map of the convolutional layer. F() represents the activation function.

[0088] Further reference Figure 3 The diagram shows a schematic of a long short-term memory network layer architecture for some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed herein.

[0089] include:

[0090] Long Short-Term Memory (LSTM) networks are gated neural networks that can remember and process long-term dependencies. They control the flow of information by introducing forget gates, input gates, and output gates, selectively retaining, forgetting, and outputting information. This solves the gradient vanishing and gradient exploding problems in traditional RNNs, enabling them to process time-series data more effectively, thus capturing and processing long-term dependencies.

[0091] Here, as Figure 3 As shown, it can be expressed by the following formula:

[0092] i t =σ(W xi x t +W hi h t-1 +B i ).

[0093] f t =σ(W xf x t +W hf h t-1 +B f ).

[0094] o t =σ(W xo x t +W ho h t-1 +B o ).

[0095]

[0096] h t =o t ⊙tanh(c t ).

[0097] Where, x tLet represent the t-th input sequence. C represents the memory cell, the core of the network, used to control the transmission of information. i represents the input gate, which determines the current x. t How much information should be retained for c? t f represents the forget gate, which determines how much of the cell's previous state c is saved. t-1 Up to the current c t ; O indicates that the output gate determines c t How much is passed to the output h of the current state? t h t-1 Refers to the hidden state at time t-1. W xi W xf W xo W xc W represents the weight vector from the input layer to the input gate, forget gate, output gate, and memory unit. hi W hf W ho W hc This represents the weight vector from the hidden layer to the input gate, forget gate, output gate, and memory unit. B i B f B o B c σ represents the offsets of the input gate, forget gate, output gate, and cell state; c refers to the activation function. t This indicates the cell state at the current time step. t represents the time step, indicating the current position in the sequence. This indicates the state of candidate cells at the current time step.

[0098] Further reference Figure 4 The diagram illustrates a nonlinear generalized Maxwell model architecture of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed herein.

[0099] When performing weighted summation on the final sequence data, considering the nonlinear effects of sensor location, flow velocity, and water pressure information on the sensor-acquired data that cannot be described by linear summation, a generalized Maxwell model is introduced to determine the value of parameter ω:

[0100] ω=ω ep +ω v

[0101] ω ep =μ p ·h+μ e →ω e .

[0102] Where, ω ep This represents the water pressure and position parameters. ω vThis represents the flow velocity parameter. μ p This represents a constant related to the sensor's oxygen content detection sensitivity. h represents the water depth of the position sensor. μ e ω represents a constant related to the sensor's contact area. e This represents the pressure parameter. μ e With ω e Nonlinear correlation.

[0103] The nonlinear accumulation of prediction results is achieved through a nonlinear weight ω, which better reflects the advanced nature and effectiveness of the method as verified by specific experiments. The experiments are based on real datasets from the Xixia Reservoir monitoring station. The Xixia Reservoir is a supporting project of the Xiaolangdi Water Control Project on the Yellow River, located 16 kilometers downstream of the Xiaolangdi Dam site on the main stream of the Yellow River. Among numerous water quality evaluation indicators, some embodiments of this disclosure select dissolved oxygen (DO) as the indicator. Data collection time was from January 1, 2021 to April 18, 2023. The data monitoring station updated the data every three hours, with a total of 6999 data points. Some embodiments of this disclosure use the first 5600 data points as the training set and the last 1399 data points as the test set.

[0104] To evaluate the performance and accuracy of water quality prediction models, and to promptly identify their shortcomings for improvement and optimization, thereby enhancing prediction accuracy and reliability, this invention selects the mean absolute error (MAE), root mean square error (RMSE), and coefficient of determination (R²) as key performance indicators. 2 This serves as the basis for judging the model's predictive performance. The calculation formula is as follows:

[0105]

[0106]

[0107] Where MAE represents the mean absolute error, and RMSE represents the root mean square error. 2 This represents the coefficient of determination. n represents the sample size. y i This represents the actual value. This represents the predicted value. This represents the average of the actual values.

[0108] The results of CEEMDAN decomposition of dissolved oxygen (DO) data in water are as follows: Figure 5As shown, the data sequence, after CEEMDAN decomposition, yielded 12 intrinsic mode functions (IMFs) and one residual (Res). The horizontal axis represents time, and the vertical axis represents amplitude, with varying amplitude scales. IMF1 to IMF12 are arranged in order from high frequency to low frequency. The higher frequency components exhibit more dramatic fluctuations but smaller amplitudes, reflecting the drastic fluctuations in dissolved oxygen content caused by short-term random factors, without a clear pattern. The lower components in the figure have lower frequencies but larger amplitudes, reflecting the long-term trend and periodic fluctuation characteristics of dissolved oxygen in the water.

[0109] Some embodiments of this disclosure divide the dataset into training and testing sets in an 8:2 ratio. During model parameter tuning, some embodiments of this disclosure first adjust the number of training epochs (EPOCHS), finding that when the value is 100, the model's performance no longer improves with increasing EPOCHS values. Next, some embodiments of this disclosure adjust the model's window size (LOOK_BACK), finding that increasing the window size from 10 decreases model performance, while decreasing it does not significantly improve performance. Finally, some embodiments of this disclosure adjust the model's filter (FILTERS), finding that the model achieves optimal prediction results when FILTERS is set to 350. Therefore, some embodiments of this disclosure believe that the proposed model exhibits optimal performance when LOOK_BACK, EPOCHS, and FILTERS values ​​are 10, 100, and 350, respectively. Taking dissolved oxygen as an example, in the water quality prediction task, RMSE, MAE, and R2 reached 0.138, 0.084, and 0.993, respectively. The prediction results for the test set are as follows... Figure 6 As shown, the vertical axis represents the concentration of dissolved oxygen in the water, and the horizontal axis represents time. The predicted values ​​from the experiment are generally consistent with the actual values ​​of the data.

[0110] To verify the superiority of the model proposed in some embodiments of this disclosure, the model is compared with three other models: CEEMDAN-CNN-LSTM (CCL), CNN-LSTM (CL), and SVM. The results are as follows: Figure 7 As shown, comparing the four different models, SVM performed the worst, possibly because it cannot capture the complex dynamics in time series data. The performance of LSTM demonstrates its suitability for time series data prediction. The CEEMDAN-CNN-LSTM model outperforms both LSTM and SVM models, indicating that the model based on the CEEMDAN algorithm positively improves time series prediction. The model proposed by adding a self-attention mechanism to the CEEMDAN-CNN-LSTM model outperforms the other three models in terms of prediction metrics, proving that the modeling approach of some embodiments of this disclosure is reasonable.

[0111] To verify the advantages of the model in long-term prediction, the following experimental design sets the prediction period to 6 hours, 9 hours, 12 hours and 24 hours, aiming to comprehensively evaluate the model's performance at different time scales. Figure 8 In the graph, the blue curve represents the actual observed values, while the yellow curve represents the model's predicted values. As can be seen, despite the gradually increasing prediction period, the model maintains high prediction accuracy over a longer timescale, demonstrating its significant stability and reliability.

[0112] This experiment used 1399 data points as the test set. Figure 9 The RMSE, MAE, and R of different models are shown for each prediction period. 2 The results show that the predictive performance of all models declined to varying degrees with the extension of the prediction period, a phenomenon commonly observed in water quality prediction. This is mainly due to the gradual accumulation of uncertainty in long-term predictions, which further amplifies the fluctuation of prediction errors. By comparing the performance of the CCL, CL, and SVM models, we found that the CCL model significantly outperformed the other two in all prediction periods. This finding indicates that the data processed by the CEEMDAN method has stronger adaptability, further validating the effectiveness of the CEEMDAN algorithm in improving model stability and universality. Furthermore, the model presented in this paper not only performs outstandingly in all prediction periods but also maintains high accuracy compared to other models in long-term predictions. This advantage is attributed to the effective application of the self-attention mechanism in the model, which can capture dependencies over long time spans, enhance the model's ability to utilize historical information, and thus improve overall prediction accuracy. This experimental result further demonstrates that the model presented in this paper possesses superior stability and accuracy compared to traditional methods when facing long-term predictions.

[0113] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.

Claims

1. A method for predicting dissolved oxygen in water quality based on a hybrid machine learning model, comprising: The raw dissolved oxygen data sequence obtained from the water quality detection sensor is preprocessed to generate a preprocessed dissolved oxygen data sequence; The preprocessed dissolved oxygen data sequence is decomposed to generate at least one intrinsic mode function and a residual part; Each generated intrinsic mode function is input into a pre-trained dissolved oxygen prediction model to obtain a set of intrinsic mode function prediction results. The prediction results of each intrinsic mode function in the intrinsic mode function prediction result group are nonlinearly weighted and summed to generate the final prediction result. The step of inputting the generated intrinsic mode functions into a pre-trained dissolved oxygen prediction model to obtain an intrinsic mode function prediction result set includes: Each of the intrinsic mode functions is input into the long short-term memory network layer included in the dissolved oxygen prediction model to obtain the hidden feature state group; The hidden feature state group is input into a convolutional neural network layer to obtain a feature map group, wherein... , Representing feature maps, This represents the activation function of a convolutional neural network layer. This represents the weight vector of the convolution kernel. This represents the offset of the convolutional kernel, which is calculated by the Long Short-Term Memory network layers to obtain the offset at each time step. Current hidden state Each The shape is ( batch_size, features The output is the set of outputs from all time steps, representing the characteristic information of that time step. : , , in, This represents the Long Short-Term Memory (LSTM) network layer. Indicates the current time step Input, This indicates the hidden state of the previous time step. This indicates the cell state at the previous time step. express At each time step The generated set of hidden states has the shape (batch_size, T, features), where T is the total number of time steps; The feature map set is input into the self-attention mechanism layer to obtain the attention feature set, wherein... , Indicating attentional characteristics, The dimension representing the key. Represents the query matrix. Represents the key matrix. Represents a value matrix, Indicates transpose; The attention feature set is flattened to generate a flattened attention feature set, wherein... , Used to convert a multidimensional array into a one-dimensional array. Indicates attentional characteristics; The flattened attention feature set is input into the fully connected layer to obtain the intrinsic mode function prediction result set, wherein... , This represents the prediction result of the intrinsic mode function. Represents the ReLU family of activation functions. Indicates the weights of the fully connected layer. Indicates the bias term. Used for linear transformations; The generated intrinsic mode function prediction results are combined into an intrinsic mode function prediction result group.

2. The method according to claim 1, wherein, The preprocessing of the raw dissolved oxygen data sequence obtained from the water quality detection sensor to generate a preprocessed dissolved oxygen data sequence includes: The original dissolved oxygen data in the original dissolved oxygen data sequence is converted into floating-point type to obtain the converted dissolved oxygen data sequence. Data reshaping is performed on the converted dissolved oxygen data in the converted dissolved oxygen data sequence to obtain the reshaped dissolved oxygen data sequence; The remodeled dissolved oxygen data in the remodeled dissolved oxygen data sequence were normalized to generate normalized remodeled dissolved oxygen data, which served as the preprocessed dissolved oxygen data sequence.

3. The method according to claim 1, wherein, The process of decomposing the preprocessed dissolved oxygen data sequence to generate at least one intrinsic mode function and a residual component includes: The preprocessed dissolved oxygen data sequence was expanded to generate an expanded dissolved oxygen data sequence. Based on the expanded dissolved oxygen data sequence, the following decomposition steps were performed: Generate random noise sequences; Each extended dissolved oxygen data point in the extended dissolved oxygen data sequence is added to each random noise point in the random noise sequence to generate multiple simulation data points, thus obtaining a simulation dataset. Perform multiple empirical mode decompositions on the simulation dataset to obtain a set of intrinsic mode functions; The intrinsic mode functions in the set of intrinsic mode functions are averaged to generate an average intrinsic mode function. The difference between the expanded dissolved oxygen data sequence and the average intrinsic mode function is determined as the residual; In response to the failure to meet any of the preset stop conditions in the preset stop condition group, the residual is used as the expanded dissolved oxygen data sequence, and the decomposition step is executed again; In response to the satisfaction of any preset stopping condition in the preset stopping condition group, at least one average intrinsic mode function generated is determined as at least one eigenmode function, resulting in at least one eigenmode function and a residual part.

4. The method according to claim 1, wherein, The step of inputting the feature map group into the self-attention mechanism layer to obtain the attention feature group includes: Each feature map in the feature map group is multiplied by a pre-trained weight matrix to generate a query vector group, a key vector group, and a value vector group. The dot product of each query vector in the query vector group and each key vector in the key vector group is determined as the attention score to generate an attention score matrix, wherein the attention score matrix is ​​a two-dimensional matrix; The attention scores in the attention score matrix are normalized to generate a normalized attention score matrix. For each normalized attention score in the normalized attention score matrix, a weighted sum is performed between the normalized attention score and each value vector in the value vector group to generate attention features.

Citation Information

Patent Citations

  • Dissolved oxygen content prediction method based on EMD and LSTM

    CN111898673A