A method for predicting dissolved oxygen in a tidal river network region

By using long short-term memory networks and maximum mutual information coefficients to screen variables in tidal river networks, the nonlinear variation problem of dissolved oxygen prediction in tidal river networks was solved, and higher accuracy prediction results were achieved.

CN115456245BActive Publication Date: 2025-12-16SOUTH CHINA INST OF ENVIRONMENTAL SCI MEP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210967488.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-12
Publication Date
2025-12-16
Estimated Expiration
2042-08-12

AI Technical Summary

Technical Problem

Existing dissolved oxygen prediction models are ineffective at capturing nonlinear changes in dissolved oxygen in tidal river networks, and traditional machine learning models suffer from insufficient computational complexity and accuracy when dealing with complex water dynamics and nutrient cycling.

Method used

We used a Long Short-Term Memory (LSTM) network combined with Maximum Mutual Information Coefficient (MIC) to screen important environmental variables, built a deep learning model, and predicted dissolved oxygen changes through a data-driven approach. We used the TensorFlow framework to build the network and added Dropout mechanism and K-fold cross-validation to optimize the model parameters.

Benefits of technology

It improves the accuracy of dissolved oxygen prediction in tidal river networks, effectively handles nonlinear relationships, reduces model overfitting, and provides more accurate prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115456245B_ABST
    Figure CN115456245B_ABST
Patent Text Reader

Abstract

The application discloses a kind of tidal river network area dissolved oxygen prediction method, comprising the following steps: S1, data acquisition;S2, data screening: S2-1, mutual information definition;S2-2, range division;S2-3, maximum value is sought;S2-4, relevance analysis;S3, long short-term memory network model establishment: S3-1, framework construction;S3-2, initialization;S3-3, forward propagation calculation;S3-4, update weight;S3-5, root mean square error evaluation;S4, k-fold cross-validation;S5, calculation and prediction.The application fully considers that tidal river network area is influenced by tide, and dissolved oxygen presents the characteristics of periodic change, selects time lagged dissolved oxygen data as input variable, and identifies the key factor influencing the change of dissolved oxygen as input variable by maximum mutual information coefficient method, and uses deep machine learning model to establish long short-term memory network, which effectively solves the problem of gradient vanishing in traditional recurrent network.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of water quality prediction, and particularly relates to a dissolved oxygen prediction method for a tidal river network area. BACKGROUND

[0002] Dissolved oxygen is a key indicator of water environment, which is usually used to assess the health of aquatic ecosystems. Water hypoxia can greatly affect the metabolism, genetics and reproduction of aquatic organisms. The tidal river network area is affected by both runoff and tides, and the dynamic conditions are complex. Temperature, salinity and water stratification can all affect water reoxygenation, leading to low oxygen phenomenon (dissolved oxygen concentration ≤ 3 mg / L) in the tidal river network area. Predicting the change of dissolved oxygen concentration in the tidal river network area is beneficial to the early warning and risk optimization control of sudden low oxygen events in the water environment, and improves the water quality risk prevention and control and decision support ability of the tidal river network area.

[0003] Dissolved oxygen prediction models are mainly divided into process-driven models and data-driven models. Process-driven models are based on physical laws, which can capture the nonlinear interaction of water dynamics and nutrient cycling and the chemical and biological processes in water, fully simulate the mechanism of water pollution process, but the modeling process requires a large amount of environmental data and is highly dependent on it. The solving process is complex and requires a large amount of computing cost. When data is missing or the environment changes, it is difficult to simulate the water pollution process. Data-driven models are different from process-driven models and do not rely on physical mechanisms. They can capture the complex nonlinear relationship between target variables and explanatory variables and dynamically adapt to model elements (such as structure, algorithm and parameters). They can be used for nonlinear and highly random prediction and have been widely used in related research in the field of hydrology and water environment. The classic data-driven model time series prediction model requires data to have certain stationarity and linear correlation, and cannot handle nonlinear problems. Support vector machines (SVM), Boosting algorithm and maximum entropy method (MaxEnt) all belong to the category of shallow machine learning, and the system structure usually contains at most one or two layers of nonlinear feature conversion. They are effective in solving many simple or well-constrained problems, but their limited modeling and expression capabilities make it difficult to handle more complex real-world problems.

[0004] Long Short-Term Memory Network (LSTM) is one of the deep learning machine models, which realizes the automatic retention and abandonment of information by introducing input gate, forgetting gate and output gate on the basis of recurrent neural network, can realize effective association between past, present and future information in the prediction process, and solves the problem of gradient disappearance in traditional recurrent network, and has better prediction performance compared with traditional shallow learning network. In actual prediction, excessive input variables will increase the complexity of model calculation and reduce the performance of model, at this time, it is of great significance to identify and screen important factors driving the change of dissolved oxygen as input variables of the prediction model for predicting dissolved oxygen, and the Maximal Information Coefficient (MIC) can effectively capture the linear and nonlinear relationship between variables and is widely used in the screening of input variables in various research fields. The change of dissolved oxygen in the tidal river network area has a strong daily periodicity, and the change of dissolved oxygen at the same time every day has a similar change trend, but there is no good method to combine Long Short-Term Memory Network with the daily periodicity of dissolved oxygen change to make more accurate prediction of dissolved oxygen. SUMMARY

[0005] In view of the above problems, the present application provides a tidal river network area dissolved oxygen prediction method.

[0006] The technical scheme of the present application is:

[0007] A tidal river network area dissolved oxygen prediction method, comprising the following steps:

[0008] S1, data acquisition: establishing a water quality automatic station in the tidal river network area where dissolved oxygen prediction is needed, collecting water quality time series data through the water quality automatic station, and preprocessing the collected water quality time series data, the water quality time series data including dissolved oxygen and other environmental variables;

[0009] S2, data screening: calculating the maximal information coefficient of dissolved oxygen and other environmental variables in the water quality time series data obtained in step S1, screening out other environmental variables with greater correlation with dissolved oxygen as input variables of the Long Short-Term Memory Network;

[0010] S2-1, mutual information definition: mutual information is an index for measuring the correlation degree between other environmental variables and dissolved oxygen, given variables A={x i , i=1, 2,..., n} and B={y i , i=1, 2,..., n}, wherein n is the sample number, the mutual information I(A;B) of A and B is defined as:

[0011]

[0012] where p(x, y) is the joint probability density of A and B, p(x) is the marginal probability density of A, and p(y) is the marginal probability density of B;

[0013] S2-2, value range division: assuming D = {(a i , b), i = 1, 2,..., n} is a finite set, and the value range of variable A and variable B is divided into x segments and y segments respectively, obtaining a grid G of x x y, and then calculating the mutual information MI(A, B) in each grid division obtained, obtaining the maximum value G of the mutual information MI(A, B), then the maximum normalized value formula of the finite set D under the condition of the maximum value G is defined as:

[0014] MI*(D,x,y) = maxMI(D│G)

[0015] where D|G is the finite set D using grid G for division, and MI*(D,x,y) is the maximum normalized value;

[0016] S2-3, maximum value calculation: the maximum value of the characteristic matrix composed of the maximum normalized value obtained under each grid division is calculated, and the formula of the maximum information coefficient is obtained as:

[0017]

[0018] where MIC(D) is the maximum information coefficient;

[0019] S2-4, correlation analysis: taking dissolved oxygen as variable A and other environmental variables as variable B, the value of the maximum information coefficient MIC(D) of dissolved oxygen and other environmental variables is calculated, the value of the maximum information coefficient MIC(D) obtained is in the interval [0, 1], the greater the value of the maximum information coefficient MIC(D), the greater the correlation between dissolved oxygen and other environmental variables, the smaller the value of the maximum information coefficient MIC(D), the smaller the correlation between dissolved oxygen and other environmental variables, and the other environmental variables with greater correlation with dissolved oxygen are selected as input variables of the prediction model;

[0020] S3, long short-term memory network model establishment:

[0021] S3-1, framework construction: the long short-term memory network model comprises 1 input layer, 1 output layer and multiple hidden layers, each hidden layer is composed of multiple memory units, the memory units control the update and utilization of historical information by introducing a gating mechanism, and the gating mechanism includes an input gate i t , a forget gate i t f t and an output gate o t , the input gate i t, the forgetting gate f t and the output gate o t , whose values are in the interval [0, 1] to indicate the proportion of information passing through, and the cell state is periodically reset to avoid the accumulation of cell state, including candidate state internal state C t and external state h t , the input gate i t controls the candidate state of the current time, the forgetting gate f t controls how much information of the internal state C t of the previous time needs to be forgotten, and the output gate o t controls how much information of the internal state C t of the current time needs to be output to the external state h t , and the activation functions sigmoid (σ) and hyperbolic tangent function layer tanh are activated as follows:

[0022]

[0023]

[0024] S3-2, initialization: the matrix and vector of the memory unit are initialized to save the model parameters and save the intermediate calculation results, save the number of input layer and output layer neurons, the number of hidden layer cells, and the network state;

[0025] S3-3, forward propagation calculation: the long short-term memory network model determines the information discarded from the cell state, which is completed by the forgetting gate. First, the input information x t of the current time and the output information of the hidden layer external state h t-1 of the previous time are processed through the sigmoid (σ) function layer to obtain an output between 0 and 1, which is used as the filtering value of the internal state C t-1 of the previous time, that is, the formula of the forgetting gate f t :

[0026] f t =σ(W xf x t +W hf h t―1 +b f )

[0027] In the formula, W is the weight matrix, and the subscript of W represents the connection weight between two specific units, and b represents the bias term.

[0028] Secondly, the long short-term memory network model determines the information stored in the cell state. First, the input information x tand the output information of the hidden layer external state h t-1 at the previous time step is calculated by a sigmoid function layer to obtain an input gate i t with a value as shown in the following formula:

[0029] i t = σ(W xi x t +W hi h t―1 +b i )

[0030] Then a candidate state C is generated by a tanh function layer to update the cell state as shown in the following formula:

[0031]

[0032] Finally, the long short-term memory network model determines the output information of the cell, and the output information of the input information x t at the current time step and the hidden layer external state h t-1 at the previous time step is calculated by a sigmoid (σ) function layer to obtain an output gate o t as shown in the following formula:

[0033] o t = σ(W xo x t +W ho h t―1 +b o )

[0034] Then the internal state C t of the current cell is compressed to the interval [-1, 1] by a tanh function, and finally the compressed internal state C t of the cell is multiplied by the output gate o t to obtain the hidden layer external state h t output information at the current time step as shown in the following formula:

[0035] h t = o t tanh(C t )

[0036] The memory unit is also connected to other parts of the long short-term memory network model, and the output information of the hidden layer external state h t at the current time step is transmitted to the next time step as the input information of the hidden layer external state h t , and is also transmitted to the next time step as the input information of the hidden layer external state h tThe output information is transmitted to the next layer of long short-term memory network, when the next layer of long short-term memory network is a full connection layer, a transformation is performed on the hidden layer result to obtain final output information, so as to obtain the prediction value of the time sequence As shown in the following formula:

[0037]

[0038] In the formula, Vout is the weight matrix of the full connection layer, and b represents the bias term;

[0039] S3-4, updating weights: solving the gradient of each weight of the long short-term memory network, finding the optimal solution by using random gradient descent with training data, starting from the weight of the output layer to the input layer to find the gradient, updating each weight in turn, resetting the internal state, designing the error function, calculating and checking the gradient;

[0040] S3-5, root mean square error evaluation: training the time series data of other environmental variables related to dissolved oxygen through the long short-term memory network model, using the normalized and MIC screened time series data of other environmental variables as the training data set to train the long short-term memory network model, in order to alleviate the overfitting problem in the training process of the multivariate prediction model neural network, the Dropout mechanism is added in the training mechanism of the hidden layer, and the root mean square error is calculated to evaluate the prediction result of the long short-term memory network model after training, and the root mean square error is shown in the following formula:

[0041]

[0042] In the formula, is the prediction value of dissolved oxygen, and y(i) is the measured value of dissolved oxygen;

[0043] S4, k-fold cross-validation: the input variables obtained in step S2-4 are divided into k equal parts as the original data set, k-1 parts are selected as the training set each time, and the remaining 1 part is selected as the test set, different hyperparameter combinations are used to train k-1 parts and test the remaining 1 part, and the RMSE value of the test set is calculated, the steps of long short-term memory network model training and testing in steps S3-2 to S3-5 are repeated until each hyperparameter combination in the k original data sets is tested, and the RMSE average value of each final output information is calculated, the parameter combination with the minimum RMSE average value is the optimal combination, as shown in the following formula:

[0044]

[0045] S5, calculation and prediction: the real-time data of the water quality automatic station in the tidal river network area is input into the established long short-term memory network model after preprocessing, the predicted value of dissolved oxygen is obtained by scaling the output result of the long short-term memory network model, and a trend chart of dissolved oxygen is drawn by using the rolling prediction method.

[0046] Further, the other environmental variables of the water quality time series data in step S1 include pH, water temperature, conductivity, turbidity, water level, flow, ammonia nitrogen, total phosphorus, permanganate index, chemical oxygen demand, total nitrogen and DO 25h , the DO 25h is the corrected dissolved oxygen time series data, and DO 25h is the correction method: the length of a tidal period is 24h50min, the lag time is increased to 25h, and the corrected dissolved oxygen time series data obtained at this time is DO 25h .

[0047] Further, the preprocessing method in step S1 is: the missing value of the collected water quality time series data is supplemented and normalized.

[0048] S1-1, missing value interpolation: when the water quality time series data is missing, the average value of the adjacent two time data is used for interpolation.

[0049] S1-2, normalization processing: the formula of normalization processing is:

[0050]

[0051] In the formula, x' is the normalized water quality time series data, x is the water quality time series data before normalization, x min is the minimum value of the water quality time series data, and x max is the maximum value of the water quality time series data.

[0052] Further, when the value of the maximum information coefficient MIC(D) in step S2-4 is greater than 0.8, it is considered that the other environmental variables have greater correlation with dissolved oxygen. Generally, the MIC(D) value of dissolved oxygen and DO 25 is larger, about 0.7-0.8, and the correlation calculation is completed by the normalized_mutual_info_score in the python module sklearn.metrics.cluster.

[0053] Further, the model parameters in step S3-2 include weight matrix W and bias term b, and the intermediate calculation results include the output information of external state h t , input gate f t and forget gate i t, output gate o t .

[0054] Further, the Dropout mechanism in step S3-5 is that the neural units and their connections are randomly lost during the training process of the time series data of other environmental variables.

[0055] Further, the long short-term memory network model in step S3-1 is built based on the TensorFlow deep learning framework.

[0056] Further, the method of rolling prediction in step S5 is that according to the sampling interval of the existing dissolved oxygen prediction value, a reasonable prediction time step is set, assuming that the prediction time is n days, the long short-term memory network model will calculate and output the true value of the dissolved oxygen data of t+n days according to the t-day dissolved oxygen data in the test set and the important parameters screened out by the method S2, and then in t+2n days, the rolling prediction method is used to update the sequence information in time to avoid error accumulation.

[0057] The beneficial effects of the present application are:

[0058] The dissolved oxygen prediction method for the tidal river network area of the present application provides a solution for predicting the dissolved oxygen in the tidal river network area, fully considers the characteristics of the tidal river network area affected by tides and the periodic changes of dissolved oxygen, selects time-lagged dissolved oxygen data as input variables, and identifies key factors affecting the change of dissolved oxygen as input variables through the Maximal Information Coefficient (MIC) method, uses a deep machine learning model to establish a long short-term memory network (LSTM) to effectively solve the problem of gradient disappearance in traditional recurrent networks, and uses the K-fold cross-validation grid search method to select the optimal hyperparameter combination of the model, thereby improving the accuracy of the dissolved oxygen prediction in the tidal river network area. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 is the flow chart of the dissolved oxygen prediction method for the tidal river network area of the present application;

[0060] Figure 2 is a schematic diagram of step S3 in the experimental example of the dissolved oxygen prediction method for the tidal river network area of the present application;

[0061] Figure 3 is a schematic diagram of the test and training results of the long short-term memory network model in experimental example 1 of the dissolved oxygen prediction method for the tidal river network area of the present application;

[0062] Figure 4 is a schematic diagram of the test and training results of the long short-term memory network model in the experimental example 2 of the tidal river network area dissolved oxygen prediction method of the present application;

[0063] Figure 5 is a schematic diagram of the test and training results of the long short-term memory network model in the experimental example 3 of the tidal river network area dissolved oxygen prediction method of the present application. DETAILED DESCRIPTION

[0064] Embodiment 1

[0065] A tidal river network area dissolved oxygen prediction method, as shown in the figure, comprises the following steps: Figure 1

[0066] S1, data acquisition: establishing a water quality automatic station in a tidal river network area where dissolved oxygen prediction is needed, collecting water quality time series data through the water quality automatic station, and preprocessing the collected water quality time series data, the water quality time series data including dissolved oxygen and other environmental variables, the other environmental variables of the water quality time series data including pH, water temperature, conductivity, turbidity, water level, flow, ammonia nitrogen, total phosphorus, permanganate index, chemical oxygen demand, total nitrogen and DO 25h , the DO 25h is the corrected dissolved oxygen time series data, and the DO 25h correction method is: the length of one tidal cycle is 24h50min, the lag time is increased to 25h, and the corrected dissolved oxygen time series data obtained at this time is DO 25h ;

[0067] The preprocessing method is: missing value interpolation and normalization processing are performed on the collected water quality time series data;

[0068] S1-1, missing value interpolation: when the water quality time series data is missing, the average value of the adjacent two time data is used for interpolation;

[0069] The abnormal value (indicated by L or multiple 000 in the data secondary table) and the default value of the data are identified and marked as nan. When the water quality time series data is missing, the average value of the adjacent two time data is used for interpolation;

[0070] The sampling frequency is unified. In the data record of the water quality automatic station, non-integral point or integral day record may occur. Such cases are identified, and unified to integral day or integral hour according to the actual situation of each site;

[0071] Missing value interpolation: according to the unified sampling frequency of each site data, if there is no effective data at the corresponding time point, the nearest effective data is used for filling, and if the missing data is more than 12 time steps, linear interpolation is used for interpolation.​

[0072] S1-2, normalization processing: the formula of normalization processing is:

[0073]

[0074] In the formula, x' is the water quality time series data after normalization processing, x is the water quality time series data before normalization processing, x min is the minimum value of the water quality time series data, x max is the maximum value of the water quality time series data;

[0075] S2, data screening: calculate the maximum mutual information coefficient of dissolved oxygen and other environmental variables in the water quality time series data obtained in step S1, and screen out other environmental variables with greater correlation with dissolved oxygen as input variables of the long short-term memory network;

[0076] S2-1, mutual information definition: mutual information is an index for measuring the correlation degree between other environmental variables and dissolved oxygen. Given variables A={x i , i=1, 2,..., n} and B={y i , i=1, 2,..., n}, where n is the sample number, the mutual information I(A;B) of A and B is defined as:

[0077]

[0078] In the formula, p(x, y) is the joint probability density of A and B, p(x) is the marginal probability density of A, and p(y) is the marginal probability density of B;

[0079] S2-2, range division: assuming D={(a i , b), i=1, 2,..., n} is a finite set, and the value range of variable A and variable B is divided into x and y segments respectively, obtaining a grid G of x*y, then the mutual information MI(A, B) is calculated in each grid division obtained, and the maximum value G of the mutual information MI(A, B) is obtained, then the formula of the maximum normalized value of the finite set D under the condition of the maximum value G is defined as:

[0080] MI*(D,x,y)=maxMI(D│G)

[0081] In the formula, D|G is the finite set D divided by using the grid G, and MI*(D,x,y) is the maximum normalized value;

[0082] S2-3, maximum value calculation: the maximum value of the feature matrix composed of the maximum normalized values obtained under each grid division is calculated, and the formula of the maximum information coefficient is obtained as:

[0083]

[0084] In the formula, MIC(D) is the maximum information coefficient;

[0085] S2-4, correlation analysis: taking dissolved oxygen as variable A and other environmental variables as variable B, the value of the maximum information coefficient MIC(D) of dissolved oxygen and other environmental variables is calculated, the value of the maximum information coefficient MIC(D) obtained is in the interval [0, 1], the greater the value of the maximum information coefficient MIC(D), the greater the correlation between dissolved oxygen and other environmental variables, the smaller the value of the maximum information coefficient MIC(D), the smaller the correlation between dissolved oxygen and other environmental variables, select other environmental variables with greater correlation with dissolved oxygen as input variables of the prediction model, when the value of the maximum information coefficient MIC(D) is greater than 0.8, it is considered that other environmental variables have greater correlation with dissolved oxygen;

[0086] S3, long short-term memory network model establishment:

[0087] S3-1, framework construction: a long short-term memory network model is built based on a TensorFlow deep learning framework, the long short-term memory network model comprises 1 input layer, 1 output layer and 3 hidden layers, each hidden layer is composed of 20 memory cells, the memory cells control the update and utilization of historical information by introducing a gating mechanism, the gating mechanism includes an input gate i t , a forget gate i t f t and an output gate o t , the values of the input gate i t , the forget gate f t and the output gate o t are all in the interval [0, 1], which means that information passes through at a certain rate, and the cell state is regularly reset to avoid accumulation of cell state, the cell state includes candidate state internal state C t and external state h t , the input gate i t controls how much information of the candidate state at the current time needs to be saved, the forget gate f t controls how much information of the internal state C t at the last time needs to be forgotten, the output gate o t controls how much information of the internal state C t at the current time needs to be output to the external state h t , and the activation function sigmoid(σ) and the hyperbolic tangent function layer tanh are activated at the same time, as shown in the following formula:

[0088]

[0089]

[0090] S3-2, initialization: the matrix and vector of the memory unit are initialized to save the model parameters and save the intermediate calculation results, the model parameters include the weight matrix W and the bias term b, and the intermediate calculation results include the external state h t output information, input gate f t , forget gate i t , output gate o t , save the number of input layer and output layer neurons, the number of hidden layer cells, and the network state;

[0091] S3-3, forward propagation calculation: the long short-term memory network model determines the information discarded from the cell state, which is completed by the forget gate. First, the input information x t and the output information of the hidden layer external state h t-1 at the last time are processed by the sigmoid (σ) function layer to obtain an output between 0 and 1, which is used as the filtering value of the internal state C t-1 at the last time, that is, the formula of the forget gate f t is as follows:

[0092] f t = σ (W xf x t + W hf h t―1 + b f )

[0093] In the formula, W is the weight matrix, and the subscript of W represents the connection weight between two specific units. b represents the bias term;

[0094] Secondly, the long short-term memory network model determines the information stored in the cell state. First, the input information x t and the output information of the hidden layer external state h t-1 at the last time are calculated by the sigmoid function layer to obtain the input gate i t value, as shown in the following formula:

[0095] i t = σ (W xi x t + W hi h t―1 + b i )

[0096] Then, through the tanh function layer, a candidate state is generated for updating the cell state, as shown in the following formula:

[0097]

[0098] Finally, the long short-term memory network model determines the output information of the cell, and the output information of the current time input information x t and the hidden layer external state h t-1 of the last time is calculated through the sigmoid (σ) function layer to output the gate o t , as shown in the following formula:

[0099] o t = σ (W xo x t + W ho h t―1 + b o )

[0100] Then the internal state C t of the current cell is compressed to the interval [-1, 1] through the tanh function, and finally the compressed internal state C t of the cell is multiplied by the output gate o t to obtain the output information of the hidden layer external state h t at the current time, as shown in the following formula:

[0101] h t = o t tanh (C t )

[0102] The memory unit is also connected to other parts of the long short-term memory network model, and the output information of the hidden layer external state h t at the current time is transmitted to the next time as the input information of the hidden layer external state h t , and is transmitted to the next layer of long short-term memory network as the output information of the hidden layer external state h t . When the next layer of long short-term memory network is a fully connected layer, the hidden layer result is transformed to obtain the final output information, so as to obtain the prediction value of the time sequence , as shown in the following formula:

[0103]

[0104] In the formula, Vout is the weight matrix of the fully connected layer, and b represents the bias term.

[0105] S3-4, update the weight: solve the gradient of each weight of the long short-term memory network, find the optimal solution by using the training data to perform stochastic gradient descent, start from the weight of the output layer to the input layer to solve the gradient, update each weight in turn, reset the internal state, design the error function, calculate and check the gradient;

[0106] S3-5, root mean square error evaluation: the time series data of other environmental variables related to dissolved oxygen is trained by a long short-term memory network model, the time series data of other environmental variables after normalization and MIC screening is used as a training data set to train the long short-term memory network model, in order to alleviate the overfitting problem in the training process of the multivariate prediction model neural network, a Dropout mechanism is added in the training mechanism of the hidden layer, the Dropout mechanism is: in the training process of the time series data of other environmental variables, the neural units and their connections are randomly lost, after training, the root mean square error is calculated to evaluate the prediction result of the long short-term memory network model, the root mean square error is as follows:

[0107]

[0108] In the formula, is the predicted value of dissolved oxygen, y(i) is the measured value of dissolved oxygen;

[0109] S4, k-fold cross-validation: the input variables obtained in step S2-4 are divided into k equal parts as the original data set, k is 5, each time k-1 parts are selected as the training set, and the remaining 1 part is selected as the test set, different hyperparameter combinations are used to train k-1 parts and test the remaining 1 part, and the RMSE value of the test set is calculated, the steps of long short-term memory network model training and testing in steps S3-2~S3-5 are repeated, until each hyperparameter combination in the k original data sets is tested, and the RMSE average value of each final output information is calculated, the parameter combination with the minimum RMSE average value is the optimal combination, as shown in the following formula:

[0110]

[0111] S5, calculation and prediction: the real-time data of the tidal river network area water quality automatic station after preprocessing is input into the established long short-term memory network model, the prediction value of dissolved oxygen is obtained by scaling the output result of the long short-term memory network model, a rolling prediction method is adopted, and a trend chart of dissolved oxygen is drawn, the rolling prediction method in step S5 is as follows: according to the sampling interval of the existing dissolved oxygen prediction value, a reasonable prediction time step is set, assuming that the prediction time is n days, the long short-term memory network model will calculate and output the dissolved oxygen true value according to the t-day dissolved oxygen data in the test set and the important parameters screened out by the method described in S2, then in t+2n days, the t+n-day dissolved oxygen true value is used to screen other environmental variables, and the rolling prediction method is used to update the sequence information in time to avoid error accumulation.

[0112] Example 2

[0113] The embodiment is basically the same as embodiment 1, except that the number of hidden layers in step S3-1 framework construction is different.

[0114] S3-1, framework construction: a long short-term memory network model is built based on a TensorFlow deep learning framework, and the long short-term memory network model comprises 1 input layer, 1 output layer and 3 hidden layers.

[0115] Embodiment 3

[0116] The embodiment is basically the same as embodiment 1, except that the value of the maximum information coefficient MIC(D) in step S2-4 is different. The maximum information coefficient MIC(D) is 0.5, and the variables used for prediction include ammonia nitrogen and total phosphorus.

[0117] Experimental example 1

[0118] In order to verify the actual application effect of the present application, the actual measured water quality online observation data of a certain water quality automatic online station is selected for verification. The tidal river network area dissolved oxygen prediction method in embodiment 1 is used for prediction, and the selected station is Dalongyong station, and the time span is from January 1, 2019 to March 29, 2021. The sampling frequency of permanganate index, ammonia nitrogen, total phosphorus and total nitrogen is 4 hours, and the time sampling frequency of the remaining variables is 1 hour, as shown in table 1.

[0119] In step S1 data collection, the processed time series samples are 8832, in step S2, the MIC(D) values of temperature, pH, DO25, conductivity, turbidity, permanganate index, ammonia nitrogen, total phosphorus, total nitrogen and dissolved oxygen are calculated respectively, according to the MIC(D) value, 0.85 is taken as the threshold value, and DO25, conductivity, water temperature, ammonia nitrogen and total nitrogen concentration are selected as the prediction variables of the long short-term memory network model; in step S3, a long short-term memory network model is built based on the mainstream TensorFlow deep learning framework, and the hyperparameters involved in the prediction model are optimized, such as Figure 2 As shown in table 1, in step S4, k-fold cross-validation grid search method is used for optimization to obtain the optimal hyperparameter combination, 67% of the data in the sample is selected as the training set, the long short-term memory network model is trained, and the remaining 33% of the sample is selected as the test set, and the training and test results are shown in Figure 3 As shown in table 1, the calculation results of each related variable are shown in table 1, and the model parameter setting and result evaluation list are shown in table 2. After training, the root mean square error is calculated to evaluate the model performance, and the training set RMSE is 0.29 and the test set RMSE is 0.22.

[0120] Experimental example 2

[0121] The experimental example and experimental example 1 are basically the same, the difference is that the selected observation station is different, the data of the pier head base is selected to train and predict the model, the calculation results of each related variable are shown in table 1, the model parameter setting and result evaluation list are shown in table 2, and the training and test results are shown in Figure 4

[0122] Experimental example 3

[0123] The experimental example and experimental example 2 are basically the same, the difference is that the selected grid layer is different, the calculation results of each related variable are shown in table 1, the model parameter setting and result evaluation list are shown in table 2, and the training and test results are shown in Figure 5

[0124] Experimental example 4

[0125] The experimental example and experimental example 2 are basically the same, the difference is that the maximum information coefficient MIC(D) in example 3 is 0.5, the variables used for prediction include ammonia nitrogen and total phosphorus, the calculation results of each related variable are shown in table 1, the model parameter setting and result evaluation list are shown in table 2.

[0126] Experimental example 5

[0127] The experimental example and experimental example 1 are basically the same, the difference is that the step is changed, more input and output time steps are used, the calculation results of each related variable are shown in table 1, the model parameter setting and result evaluation list are shown in table 2.

[0128] Table 1 calculation results list of maximum information coefficient MIC(D) of each related variable in Dalongyong station and pientou base station

[0129]

[0130] Table 2 model parameter setting and result evaluation list in experimental cases 1-5

[0131] ​​

Claims

1. A method for predicting dissolved oxygen in a tidal river network region, characterized by, Comprising the following steps: S1, data acquisition: establishing a water quality automatic station in a tidal river network area where dissolved oxygen prediction is needed, collecting water quality time series data through the water quality automatic station, and preprocessing the collected water quality time series data, the water quality time series data including dissolved oxygen and other environmental variables; S2, data screening: calculating the maximum mutual information coefficient of the dissolved oxygen and other environmental variables in the water quality time series data obtained in step S1, screening out other environmental variables with greater correlation with dissolved oxygen as input variables of the long short-term memory network; S2-1, Mutual information definition: mutual information is an index for measuring the degree of correlation between other environmental variables and dissolved oxygen, given variables A = {x i , i = 1, 2,..., n} and B = {y i , i = 1, 2,..., n}, wherein n is the number of samples, and the mutual information I(A; B) of A and B is defined as follows: In the formula, p(x, y) is the joint probability density of A and B, p(x) is the marginal probability density of A, and p(y) is the marginal probability density of B; S2-2, Value range division: Assuming D = {(a i , b), i = 1, 2,..., n} is a finite set, and the value range of variable A and variable B is divided into x and y segments respectively, obtaining the grid G of x x y, and then calculating the mutual information MI(A, B) in each grid division, obtaining the maximum value G of the mutual information MI(A, B), and then defining the maximum normalized value formula of the finite set D under the condition of the maximum value G as follows: MI*(D,x,y)=maxMI(D│G) In the formula, D|G is a finite set D using grid G for division, and MI*(D,x,y) is the maximum normalized value; S2-3, maximum value calculation: calculating the maximum value of the feature matrix composed of the maximum normalized values obtained under each grid division, and the formula of the maximum information coefficient is: In the formula, MIC(D) is the maximum information coefficient; S2-4, correlation analysis: taking dissolved oxygen as variable A and other environmental variables as variable B, calculating the value of the maximum information coefficient MIC(D) of dissolved oxygen and other environmental variables, the value of the maximum information coefficient MIC(D) obtained is in the interval [0, 1], the greater the value of the maximum information coefficient MIC(D), the greater the correlation between dissolved oxygen and other environmental variables, and the smaller the value of the maximum information coefficient MIC(D), the smaller the correlation between dissolved oxygen and other environmental variables, and other environmental variables with greater correlation with dissolved oxygen are selected as input variables of the prediction model; S3, long short-term memory network model establishment: S3-1, Framework Construction: The Long Short-Term Memory (LSTM) network model comprises one input layer, one output layer, and multiple hidden layers. Each hidden layer consists of multiple memory units. These memory units utilize a gating mechanism to control the updating and utilization of historical information. The gating mechanism includes an input gate i... t Forgotten Gate t f t and output gate o t Input gate i t Forgotten Gate t and output gate o t The values ​​are all within the range [0, 1], indicating that information is allowed to pass through at a certain proportion. The cell state is reset periodically to avoid the continuous accumulation of cell states. The cell state includes candidate states. Internal state C t and external state h t Input gate i t Control the candidate state at the current moment How much information needs to be saved, and what about the forgetting gate? t Controlling the internal state C of the previous time step t How much information needs to be forgotten, output gate o t Control the internal state C at the current moment t How much information needs to be output to the external state h? t Simultaneously activate the sigmoid(σ) and hyperbolic tangent layer tanh, as shown in the following equation: S3-2, initialization: initializing the matrix and vector of the memory unit for saving model parameters and saving intermediate calculation results, saving the number of input layer and output layer neurons, the number of hidden layer cells, and network state; S3-3, forward propagation calculation: the long short-term memory network model determines the information discarded from the cell state, which is completed by the forget gate. First, the output information of the input information x t and the hidden layer external state h t-1 of the previous moment is processed by the sigmoid (σ) function layer to obtain an output between 0 and 1, which is the filtering value of the internal state C t-1 of the previous moment, that is, the formula of the forget gate f t . f t = σ(W xf x t + W hf h t―1 + b f ) In the formula, W is a weight matrix, the subscript of W represents the connection weight between two specific units, and b represents a bias term; Secondly, the long short-term memory network model determines the information stored in the cell state, first calculates the input information x t of the current moment and the output information of the hidden layer external state h t-1 of the last moment through a sigmoid function layer to obtain the input gate i t value, as shown in the following formula: i t = σ(W xi x t + W hi h t―1 + b i ) A candidate state is then produced by a hyperbolic tangent function layer tanh For the update of the cell state, as shown in the following formula: Finally, the long short-term memory network model determines the output information of the cell, and the output information of the current time input information x t and the hidden layer external state h t-1 of the last time is calculated through the sigmoid (σ) function layer to calculate the output gate o t , as shown in the following formula: o t = σ(W xo x t + W ho h t―1 + b o ) Then the internal state C of the current cell is compressed to the interval [-1, 1] by a tanh function, and finally the internal state C of the compressed cell is multiplied by the output gate o t to obtain the external state h of the hidden layer at the current moment t and the output information is as follows: t output gate o t ​ h t = o t tanh(C t ) The memory unit is also connected to other parts of the long short-term memory network model. The output information of the hidden layer external state h t at the current time is transmitted to the next time as input information of the hidden layer external state h t , and is transmitted to the next layer of the long short-term memory network as output information of the hidden layer external state h t . When the next layer of the long short-term memory network is a fully connected layer, a transformation is performed on the hidden layer result to obtain final output information, thereby obtaining a prediction value of the time sequence , as shown in the following formula: In the formula, Vout is a weight matrix of the full connection layer, and b represents a bias term; S3-4, weight update: solving the gradient of each weight of the long short-term memory network, finding the optimal solution by using random gradient descent on the training data, starting from the weight of the input layer to the output layer, updating each weight in turn, resetting the internal state, designing an error function, and calculating and checking the gradient; S3-5, root mean square error evaluation: training the time series data of other environmental variables related to dissolved oxygen through the long short-term memory network model, taking the normalized and MIC screened time series data of other environmental variables as the training data set to train the long short-term memory network model, adding a Dropout mechanism in the training mechanism of the hidden layer to alleviate the overfitting problem in the training process of the multivariate prediction model neural network, and calculating the root mean square error to evaluate the prediction result of the long short-term memory network model after training, the root mean square error is as follows: wherein is the predicted value of dissolved oxygen, y(i) is the measured value of dissolved oxygen; S4, k-fold cross-validation: divide the input variables obtained in step S2-4 into k equal parts as the original data set, select k-1 parts as the training set and the remaining 1 part as the test set each time, use different hyperparameter combinations to train k-1 parts and test the remaining 1 part, and calculate the RMSE value of the test set, repeat the steps of long short-term memory network model training and testing in steps S3-2 to S3-5, until each hyperparameter combination in the k parts of the original data set is tested, and the RMSE average value of each final output information is calculated, and the parameter combination with the minimum RMSE average value is the optimal combination, as shown in the following formula: S5, calculation and prediction: use the real-time data of the tidal river network area water quality automatic station after preprocessing to input into the established long short-term memory network model, and obtain the predicted value of dissolved oxygen through scaling the output result of the long short-term memory network model, and draw the trend chart of dissolved oxygen by using the rolling prediction method.

2. The method according to claim 1, wherein, Other environmental variables of water quality time series data in step S1 include pH, water temperature, conductivity, turbidity, water level, flow, ammonia nitrogen, total phosphorus, permanganate index, chemical oxygen demand, total nitrogen, and DO 25h , wherein the DO 25h is the corrected dissolved oxygen time series data, DO 25h The correction method is: the length of one tidal cycle is 24h50min, the lag time is increased to 25h, and the corrected dissolved oxygen time series data obtained at this time is DO 25h .

3. The method of claim 1, wherein, The preprocessing method in step S1 is: missing value interpolation and normalization processing are performed on the collected water quality time series data. S1-1, missing value interpolation: when the water quality time series data is missing, the average value of the adjacent two time data is used for interpolation; S1-2, normalization processing: the formula for normalization processing is: In the formula, x' is the normalized water quality time series data, x is the water quality time series data before normalization, x min is the minimum value in the water quality time series data, x max is the maximum value in the water quality time series data.

4. The method of claim 1, wherein, In step S2-4, when the value of the maximum information coefficient MIC(D) is greater than 0.8, it is considered that the other environmental variables have greater relevance to dissolved oxygen.

5. The method of claim 1, wherein, The model parameters in the step S3-2 include a weight matrix W and a bias term b, and the intermediate calculation result includes an external state h t , an output information, an input gate f t , a forget gate i t , and an output gate o t .

6. The method of claim 1, wherein, In step S3-5, the Dropout mechanism is: randomly losing neural units and their connections during the training process of the time series data of other environmental variables.

7. The method of claim 1, wherein, In step S3-1, the long short-term memory network model is built based on the TensorFlow deep learning framework.

8. The method of claim 1, wherein, In step S5, the rolling prediction method is specifically: according to the sampling interval of the existing dissolved oxygen prediction value, a reasonable prediction time step is set, assuming that the prediction time is n days, the long short-term memory network model will calculate and output the dissolved oxygen true value according to the t-day dissolved oxygen data in the test set and the important parameters selected by the method described in S2, then in t+2n days, the t+n-day dissolved oxygen true value is used to select other environmental variables by the method described in S2, and the rolling prediction method is used to update the sequence information in time.