Water quality dissolved oxygen prediction method based on hybrid machine learning model
By combining CEEMDAN, CNN, LSTM and self-attention mechanisms, the problems of timing and noise pollution in water quality prediction are solved, and higher prediction accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411899947.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-12-23
AI Technical Summary
The existing water quality prediction methods are difficult to effectively deal with the problems of timing and noise pollution, resulting in insufficient prediction accuracy and stability.
A hybrid machine learning model combining adaptive noise-complete ensemble empirical modal decomposition algorithm (CEEMDAN), convolutional neural network (CNN), long and short-term memory neural network (LSTM) and a self-attention mechanism are introduced to predict water dissolved oxygen.
The water quality time series data is decomposed through CEEMDAN, which effectively extracts features of different time scales and reduces the impact of noise; the CNN-LSTM model can better capture the spatial and temporal characteristics of the data, and the self-attention mechanism enhances the model's feature expression ability and improves the accuracy and stability of prediction.
Smart Images

Figure CN119829944A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of water quality monitoring technology, and specifically to a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model. Background Art
[0002] In the computer field, the development of water quality prediction mainly involves innovations in data processing, model building and prediction optimization. Starting from the initial data collection 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 technology makes the collection of water quality data more efficient and continuous. In response to these massive data, researchers use methods such as data cleaning, feature extraction and data integration to pre-process the data to help improve the performance and stability of the model and reduce the uncertainty in the model training process. With the application of computer technology in the field of water quality prediction, traditional statistical models are gradually replaced by machine learning and deep learning methods, which can better capture the complex relationship between data and improve the accuracy of prediction. For example, algorithms such as support vector machine (SVM), artificial neural network (ANN) and deep neural network (DNN) are widely used in the establishment of water quality prediction models. In order to better help managers take corresponding measures to deal with emergencies or pollution sources, the real-time monitoring and early warning system has been continuously improved. The system can collect water quality data in real time and conduct real-time analysis and prediction, which not only improves the monitoring frequency and accuracy of water quality conditions, but also can issue early warnings in time. The large-scale data generated by the widespread use of the Internet has made big data technology popular, and data-driven decision support systems have begun to play an important role in water quality management. These systems can integrate multi-source data and use data mining and machine learning technologies to provide decision makers with comprehensive water quality information and prediction results, helping managers to formulate more scientific and effective management strategies.
[0003] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0004] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0005] Some embodiments of the present disclosure propose a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model to solve one or more of the technical problems mentioned in the above background technology section.
[0006] Some embodiments of the present disclosure provide a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model, the method comprising: 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 at least one intrinsic mode function and a residual part; inputting each generated intrinsic mode function 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 prediction result.
[0007] The above-mentioned embodiments of the present disclosure have the following beneficial effects: In order to solve the problems of temporal sequence and noise pollution, a model combining the complete set empirical mode decomposition algorithm with adaptive noise (CEEMDAN), convolutional neural network (CNN) and long short-term memory neural network (LSTM) is proposed, and a self-attention mechanism is introduced. First, the water quality time series data is decomposed using the CEEMDAN algorithm to obtain a set of intrinsic mode functions (IMFs), thereby effectively extracting features of different time scales and ignoring irrelevant noise. Then, the decomposed IMFs are respectively input into the CNN-LSTM deep learning prediction model combined with the self-attention mechanism to better capture the spatial and temporal characteristics of the data. The self-attention mechanism further enhances the feature expression ability of the model, enabling it to dynamically focus on key features.
[0008] The principles of some embodiments of the present disclosure are:
[0009] Dissolved oxygen is the most important feature to characterize water quality data. A method for predicting dissolved oxygen in water quality based on a hybrid machine learning model is proposed. In the hybrid model, CNN can effectively capture local features in time series data and reduce the dependence of LSTM on long series data. At the same time, CNN reduces the dimension and extracts features of data, which helps to reduce the complexity and overfitting of the model. The parallel computing characteristics of convolution operations accelerate the training process of the entire model. Complete integrated 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 and provide more accurate input data, thereby making up for the limitations of the CNN-LSTM model in processing nonlinear and non-stationary signals, and reducing the impact of noise on the signal through adaptive noise adjustment, thereby improving the stability of the model and prediction accuracy. In order to further enhance the performance of the model, a self-attention mechanism is introduced in the CEEMDAN-CNN-LSTM model. This mechanism enables the model to dynamically focus on key features in the sequence, make full use of global information, and better capture long-distance dependencies. Combined with the self-attention mechanism, the model can show greater flexibility and accuracy when processing long sequence data.
[0010] Advantages of some embodiments of the present disclosure are:
[0011] 1. The hybrid model of some embodiments of the present disclosure utilizes 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 sequence data;
[0012] 2. Using CEEMDAN as a preprocessing step can effectively decompose complex signals and provide more accurate input data, thereby making up for the limitations of the CNN-LSTM model in processing nonlinear and non-stationary signals, and reducing the impact of noise on the signal through adaptive noise adjustment, thereby improving the stability of the model and prediction accuracy.
[0013] 3. The introduction of the self-attention mechanism enables the model to dynamically focus on key features in the sequence, make full use of global information, and better capture long-distance dependencies. Combined with the self-attention mechanism, the model can show greater flexibility and accuracy when processing long sequence data. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0015] Figure 1 is a flow chart of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure;
[0016] Figure 2 is a schematic diagram of a convolutional neural network layer architecture of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure;
[0017] Figure 3 is a schematic diagram of a long short-term memory network layer architecture of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure;
[0018] Figure 4 It is a schematic diagram of a nonlinear generalized Maxwell model architecture according to some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure.
[0019] Figure 5 is a schematic diagram of water quality dissolved oxygen prediction results according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed in the present invention;
[0020] Figure 6 is a schematic diagram of comparison between dissolved oxygen prediction results and real data according to some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model disclosed herein;
[0021] Figure 7 is a model performance comparison diagram of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure;
[0022] Figure 8 It is a schematic diagram comparing prediction results of different periods with real data according to some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model disclosed in the present invention;
[0023] Fig. 9 is a model performance comparison diagram under different period predictions according to some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model disclosed in the present invention;
[0024] Fig.10 This is a framework diagram based on a hybrid machine learning model according to some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed in the present invention. DETAILED DESCRIPTION
[0025] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0026] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0031] Figure 1 A process 100 of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model according to the present disclosure is shown. The method for predicting dissolved oxygen in water quality based on a hybrid machine learning model comprises the following steps:
[0032] Step 101 , preprocessing an original dissolved oxygen data sequence obtained by a water quality detection sensor to generate a preprocessed dissolved oxygen data sequence.
[0033] In some embodiments, the execution entity (eg, a server) of the water quality dissolved oxygen prediction method based on the hybrid machine learning model may preprocess the original dissolved oxygen data sequence obtained by the water quality detection sensor to generate a preprocessed dissolved oxygen data sequence.
[0034] In practice, the raw dissolved oxygen data sequence obtained by the water quality detection sensor can be preprocessed by the following steps:
[0035] In the first step, the original dissolved oxygen data in the original dissolved oxygen data sequence is converted into a floating point type to obtain a converted dissolved oxygen data sequence, thereby ensuring 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 a reshaped dissolved oxygen data sequence.
[0037] The third step is to normalize the reshaped dissolved oxygen data in the reshaped dissolved oxygen data sequence to generate normalized reshaped dissolved oxygen data as the preprocessed dissolved oxygen data sequence. Thus, the data is scaled to the [0, 1] interval by normalization, which accelerates model convergence and improves model performance.
[0038] Step 102: Decomposing 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 dissolved oxygen data after preprocessing. t represents the time step. n represents the number of intrinsic mode functions decomposed from the dissolved oxygen data after preprocessing. IMF i Represents the intrinsic mode function. Res(t) represents the residual part, i.e., the residual.
[0042] In practice, the preprocessed dissolved oxygen data series can be decomposed by the following steps:
[0043] In the first step, data expansion processing is performed on the preprocessed dissolved oxygen data series to generate an expanded dissolved oxygen data series.
[0044] In the second step, based on the expanded dissolved oxygen data series, the following decomposition steps are performed:
[0045] In the first decomposition step, a random noise sequence is generated.
[0046] In the second decomposition step, each expanded dissolved oxygen data in the expanded dissolved oxygen data sequence is added to each random noise in the above random noise sequence to generate a plurality of simulation data to obtain a simulation data set.
[0047] In the third decomposition step, multiple empirical mode decompositions are performed on the above simulation data set to obtain an intrinsic mode function set.
[0048] In the fourth decomposition step, each intrinsic mode function in the above-mentioned intrinsic mode function set is averaged to generate an average intrinsic mode function.
[0049] In the fifth decomposition step, the difference between the expanded dissolved oxygen data sequence and the average intrinsic mode function is determined as a residual.
[0050] The sixth decomposition step, in response to any preset stop condition in the preset stop condition group not being met, takes the residual as the expanded dissolved oxygen data sequence, and executes the above decomposition step again. Among them, the preset stop condition in the above preset stop condition group is a preset condition for stopping the decomposition. For example, the preset stop condition in the above preset stop condition group can 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 only produces one component, it means that it does not have enough extreme values, indicating that the signal is close to pure noise, and the decomposition is stopped at this time. 3. If the difference between the maximum and minimum values of the residual is less than the preset range threshold (self.range_thr=0.01), it means that the signal is close to flatness and the algorithm stops. 4. If the total power of the residual signal is less than the preset total power threshold (self.total_power_th=0.05), it also means that the signal is close to noise and the algorithm stops.
[0051] In the third step, in response to satisfying any preset stop condition in the preset stop condition group, the generated at least one average natural mode function is determined as at least one eigenmode function to obtain at least one eigenmode function and a residual part.
[0052] Step 103: input each generated intrinsic mode function into a pre-trained water quality dissolved oxygen prediction model to obtain an intrinsic mode function prediction result group.
[0053] In some embodiments, the execution entity may input each generated intrinsic mode function into a pre-trained water quality dissolved oxygen prediction model to obtain an intrinsic mode function prediction result group.
[0054] In practice, the generated intrinsic mode functions can be input into the pre-trained water quality dissolved oxygen prediction model through the following steps to obtain the intrinsic mode function prediction result group:
[0055] The first step is to input the above-mentioned intrinsic mode functions into the long short-term memory network layer included in the water quality dissolved oxygen prediction model to obtain a hidden feature state group. Assume that the shape of each intrinsic mode function component decomposed is (batch_size_steps, features). After calculation by the long short-term memory network layer, the current hidden state H at each time step t can be obtained. t , each Ht The shape of is (batch_size, features), which represents the feature information of this time step. The output set of all time steps is the output H LSTM :
[0056] H t =LSTM(x t ,h t-1 , C t-1 ).
[0057] H LSTM =[H1, H2, ...H t 〕.
[0058] Among them, LSTM represents the long short-term memory network layer. t Represents the input of the current time step t. h t-1 represents the hidden state of the previous time step. C t-1 Represents the cell state at the previous time step. LSTM Represents the set of hidden states generated by LSTM at each time step t, and its shape is (batch_size, T, features), where T is the total number of time steps. Thus, long-term dependency features in time series can be extracted. By introducing forget gate, input gate and output gate to control the flow of information, effective dissolved oxygen data can be selectively retained, forgotten and output. It can help solve the gradient vanishing and gradient exploding problems in traditional RNN, so that it can more effectively process the time series dissolved oxygen data of decomposition results, thereby realizing the capture and processing of long-term dependencies.
[0059] In the second step, the above hidden feature state group is input into the convolutional neural network layer to obtain a feature map group.
[0060] N=Activation(H LSTM *W+B).
[0062] Among them, N represents the feature map. Activation represents the activation function. W represents the weight vector of the convolution kernel. B represents the offset of the convolution kernel. In this way, local features can be captured.
[0063] The third step is to input the above feature map group into the self-attention mechanism layer to obtain the attention feature group.
[0064]
[0065] Among them, Attention(Q, K, V) represents the attention feature, d k represents the dimension of the key. Q represents the query matrix, K represents the key matrix, and V represents the value matrix. T represents transpose.
[0066] Here, the above feature map group can be input into the self-attention mechanism layer through the following sub-steps to obtain the attention feature group:
[0067] In the first sub-step, 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.
[0068]
[0069] Among them, 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. N represents the feature map.
[0070] The second sub-step is to determine the dot product of each query vector in the query vector group and each key vector in the key vector group as an attention score to generate an attention score matrix. The attention score matrix is a two-dimensional matrix.
[0071] In the third sub-step, each attention score in the above attention score matrix is normalized to generate a normalized attention score matrix.
[0072] In the fourth sub-step, for each normalized attention score in the normalized attention score matrix, weighted sum is performed on the normalized attention score and each value vector in the value vector group to generate an attention feature.
[0073] The fourth step is to flatten the above attention feature group to generate a flattened attention feature group.
[0074]
[0075] Among them, Flatten is used to convert a multidimensional array into a one-dimensional array. Attention(Q, K, V) represents the attention feature.
[0076] In the fifth step, the flattened attention feature group is input into the fully connected layer to obtain the intrinsic mode function prediction result group.
[0077] IMF P =Dens(F flatten )=σ(W dense F flatten +b dense ).
[0078] Among them, IMF P represents the prediction result of the intrinsic mode function. σ represents the activation function. W denserepresents the weight of the fully connected layer. b dense Represents the bias term. Dense is used for linear transformation.
[0079] The sixth step is to perform weighted addition of the generated intrinsic mode function prediction results to obtain the water quality dissolved oxygen prediction result.
[0080] Step 104 , 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.
[0081]
[0082] Among them, Total_P represents the final water quality dissolved oxygen prediction result. represents the prediction result of the ith intrinsic mode function. ω represents the nonlinear cumulative weight value, Therefore, the nonlinear accumulation of prediction results is achieved through the nonlinear weight ω, which can better consider the influence of position, flow velocity and water pressure information on the sensor collected data.
[0083] In some embodiments, the execution subject may perform 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. Fig.10 shown.
[0084] Further references Figure 2 , shows a schematic diagram of the convolutional layer architecture of some embodiments of a method for predicting dissolved oxygen in water quality based on a hybrid machine learning model of the present disclosure. It includes:
[0085] The convolutional neural network layer consists of five network layers: data input layer, convolution layer, pooling layer, fully connected layer and output layer. When processing time series data, the convolutional neural network layer regards the time series data as a one-dimensional signal and uses a one-dimensional convolution kernel to extract local features. These convolution kernels slide on the time axis to identify patterns and features at different time scales. In the time series data prediction task, the convolutional neural network layer is usually combined with a fully connected layer and an output layer to further process the extracted features and output the prediction results.
[0086] During the training process of the convolutional neural network, the weights W and offsets B are continuously updated using an optimization algorithm to gradually reduce the loss function L. When the data X is input, the feature map N of the convolutional layer can be expressed as follows:
[0087]
[0088] Where W represents the weight vector of the convolution kernel, which is initialized with a random value at the beginning of training. B represents the offset, which is initialized to zero. η represents the learning rate. represents partial derivative. L represents loss function. X represents input data. Represents the convolution operation. N represents the feature map of the convolution layer. F() represents the activation function.
[0089] Further references Figure 3 , showing a schematic diagram of the long short-term memory network layer architecture of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model disclosed in the present invention.
[0090] include:
[0091] The Long Short-Term Memory Network is a neural network with a gating mechanism that can memorize and process long-term dependencies. It controls the flow of information by introducing forget gates, input gates, and output gates, selectively retaining, forgetting, and outputting information. It solves the gradient vanishing and gradient exploding problems in traditional RNNs, enabling it to process time series data more effectively, thereby capturing and processing long-term dependencies.
[0092] Here, if Figure 3 As shown, it can be expressed by the following formula:
[0093] i t =σ(W xi x t +W hi h t-1 +B i ).
[0094] f t =σ(W xf x t +W hf h t-1 +B f ).
[0095] o t =σ(W xo x t +W ho h t-1 +B o ).
[0096]
[0097] h t =o t ⊙tanh(c t ).
[0098] Among them, x trepresents the t-th input sequence. C represents the memory cell, which is the core of the network and is used to control the transmission of information. i represents the input gate that determines the current x t How much information to keep for c t f represents the forget gate (forgetgate) that determines how much of the cell state c at the previous moment is saved t-1 To the current c t ; O indicates that the output gate determines c t How much to pass to the output h of the current state t ;h t-1 Refers to the hidden state at time t-1. xi , W xf , W xo , W xc 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 Represents the weight vector from the hidden layer to the input gate, forget gate, output gate, and memory unit. i , B f , B o , B c represents the offset between the input gate, forget gate, output gate and cell state; σ refers to the activation function. t Represents the cell state at the current time step. t represents the time step, which refers to the position of the current sequence. Represents the candidate cell state at the current time step.
[0099] Further references Figure 4 , showing a schematic diagram of the nonlinear generalized Maxwell model architecture of some embodiments of a water quality dissolved oxygen prediction method based on a hybrid machine learning model of the present disclosure.
[0100] When the final sequence data is weighted and summed, considering that the position, flow rate and water pressure information of the sensor will cause nonlinear effects on the sensor data that cannot be described by linear accumulation and sum, the generalized Maxwell model is introduced to determine the value of the parameter ω:
[0101] ω=ω ep +ω v
[0102] ω ep =μ p ·h+μ e →ω e .
[0103] Among them, ω ep Represents water pressure and position parameters. ω vRepresents the flow velocity parameter. p It indicates the constant related to the oxygen content detection sensitivity of the sensor. h indicates the water depth of the sensor. μ e Represents a constant related to the sensor contact area. ω e Represents the pressure parameter. e With ω e Non-linear correlation.
[0104] By realizing the nonlinear accumulation of prediction results through nonlinear weight ω, the advancement and effectiveness of the method verified by the present invention through specific experiments can be better considered. The experiment is based on a real data set of the Xixiayuan Reservoir Monitoring Station. The Xixiayuan Reservoir is a supporting project of the Xiaolangdi Hydropower Project of the Yellow River. It is located on the mainstream of the Yellow River 16 kilometers downstream of the Xiaolangdi Dam site. Among the many water quality evaluation indicators, some embodiments of the present disclosure select the indicator of dissolved oxygen (DO). The data collection time is from January 1, 2021 to April 18, 2023. The data monitoring station updates the data every three hours, with a total of 6999 data. Some embodiments of the present disclosure use the first 5600 data as the training set and the last 1399 data as the test set.
[0105] In order to evaluate the performance and accuracy of the water quality prediction model, the deficiencies of the model can be discovered in time, and improvements and optimizations can be made to improve the accuracy and reliability of the prediction. In this paper, the mean absolute error (MAE), root mean square error (RMSE) and determination coefficient (R 2 ) is used as the basis for judging the prediction effect of the model. The calculation formula is as follows:
[0106]
[0107]
[0108] Wherein, MAE stands for mean absolute error. RMSE stands for root mean square error. 2 represents the coefficient of determination. n represents the number of samples. i Indicates actual value. Represents the predicted value. Indicates the average of the actual values.
[0109] The results of using CEEMDAN to decompose the water quality dissolved oxygen (DO) data are as follows: Figure 5As shown. After the data sequence is decomposed by CEEMDAN, 12 intrinsic mode functions (IMFs) and a residual (Res) are obtained. The horizontal axis is time and the vertical axis is amplitude. The scale of the amplitude is different. IMF1 to IMF12 are arranged in order from high frequency to low frequency. The component curve with higher frequency fluctuates violently, but the amplitude is small, reflecting the violent fluctuations caused by the interference of short-term random factors in the dissolved oxygen content in the water quality, without obvious rules. The frequency of the component below is lower, but the amplitude becomes larger, which reflects the long-term change trend and periodic fluctuation characteristics of dissolved oxygen in water quality.
[0110] Some embodiments of the present disclosure divide the data set into a training set and a test set in a ratio of 8:2. In the process of adjusting the parameters of the model, some embodiments of the present disclosure first adjust the number of training rounds (EPOCHS) of the model, and find that when the value is 100, the performance of the model will no longer improve with the increase of the EPOCHS value; then some embodiments of the present disclosure adjust the window size (LOOK_BACK) of the model. When the window size is increased from 10, the performance of the model decreases, and there is no obvious improvement in the performance when the window size is adjusted to a smaller size; finally, the filter (FILTERS) of the model is adjusted. When FILTERS is set to 350, the model prediction effect is optimal. Therefore, some embodiments of the present disclosure believe that the model proposed in some embodiments of the present disclosure shows the best performance when the values of LOOK_BACK, EPOCHS and FILTERS are 10, 100, and 350. Taking dissolved oxygen as an example, in the water quality prediction task, the RMSE, MAE, and R2 reached 0.138, 0.084, and 0.993, respectively. The prediction results of the test set are as follows. Figure 6 As shown in the figure, the vertical axis is the concentration of dissolved oxygen in the water, and the horizontal axis is time. The predicted value of the experiment is basically consistent with the actual value trend of the data.
[0111] In order to verify the superiority of the model proposed in some embodiments of the present disclosure, the model is compared with the three models of CEEMDAN-CNN-LSTM (CCL), CNN-LSTM (CL), and SVM. The results are as follows: Figure 7 As shown. By comparing four different models, SVM performs the worst, probably because the SVM model cannot capture the complex dynamics in time series data. The performance of the LSTM model shows that the model is suitable for processing the prediction of time series data; the performance of the CEEMDAN-CNN-LSTM model is better than that of the LSTM and SVM models, indicating that the model established based on the CEEMDAN algorithm has played a positive role in improving the prediction of time series. The model prediction index proposed after adding the self-attention mechanism to the CEEMDAN-CNN-LSTM model is better than the other three models, proving that the modeling ideas of some embodiments of the present disclosure are reasonable.
[0112] In order to verify the advantages of the model in this paper 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 performance of the model at different time scales. Figure 8 In the figure, the blue curve represents the actual observation value, while the yellow curve represents the model's predicted value. As can be seen from the figure, although the prediction period is gradually extended, the model can still maintain a high prediction accuracy over a longer time scale, demonstrating its remarkable stability and reliability.
[0113] This experiment uses 1399 data as the test set. Fig. 9 The RMSE, MAE and R of different models in each forecast period are shown. 2 Indicators. The results show that as the forecast period increases, the forecast performance of all models decreases to varying degrees, which is a common phenomenon in the field of water quality forecasting. The main reason is that the uncertainty gradually accumulates in long-term forecasts, which further increases the fluctuation of forecast errors. By comparing the performance of the three models of CCL, CL and SVM, we found that the CCL model is significantly better than the other two in each forecast period. This finding shows that the data processed by the CEEMDAN method has stronger adaptability, which further verifies the effectiveness of the CEEMDAN algorithm in improving the stability and universality of the model. In addition, the model in this paper not only performs well in all forecast periods, but also maintains a higher accuracy than other models in long-term forecasts. This advantage is attributed to the effective application of the self-attention mechanism in the model, which can capture long-term dependencies and enhance the model's ability to utilize historical information, thereby improving the overall forecast accuracy. This experimental result further proves that the model in this paper has better stability and accuracy than traditional methods when facing long-term forecasts.
[0114] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A method for predicting dissolved oxygen in water quality based on a hybrid machine learning model, comprising: Preprocessing the original dissolved oxygen data sequence obtained by the 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 and a residual part; Inputting each generated intrinsic mode function into a pre-trained water quality dissolved oxygen prediction model to obtain an intrinsic mode function prediction result group; The respective eigenmode function prediction results in the eigenmode function prediction result group are weightedly added to generate a final prediction result.
2. The method according to claim 1, wherein: The preprocessing of the original dissolved oxygen data sequence obtained by 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 a floating point type to obtain a converted dissolved oxygen data sequence; Reshaping the converted dissolved oxygen data in the converted dissolved oxygen data sequence to obtain a reshaped dissolved oxygen data sequence; The reshaped dissolved oxygen data in the reshaped dissolved oxygen data sequence are normalized to generate each normalized reshaped dissolved oxygen data as a preprocessed dissolved oxygen data sequence.
3. The method according to claim 1, wherein: The generated intrinsic mode functions are input into a pre-trained water quality dissolved oxygen prediction model to obtain an intrinsic mode function prediction result group, including: Inputting each of the intrinsic mode functions into a long short-term memory network layer included in a water quality dissolved oxygen prediction model to obtain a hidden feature state group; Inputting the hidden feature state group into a convolutional neural network layer to obtain a feature map group; Inputting the feature map group into the self-attention mechanism layer to obtain an attention feature group; Flattening the attention feature group to generate a flattened attention feature group; Inputting the flattened attention feature group into a fully connected layer to obtain an intrinsic mode function prediction result group; The generated individual intrinsic mode function prediction results are combined into an intrinsic mode function prediction result group.
4. The method according to claim 1, wherein: The decomposing process of the pre-processed dissolved oxygen data sequence to generate at least one intrinsic mode function and a residual part comprises: Performing data expansion processing on the preprocessed dissolved oxygen data series to generate an expanded dissolved oxygen data series; Based on the expanded dissolved oxygen data series, the following decomposition steps are performed: Generate a random noise sequence; Adding each expanded dissolved oxygen data in the expanded dissolved oxygen data sequence to each random noise in the random noise sequence to generate a plurality of simulation data to obtain a simulation data set; Performing multiple empirical mode decompositions on the simulation data set to obtain an intrinsic mode function set; averaging each intrinsic mode function in the intrinsic mode function set to generate an average intrinsic mode function; Determine the difference between the expanded dissolved oxygen data sequence and the average intrinsic mode function as a residual; In response to any preset stop condition in the preset stop condition group not being met, taking the residual as the expanded dissolved oxygen data sequence, and performing the decomposition step again; In response to satisfying any preset stop condition in the preset stop condition group, the generated at least one average natural mode function is determined as at least one eigenmode function, thereby obtaining at least one eigenmode function and a residual part.
5. The method according to claim 3, wherein: The step of inputting the feature map group into the self-attention mechanism layer to obtain an attention feature group includes: Multiply 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; Determine a dot product of each query vector in the query vector group and each key vector in the key vector group as an attention score to generate an attention score matrix, wherein the attention score matrix is a two-dimensional matrix; Normalizing each attention score in the attention score matrix to generate a normalized attention score matrix; For each normalized attention score in the normalized attention score matrix, a weighted sum is performed on the normalized attention score and each value vector in the value vector group to generate an attention feature.
Citation Information
Patent Citations
Method and apparatus for predicting dissolved oxygen in aquaculture
CN107016453A
Dissolved-oxygen prediction method and system based on long short-term memory network
CN108133297A
EMD and LSTM fused urban PM2.5 concentration prediction method
CN111144286A
Dissolved oxygen content prediction method based on EMD and LSTM
CN111898673A
Gas prediction method based on EMD-BiLSTM-Attention mechanism transformer digital twinborn model
CN115964932A