A method for predicting effluent BOD concentration based on WSFA-AFE ILSTM neural network
By using an ILSTM neural network based on WSFA-AFE and optimizing the LSTM structure with weighted slow feature analysis and adaptive sliding window algorithm, the problem of low efficiency in predicting effluent BOD concentration in wastewater treatment by traditional LSTM is solved, and high-precision and efficient prediction of future effluent BOD concentration is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING UNIV OF TECH
- Filing Date
- 2023-01-09
- Publication Date
- 2026-04-21
AI Technical Summary
Existing technologies cannot effectively predict the effluent BOD concentration at future moments during wastewater treatment, and traditional LSTM neural networks suffer from low efficiency and overfitting issues.
An ILSTM neural network method based on WSFA-AFE is adopted. The LSTM structure is optimized by weighted slow feature analysis and adaptive sliding window algorithm, and combined with adaptive learning rate adjustment to achieve efficient and accurate prediction of effluent BOD concentration.
It achieves high-precision prediction of effluent BOD concentration at future moments, has good generalization ability and fewer neural network parameters, and the training process is more efficient.
Smart Images

Figure CN116306803B_ABST
Abstract
Description
Technical Field
[0001] This invention utilizes an improved Long-Short Term Memory (ILSTM) neural network method based on Weighted Slow Feature Analysis (WSFA-AFE) to accurately predict the biochemical oxygen demand (BOD) of wastewater effluent at future moments. This invention relates to the field of artificial intelligence and has direct applications in the wastewater treatment field. Background Technology
[0002] Wastewater effluent BOD is a key parameter describing wastewater characteristics, reflecting the degree of organic pollution in the water body. Currently, measurement methods mainly include dilution and inoculation, manual timed sampling, and sensor detection. However, these methods can only detect the current effluent BOD concentration and cannot predict the future effluent BOD concentration. Predicting the future effluent BOD concentration based on current and past BOD multivariate time series information, and thus determining the future trend of effluent BOD concentration, can provide a strong basis for wastewater treatment plant application decisions. In recent years, LSTM has been widely used in multivariate time series forecasting, but its prediction effect largely depends on its input data. Furthermore, traditional LSTM, due to its complex structure, is prone to efficiency reduction and overfitting problems. Therefore, this invention designs an effluent BOD concentration prediction method based on an WSFA-AFE-based ILSTM neural network, achieving efficient, accurate, and low-cost prediction of future effluent BOD concentration, providing a reference for scientific decision-making by relevant departments. Summary of the Invention
[0003] This invention provides a method for predicting effluent BOD concentration based on an ILSTM neural network using WSFA-AFE. It achieves efficient, accurate, and low-cost prediction of effluent BOD concentration at future moments based on data collected during the wastewater treatment process.
[0004] A method for predicting effluent BOD concentration using an ILSTM neural network based on WSFA-AFE, characterized by the following steps:
[0005] Step 1: Select historical multivariate time series data of effluent BOD concentration to generate prediction samples;
[0006] Obtain effluent BOD concentration data from wastewater treatment plants in And T represents the time span, representing 365 sets of data. N represents the number of all variables, which is 8 variables in this case. tThe columns in the table represent: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, influent phosphate concentration, and effluent BOD concentration, respectively. Furthermore, let P = {x} t N x, where t = 1, 2, ..., T t The last column represents the predictor variable, which is the effluent BOD concentration. x represents t The first seven columns represent external variables: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, and influent phosphate concentration. Furthermore, a sliding window method can be used to... The most recent M data points are truncated for prediction. This invention adaptively determines the size of M, which takes a value between 2 and 8. N represents the total number of variables, which is 8.
[0007] Step 2: Design the WSFA-AFE method;
[0008] Step 2.1: Design a weighted slow feature analysis to obtain the mapping matrix g. p Generate slow features and use weighting coefficients η i Weighting;
[0009] Step 2.1.1: Obtain the second-order extension term S from matrix X, where N represents the number of all variables, which is 8, and T represents 365 sets of data;
[0010]
[0011] Step 2.1.2: Solve for the mapping matrix g p And map the second-order extension term S to the slow feature s;
[0012] Let s = [g1(S),...,g P (S)], where P = (N-1) + N(N-1) / 2, N = 8 represents all variables, therefore P = 35, g p (p = 1, 2, ..., P) can be obtained by solving the following formula:
[0013]
[0014] subject to <g p >=0(3)
[0015] <(g p ) 2 >=1(4)
[0016]
[0017] in, It is g p The derivative with respect to time, 〈·〉, represents the time average; formula (2) indicates that g p The derivative or rate of change Δg p The square of the minimum value is minimized; Formula (3) is used to ensure that the mapped slow features have zero mean; Formula (4) is used to ensure that the mapped slow features have unit variance; Formula (5) is used to ensure that the outputs of the mapping function are independent of each other and the slowness of the features gradually decreases, that is, g1 is the slowest feature extracted, where p' and p have the same range of values, and p' is a value less than p; Formulas (2)-(5) are existing methods for slow feature analysis and are implemented using MATLAB functions;
[0018] Step 2.1.3: Select the desired slow feature F from s;
[0019] And u represents the number of slow features selected, and vector g p (S) The AR model in MATLAB is used to model and measure the slowness of slow features, and the difference in slowness between each feature and the previous one is calculated sequentially. When the difference in slowness is more than 1.5 times greater than the previous difference, the selection of slow features is stopped. Through the AR model, the slowness of g1(S) is 0.9988, g2(S) is 0.9884, g3(S) is 0.9781, and g4(S) is 0.9608. The difference in slowness between feature 2 and feature 1 is 0.0104, between feature 3 and feature 2 is 0.0103, and between feature 4 and feature 3 is 0.0173. Therefore, u is taken as 3 in this data. Where f... t This represents all the selected slow features at time t.
[0020] Step 2.1.4: Set the maximum sliding window L using the preset parameters. max The value of u is 8, and the multivariate time series X is reconstructed into E. The value of u is 3, and the value of T is 365.
[0021]
[0022] in And r = 1, 2, ..., L max +1. Its last column This represents the predicted effluent BOD concentration, with the i-th column of E representing the desired concentration. i From the coefficient η i Weighted, where i = 1, 2, ..., (L max ·(u+1)), calculated by the following formula:
[0023]
[0024] in, It is E i and The maximum information coefficient between them, V=(L max ·(u+1)) represents historical data L in E. max The total number of columns for each data point.
[0025] Step 2.1.5: Calculate the input weighting matrix, L max =8 and u=3;
[0026] Using η i Weight the elements of the input matrix, Q = {[η] i ×E i ], i = 1, 2, ..., (L max ·(u+1))}.
[0027] Step 2.2: Design an adaptive sliding window algorithm;
[0028]
[0029]
[0030] L max and L min This represents the maximum and minimum values of the sliding window, which are empirically set to 8 and 2. It is L max and L min The average value is 5. ||ΔO t ||=||R t -R t-1 || is R t-1 and R t The difference between the Euclidean norms, of which The historical time-based predictor variable used at time t measures data fluctuation from a distance perspective. cosθ t It is R t-1 and R t The cosine similarity between them measures the fluctuation of the data from a directional perspective. |ΔV t |=|ΔV t -ΔV t-1 |Is V t and V t-1 The difference in absolute value, V t and V t-1 Representing R respectively t and R t-1 The variances of |ΔO0, cosθ0, and |ΔV0| are respectively ||ΔO0| ... t ||、cosθ t and |ΔV t|The average value at historical moments.
[0031] As can be seen from the formula, when R t and R t-1 As the difference between the two values increases, a smaller β will be obtained. Therefore, the sliding window size at time t will decrease accordingly to capture data fluctuations. Conversely, when R... t and R t-1 As the differences between variables decrease, the sliding window size increases accordingly to capture the long-term trend of the predictor variable. Based on this sliding window algorithm, the sliding window size achieves a trade-off between capturing local fluctuations and overall trends. The adaptive adjustment of the sliding window size allows historical slow features to be dynamically truncated as input to the ILSTM.
[0032] Step 3: Design the ILSTM neural network structure (compared to the traditional LSTM neural network, ILSTM has been optimized in terms of both structure and algorithm);
[0033] In terms of structure: the designed ILSTM neural network structure contains three gates (forget gate, input gate, and output gate). Compared with the traditional LSTM, each value of the recursive term weight in each gate represents the connection between the neuron's output at the previous time step and the neuron at the current time step, rather than the connection between the neuron and all neurons in the standard LSTM. The number of hidden layer units in the ILSTM is set to 15. The computational functions of each structure in the ILSTM are as follows:
[0034] ① Input gate: Input gate i t The amount of new information added to the current state unit is controlled and calculated as follows:
[0035]
[0036] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. i and Q i These are the input weight matrix and the recursive term weight matrix in the input gate, respectively. i This is the bias matrix in the input gate. This represents element-wise matrix multiplication, where σ is the sigmoid activation function.
[0037] ②Forget Gate: Forget Gate f t The degree to which the network forgets the state information from the previous time step is determined to allow the network to reset its state, and is calculated as follows:
[0038]
[0039] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. f and Q f These are the input weight matrix and the recursive term weight matrix in the forget gate, respectively. f This is the bias matrix in the forget gate. This represents element-wise matrix multiplication, where σ is the sigmoid activation function.
[0040] ③ Current state unit c t The current state information is combined with the previous state information to calculate the following:
[0041]
[0042] Among them, c t-1 For the state information of the previous time step, i t Indicates the input gate, f t Represents the forget gate, z t The current state information is calculated as follows:
[0043]
[0044] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. z and Q z These are the input weight matrix and the recursive term weight matrix in the current state, respectively, b z This is the bias matrix in the current state.
[0045] ④ Output gate: The output gate determines the final output h of the LSTM at the current time. t The calculation is as follows:
[0046]
[0047]
[0048] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. o and Q oThese are the input weight matrix and the recursive term weight matrix in the output gate, respectively. o h is the bias matrix in the output gate. t Let be the output vector at time t.
[0049] Step 4: Design the ILSTM neural network learning algorithm (compared with the traditional LSTM neural network, ILSTM has been optimized in terms of both structure and algorithm);
[0050] Regarding the algorithm: Compared with traditional algorithms, the training algorithm maintains an appropriate learning rate, accelerates the training convergence speed, and ensures the stability and convergence of the algorithm.
[0051] Step 4.1: Define the loss function;
[0052]
[0053] Among them, y rt and y t These are the expected and actual outputs of the ILSTM, respectively, and the model output h for different unit state dimensions. t It needs to be converted into a single-dimensional y-dimensional object. t The conversion formula is shown in formula (17), where W y and b y W is the weight matrix of the output layer. y and bias b y :
[0054] y t =W y h t +b y (17)
[0055] Step 4.2: Design the AMSGD algorithm to update the ILSTM model parameters
[0056] ① Calculate the gradient of the output layer parameters;
[0057] For the output layer, the loss function is for W. y and b y The gradients are calculated as shown in formulas (18) and (19):
[0058]
[0059]
[0060] ② Update the output layer parameters;
[0061] Weight W y and b y The update formulas are shown in formulas (20) and (21) respectively:
[0062]
[0063]
[0064] Among them, W y,t+1 W is the output layer weight at time t+1. y,t W is the output layer weight at time t. y,t-1 The output layer weights at time t-1, b y,t+1 It is the output layer bias at time t+1, b y,t It is the output layer bias at time t, b y,t-1 This is the output layer bias at time t-1. η is the learning rate, which is 0.01, and β is the momentum coefficient, which is 0.9.
[0065] ③ Define the loss function for h t f t i t z t o t The partial derivative;
[0066] Define δ h,t For the loss function with respect to h t The partial derivative of is denoted as shown in formula (22):
[0067]
[0068] Similarly, define δ f,t δ i,t δ z,t δ o,t The loss function is for each pair of f t i t z t o t The partial derivatives are shown in equations (23)-(26):
[0069]
[0070]
[0071]
[0072]
[0073] ④ Calculate the gradient of the hidden layer parameters;
[0074] The gradients of the loss function with respect to each weight matrix and bias vector throughout the process are shown in equations (27)-(29):
[0075]
[0076]
[0077]
[0078] Where θ is any one of {f,i,z,o}.
[0079] ⑤ Update hidden layer parameters;
[0080] The weight update formulas are shown in formulas (30)-(32):
[0081]
[0082]
[0083]
[0084] In the formula, θ is any one of {f,i,z,o}, and W θ,t+1 Q θ,t+1 b θ,t+1 These represent the input weight matrix, the recursive term weight matrix, and the bias vector, respectively. η is the learning rate, which is 0.01, and β is the momentum coefficient, with a value of 0.9. At this point, all parameters have been updated.
[0085] ⑥ After each iteration, determine the stopping condition, which is reaching the maximum number of iterations of 2000. When the stopping condition is met, the parameter update process ends; otherwise, return to step ① to train the parameters.
[0086] In addition, during the learning process, an adaptive adjustment mechanism for the learning rate is set up, as shown in formula (33):
[0087]
[0088] RMSE(n) is the root mean square error function in the nth iteration. If the direction of weight correction is incorrect, the error function value increases, and it needs to be multiplied by a damping factor k. dec To reduce the learning rate; when the error function value decreases, it indicates that the direction of weight correction is correct, and it can be improved by multiplying by an increment factor k. inc To increase the learning step size. dec With k inc The values were set to 0.95 and 1.05 respectively. This method maintains an appropriate learning rate, accelerates training convergence, and ensures the stability and convergence of the algorithm. To guarantee prediction performance, this paper sets upper and lower thresholds for the learning rate, limiting its adjustment range to between 0.001 and 0.1.
[0089] Step 5: Predict the BOD of the effluent;
[0090] The test sample data is used as the input to the trained ILSTM neural network to obtain the output of the ILSTM neural network.
[0091] Beneficial effects:
[0092] (1) In view of the problem that the current wastewater treatment process cannot predict the effluent BOD concentration in the future, this invention proposes an effluent BOD concentration prediction method based on WSFA-AFE ILSTM neural network, which can predict the effluent BOD concentration in the future and has the characteristics of high accuracy, good generalization ability and few neural network parameters.
[0093] (2) To address the problem that the input feature variables and input historical step size are difficult to determine when using neural networks to predict effluent BOD in multivariate time series, this invention proposes a WSFA-AFE method. This method can adaptively extract dynamic feature variables from the multivariate time series, enabling the neural network to better predict effluent BOD concentration.
[0094] (3) To address the problem of numerous structural parameters and long training time in standard LSTM neural networks, this paper proposes an ILSTM neural network. By simplifying the weights of recursive terms in the structural equation, the number of training parameters required in the network is reduced, and the convergence speed is accelerated through a parameter update algorithm, thus achieving more efficient and accurate prediction of effluent BOD concentration. Attached image description:
[0095] Figure 1 This is a diagram of the internal structure of the neural network of the present invention;
[0096] Figure 2 This is a flowchart of the method of the present invention;
[0097] Figure 3 The graph shows the variation of the root mean square error (RMSE) during training of the effluent BOD concentration prediction method of this invention.
[0098] Figure 4 This is a graph showing the predicted BOD concentration in the effluent according to the present invention.
[0099] Figure 5 This is a graph showing the error in predicting the effluent BOD concentration according to the present invention. Detailed implementation method:
[0100] This invention provides a method for predicting effluent BOD concentration based on an ILSTM neural network using WSFA-AFE. This method predicts the effluent BOD concentration at future times based on data collected during the wastewater treatment process. It solves the problem of difficulty in measuring the future effluent BOD concentration during wastewater treatment, thus improving the monitoring level of water quality at future times for urban wastewater treatment plants.
[0101] The experimental data came from the 2011 water quality analysis data of a wastewater treatment plant, including eight water quality variables: (1) influent BOD concentration; (2) dissolved oxygen concentration in the biological treatment tank; (3) influent oil content; (4) effluent ammonia nitrogen concentration; (5) influent color; (6) effluent total nitrogen concentration; (7) influent phosphate concentration; and (8) effluent BOD concentration. A total of 365 samples were collected. The maximum sliding window L was used. max =8 were reconstructed, and the total data volume was 365-L. max A total of 357 sets of data were collected, with the first 250 samples used for training and the last 107 samples used for testing.
[0102] A method for predicting effluent BOD concentration using an ILSTM neural network based on WSFA-AFE, characterized by the following steps:
[0103] Step 1: Select historical multivariate time series data of effluent BOD concentration to generate prediction samples;
[0104] Obtain effluent BOD concentration data from wastewater treatment plants in And T represents the time span, representing 365 sets of data. N represents the number of all variables, which is 8 variables in this case. t The columns in the table represent: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, influent phosphate concentration, and effluent BOD concentration, respectively. Furthermore, let P = {x} t N x, where t = 1, 2, ..., T t The last column represents the predictor variable, which is the effluent BOD concentration. x represents t The first seven columns represent external variables: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, and influent phosphate concentration. Furthermore, a sliding window method can be used to... The most recent M data points are truncated for prediction. This invention adaptively determines the size of M, which takes a value between 2 and 8. N represents the total number of variables, which is 8.
[0105] Step 2: Design the WSFA-AFE method;
[0106] Step 2.1: Design a weighted slow feature analysis to obtain the mapping matrix g. p Generate slow features and use weighting coefficients η i Weighting;
[0107] Step 2.1.1: Obtain the second-order extension term S from matrix X, where N represents the number of all variables, which is 8, and T represents 365 sets of data;
[0108]
[0109] Step 2.1.2: Solve for the mapping matrix g p And map the second-order extension term S to the slow feature s;
[0110] Let s = [g1(S),...,g P (S)], where P = (N-1) + N(N-1) / 2, N = 8 represents all variables, therefore P = 35, g p (p = 1, 2, ..., P) can be obtained by solving the following formula:
[0111]
[0112] subject to <g p >=0 (3)
[0113] <(g p ) 2 >=1 (4)
[0114]
[0115] in, It is g p The derivative with respect to time, ·> denotes the time average; formula (2) indicates that g p The derivative or rate of change Δg p The square of the minimum value is minimized; Formula (3) is used to ensure that the mapped slow features have zero mean; Formula (4) is used to ensure that the mapped slow features have unit variance; Formula (5) is used to ensure that the outputs of the mapping function are independent of each other and the slowness of the features gradually decreases, that is, g1 is the slowest feature extracted, where p' and p have the same range of values, and p' is a value less than p; Formulas (2)-(5) are existing methods for slow feature analysis and are implemented using MATLAB functions;
[0116] Step 2.1.3: Select the desired slow feature F from s;
[0117] And u represents the number of slow features selected, and vector g p(S) The AR model in MATLAB is used to model and measure the slowness of slow features, and the difference in slowness between each feature and the previous one is calculated sequentially. When the difference in slowness is more than 1.5 times greater than the previous difference, the selection of slow features is stopped. Through the AR model, the slowness of g1(S) is 0.9988, g2(S) is 0.9884, g3(S) is 0.9781, and g4(S) is 0.9608. The difference in slowness between feature 2 and feature 1 is 0.0104, between feature 3 and feature 2 is 0.0103, and between feature 4 and feature 3 is 0.0173. Therefore, u is taken as 3 in this data. Where f... t This represents all the selected slow features at time t.
[0118] Step 2.1.4: Set the maximum sliding window L using the preset parameters. max The value of u is 8, and the multivariate time series X is reconstructed into E. The value of u is 3, and the value of T is 365.
[0119]
[0120] in And r = 1, 2, ..., L max +1. Its last column This represents the predicted effluent BOD concentration, with the i-th column of E representing the desired concentration. i From the coefficient η i Weighted, where i = 1, 2, ..., (L max ·(u+1)), calculated by the following formula:
[0121]
[0122] in, It is E i and The maximum information coefficient between them, V=(L max ·(u+1)) represents historical data L in E. max The total number of columns for each data point.
[0123] Step 2.1.5: Calculate the input weighting matrix, L max =8 and u=3;
[0124] Using η i Weight the elements of the input matrix, Q = {[η] i ×E i ], i = 1, 2, ..., (L max ·(u+1))}.
[0125] Step 2.2: Design an adaptive sliding window algorithm;
[0126]
[0127]
[0128] L max and L min This represents the maximum and minimum values of the sliding window, which are empirically set to 8 and 2. It is L max and L min The average value is 5. ||ΔO t ||=||R t -R t-1 || is R t-1 and R t The difference between the Euclidean norms, of which The historical time-based predictor variable used at time t measures data fluctuation from a distance perspective. cosθ t It is R t-1 and R t The cosine similarity between them measures the fluctuation of the data from a directional perspective. |ΔV t |=|ΔV t -ΔV t-1 |Is V t and V t-1 The difference in absolute value, V t and V t-1 Representing R respectively t and R t-1 The variances of |ΔO0, cosθ0, and |ΔV0| are respectively ||ΔO0| ... t ||、cosθ t and |ΔV t |The average value at historical moments.
[0129] As can be seen from the formula, when R t and R t-1 As the difference between the two values increases, a smaller β will be obtained. Therefore, the sliding window size at time t will decrease accordingly to capture data fluctuations. Conversely, when R... t and R t-1 As the differences between variables decrease, the sliding window size increases accordingly to capture the long-term trend of the predictor variable. Based on this sliding window algorithm, the sliding window size achieves a trade-off between capturing local fluctuations and overall trends. The adaptive adjustment of the sliding window size allows historical slow features to be dynamically truncated as input to the ILSTM.
[0130] Step 3: Design the ILSTM neural network structure (compared to the traditional LSTM neural network, ILSTM has been optimized in terms of both structure and algorithm);
[0131] In terms of structure: the designed ILSTM neural network structure contains three gates (forget gate, input gate, and output gate). Compared with the traditional LSTM, each value of the recursive term weight in each gate represents the connection between the neuron's output at the previous time step and the neuron at the current time step, rather than the connection between the neuron and all neurons in the standard LSTM. The number of hidden layer units in the ILSTM is set to 15. The computational functions of each structure in the ILSTM are as follows:
[0132] ① Input gate: Input gate i t The amount of new information added to the current state unit is controlled and calculated as follows:
[0133]
[0134] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. i and Q i These are the input weight matrix and the recursive term weight matrix in the input gate, respectively. i This is the bias matrix in the input gate. This represents element-wise matrix multiplication, where σ is the sigmoid activation function.
[0135] ②Forget Gate: Forget Gate f t The degree to which the network forgets the state information from the previous time step is determined to allow the network to reset its state, and is calculated as follows:
[0136]
[0137] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. f and Q f These are the input weight matrix and the recursive term weight matrix in the forget gate, respectively. f This is the bias matrix in the forget gate. This represents element-wise matrix multiplication, where σ is the sigmoid activation function.
[0138] ③ Current state unit c t The current state information is combined with the previous state information to calculate the following:
[0139]
[0140] Among them, ct-1 For the state information of the previous time step, i t Indicates the input gate, f t Represents the forget gate, z t The current state information is calculated as follows:
[0141]
[0142] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. z and Q z These are the input weight matrix and the recursive term weight matrix in the current state, respectively, b z This is the bias matrix in the current state.
[0143] ④ Output gate: The output gate determines the final output h of the LSTM at the current time. t The calculation is as follows:
[0144]
[0145]
[0146] Where, x t Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.4. t The vector formed by sequentially connecting the first and second elements of row t-1. t-1 Let W be the output vector at time t-1. o and Q o These are the input weight matrix and the recursive term weight matrix in the output gate, respectively. o h is the bias matrix in the output gate. t Let be the output vector at time t.
[0147] Step 4: Design the ILSTM neural network learning algorithm (compared with the traditional LSTM neural network, ILSTM has been optimized in terms of both structure and algorithm);
[0148] Regarding the algorithm: Compared with traditional algorithms, the training algorithm maintains an appropriate learning rate, accelerates the training convergence speed, and ensures the stability and convergence of the algorithm.
[0149] Step 4.1: Define the loss function;
[0150]
[0151] Among them, y rt and yt These are the expected and actual outputs of the ILSTM, respectively, and the model output h for different unit state dimensions. t It needs to be converted into a single-dimensional y-dimensional object. t The conversion formula is shown in formula (17), where W y and b y W is the weight matrix of the output layer. y and bias b y :
[0152] y t =W y h t +b y (17)
[0153] Step 4.2: Design the AMSGD algorithm to update the ILSTM model parameters
[0154] ① Calculate the gradient of the output layer parameters;
[0155] For the output layer, the loss function is for W. y and b y The gradients are calculated as shown in formulas (18) and (19):
[0156]
[0157]
[0158] ② Update the output layer parameters;
[0159] Weight W y and b y The update formulas are shown in formulas (20) and (21) respectively:
[0160]
[0161]
[0162] Among them, W y,t+1 W is the output layer weight at time t+1. y,t W is the output layer weight at time t. y,t-1 The output layer weights at time t-1, b y,t+1 It is the output layer bias at time t+1, b y,t It is the output layer bias at time t, b y,t-1 This is the output layer bias at time t-1. η is the learning rate, which is 0.01, and β is the momentum coefficient, which is 0.9.
[0163] ③ Define the loss function for h t f t i t zt o t The partial derivative;
[0164] Define δ h,t For the loss function with respect to h t The partial derivative of is denoted as shown in formula (22):
[0165]
[0166] Similarly, define δ f,t δ i,t δ z,t δ o,t The loss function is for each pair of f t i t z t o t The partial derivatives are shown in equations (23)-(26):
[0167]
[0168]
[0169]
[0170]
[0171] ④ Calculate the gradient of the hidden layer parameters;
[0172] The gradients of the loss function with respect to each weight matrix and bias vector throughout the process are shown in equations (27)-(29):
[0173]
[0174]
[0175]
[0176] Where θ is any one of {f,i,z,o}.
[0177] ⑤ Update hidden layer parameters;
[0178] The weight update formulas are shown in formulas (30)-(32):
[0179]
[0180]
[0181]
[0182] In the formula, θ is any one of {f,i,z,o}, and Wθ,t+1 Q θ,t+1 b θ,t+1 These represent the input weight matrix, the recursive term weight matrix, and the bias vector, respectively. η is the learning rate, which is 0.01, and β is the momentum coefficient, with a value of 0.9. At this point, all parameters have been updated.
[0183] ⑥ After each iteration, determine the stopping condition, which is reaching the maximum number of iterations of 2000. When the stopping condition is met, the parameter update process ends; otherwise, return to step ① to train the parameters.
[0184] In addition, during the learning process, an adaptive adjustment mechanism for the learning rate is set up, as shown in formula (33):
[0185]
[0186] RMSE(n) is the root mean square error function in the nth iteration. If the direction of weight correction is incorrect, the error function value increases, and it needs to be multiplied by a damping factor k. dec To reduce the learning rate; when the error function value decreases, it indicates that the direction of weight correction is correct, and it can be improved by multiplying by an increment factor k. inc To increase the learning step size. dec With k inc The values were set to 0.95 and 1.05 respectively. This method maintains an appropriate learning rate, accelerates training convergence, and ensures the stability and convergence of the algorithm. To guarantee prediction performance, this paper sets upper and lower thresholds for the learning rate, limiting its adjustment range to between 0.001 and 0.1.
[0187] Step 5: Predict the BOD of the effluent;
[0188] The test sample data is used as the input to the trained ILSTM neural network to obtain the output of the ILSTM neural network.
[0189] In this embodiment, the training RMSE of the effluent BOD concentration prediction method is as follows: Figure 3 As shown, the X-axis represents the number of iterations, and the Y-axis represents the training RMSE value; the predicted BOD concentration of the effluent is as follows. Figure 4 As shown, the X-axis represents the number of test samples, and the Y-axis represents the effluent BOD concentration in mg / L. The solid line represents the actual output value of the effluent BOD concentration, and the star line represents the expected output value of the effluent BOD concentration. The effluent BOD concentration test error is as follows: Figure 5 As shown, the X-axis represents the number of test samples, and the Y-axis represents the prediction error of effluent BOD concentration, with the unit being mg / L.
[0190] Tables 1-17 present the experimental data of this invention, with Tables 1-8 representing the training samples: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, influent phosphate concentration, and effluent BOD concentration. Tables 9-16 present the test samples: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, influent phosphate concentration, and effluent BOD concentration. Table 17 shows the predicted effluent BOD value of this invention.
[0191] Training samples:
[0192] Table 1. External variable: Influent BOD concentration (mg / L)
[0193]
[0194]
[0195] Table 2. External Variable: Dissolved Oxygen Concentration in the Biological Treatment Tank (mg / L)
[0196] 5532.0000 5480.0000 5502.0000 5426.0000 5468.0000 5480.0000 5426.0000 5394.0000 5402.0000 5392.0000 5324.0000 5382.0000 5464.0000 5386.0000 5278.0000 5194.0000 5246.0000 5192.0000 5246.0000 5308.0000 5346.0000 5498.0000 5306.0000 5384.0000 5240.0000 5304.0000 5248.0000 5206.0000 5148.0000 5243.0000 5382.0000 5292.0000 5140.0000 5128.0000 5144.0000 5208.0000 5146.0000 5236.0000 5192.0000 5246.0000 5212.0000 5318.0000 5366.0000 5248.0000 5326.0000 5428.0000 5326.0000 5214.0000 5408.0000 5492.0000 5514.0000 5542.0000 5418.0000 5562.0000 5438.0000 5344.0000 5278.0000 5236.0000 5192.0000 5280.0000 5196.0000 5236.0000 5264.0000 5184.0000 5246.0000 5318.0000 5280.0000 5342.0000 5410.0000 5374.0000 5288.0000 5342.0000 5284.0000 5346.0000 5284.0000 5166.0000 5246.0000 5320.0000 5282.0000 5316.0000 5398.0000 5312.0000 5362.0000 5280.0000 5196.0000 5246.0000 5318.0000 5192.0000 5366.0000 5418.0000 5364.0000 5296.0000 5346.0000 5318.0000 5276.0000 5184.0000 5026.0000 4928.0000 4790.0000 4632.0000 4568.0000 4490.0000 4326.0000 4270.0000 4206.0000 4138.0000 4056.0000 4016.0000 3988.0000 3962.0000 3926.0000 3884.0000 3856.0000 3802.0000 3890.0000 3946.0000 4022.0000 3902.0000 3982.0000 4036.0000 4156.0000 4234.0000 4298.0000 4310.0000 4384.0000 4452.0000 4384.0000 4306.0000 4392.0000 4428.0000 4566.0000 4634.0000 4582.0000 4634.0000 4696.0000 4722.0000 4696.0000 4580.0000 4462.0000 4482.0000 4356.0000 4280.0000 4176.0000 4034.0000 3996.0000 3866.0000 3824.0000 3856.0000 3778.0000 3690.0000 3602.0000 3758.0000 3822.0000 3982.0000 4052.0000 4072.0000 4136.0000 4250.0000 4342.0000 4416.0000 4428.0000 4536.0000 4620.0000 4752.0000 4836.0000 4802.0000 4782.0000 4664.0000 4538.0000 4306.0000 4460.0000 4540.0000 4662.0000 4782.0000 4706.0000 4788.0000 4702.0000 4816.0000 4722.0000 4642.0000 4608.0000 4674.0000 4756.0000 4712.0000 4624.0000 4704.0000 4724.0000 4628.0000 4642.0000 4736.0000 4670.0000 4592.0000 4776.0000 2038.0000 2246.0000 2318.0000 2396.0000 2402.0000 2464.0000 2412.0000 2480.0000 2412.0000 2508.0000 2492.0000 4682.0000 4706.0000 4746.0000 4702.0000 4892.0000 4806.0000 4892.0000 4876.0000 4782.0000 4836.0000 4724.0000 4806.0000 4890.0000 4726.0000 4618.0000 4724.0000 4580.0000 4392.0000 4436.0000 4510.0000 4628.0000 4564.0000 4578.0000 4506.0000 4472.0000 4508.0000 4472.0000 4386.0000 4418.0000 4392.0000 4460.0000 3584.0000 3614.0000 3562.0000 3706.0000 3642.0000 3602.0000 3712.0000 3662.0000 3804.0000 3692.0000 3738.0000 3684.0000 3712.0000 3706.0000 3758.0000
[0197] Table 3. External Variables: Oil Content in Influent (mg / L)
[0198]
[0199]
[0200] Table 4. External variable: Ammonia nitrogen concentration in effluent (mg / L)
[0201] 24.1000 24.8300 20.2000 28.3500 36.6200 30.5800 31.2700 26.4200 15.5000 29.3500 25.5200 23.9500 24.4000 26.1700 21.6200 23.1200 16.7000 22.0800 26.4000 28.8200 26.7800 24.1000 25.0800 24.6200 24.5800 25.3000 23.3200 24.1200 21.3800 18.8500 21.4600 22.4800 21.5600 24.9800 23.5600 22.4700 23.5600 22.3800 22.6500 25.9800 26.3800 25.4200 24.8500 21.2200 22.8500 21.9600 24.3600 23.6500 24.1200 25.6000 29.1000 26.3500 24.3800 27.0700 20.1000 23.6200 24.0200 22.4800 23.1500 24.6200 22.5400 23.1800 22.4600 23.7500 24.8500 23.8800 25.1200 25.6400 23.3600 24.5700 23.6800 22.6500 23.1400 22.5800 23.1600 23.9200 22.1600 23.5400 21.3600 23.0800 23.4700 22.4800 21.6400 22.4800 22.9300 21.8400 20.7400 22.1500 22.7300 21.8400 23.0700 22.8300 23.4200 22.8000 21.9400 23.0600 24.6400 23.7000 22.9800 22.4300 22.8700 23.0600 23.5600 22.5300 24.0400 23.6800 24.0600 23.7600 22.8600 22.0300 22.7500 23.0600 22.5800 23.0400 22.8700 23.4200 22.0800 23.2500 22.9700 23.4600 22.5600 23.1600 23.1000 23.6800 22.4700 23.5900 23.4600 23.1200 23.9000 22.5600 23.4600 22.8700 22.1700 23.5800 24.0200 23.1400 22.7400 23.0400 23.7000 24.2600 23.9600 22.1900 23.7200 23.0600 22.4800 22.0900 22.8400 23.0600 22.4600 23.0700 23.9200 23.0700 22.8400 23.1700 24.3500 22.0700 23.1800 24.2600 23.7400 23.8600 22.1800 23.4200 22.4700 23.1500 21.4900 23.7200 20.7500 23.9000 24.1600 22.0600 23.4900 24.0400 25.4200 22.9300 24.8100 21.7500 22.9800 23.1600 22.7200 21.8900 22.4600 23.1700 23.6200 20.5500 39.2800 36.9500 40.1800 36.3800 33.7400 37.6200 38.3000 39.7000 36.9500 33.8000 39.2500 38.7600 37.4200 37.2500 28.8200 30.4000 31.5300 32.4600 31.8200 33.4700 32.1500 33.8000 33.1700 32.4200 33.9500 31.9600 36.4800 26.3000 40.7000 37.0000 26.2000 30.6800 25.1600 27.9300 31.4200 36.4300 27.5900 25.4200 26.5800 24.9800 25.6400 27.0200 29.6800 26.5800 28.6500 25.1600 27.4200 29.1000 34.3500 31.6500 30.8200 28.6000 27.5600 28.3700 30.0500 40.3000 30.9800 33.5500 29.4200 30.1600 28.7900 29.8200 27.5800 32.7000 34.6200 30.1600
[0202] Table 5. External Variable: Influent Color (mg / L)
[0203]
[0204]
[0205] Table 6. External variable: Total nitrogen concentration in effluent (mg / L)
[0206]
[0207]
[0208] Table 7. External variable: Influent phosphate concentration (mg / L)
[0209] 14.9743 15.3800 15.2943 15.2086 15.1229 15.0371 14.9514 14.8657 14.7800 15.0400 15.3000 15.5600 15.8200 16.0800 16.3400 16.6000 16.4971 16.3943 16.2914 16.1886 16.0857 15.9829 15.8800 15.5886 15.2971 15.0057 14.7143 14.4229 14.1314 13.8400 14.0657 14.2914 14.5171 14.7429 14.9686 15.1943 15.4200 15.4529 15.4857 15.5186 15.5514 15.5843 15.6171 15.6500 15.7929 15.9357 16.0786 16.2214 16.3643 16.5071 16.6500 16.4786 16.3071 16.1357 15.9643 15.7929 15.6214 15.4500 15.6114 15.7729 15.9343 16.0957 16.2571 16.4186 16.5800 16.4557 16.3314 16.2071 16.0829 15.9586 15.8343 15.7100 15.5657 15.4214 15.2771 15.1329 14.9886 14.8443 14.7000 14.7914 14.8829 14.9743 15.0657 15.1571 15.2486 15.3400 15.4429 15.5457 15.6486 15.7514 15.8543 15.9571 16.0600 15.9343 15.8086 15.6829 15.5571 15.4314 15.3057 15.1800 15.2071 15.2343 15.2614 15.2886 15.3157 15.3429 15.3700 15.3486 15.3271 15.3057 15.2843 15.2629 15.2414 15.2200 15.3757 15.5314 15.6871 15.8429 15.9986 16.1543 16.3100 16.2000 16.0900 15.9800 15.8700 15.7600 15.6500 15.5400 15.6114 15.6829 15.7543 15.8257 15.8971 15.9686 16.0400 15.8729 15.7057 15.5386 15.3714 15.2043 15.0371 14.8700 14.3543 13.8386 13.3229 12.8071 12.2914 11.7757 11.2600 11.2014 11.1429 11.0843 11.0257 10.9671 10.9086 10.8500 10.6957 10.5414 10.3871 10.2329 10.0786 9.9243 9.7700 9.6514 9.5329 9.4143 9.2957 9.1771 9.0586 8.9400 8.7129 8.4857 8.2586 8.0314 7.8043 7.5771 7.3500 7.2214 7.0929 6.9643 6.8357 6.7071 6.5786 6.4500 6.8686 7.2871 7.7057 8.1243 8.5429 8.9614 9.3800 9.3771 9.3743 9.3714 9.3686 9.3657 9.3629 9.3600 9.2400 9.1200 9.0000 8.8800 8.7600 8.6400 8.5200 8.9289 9.3378 9.7467 10.1556 10.5644 10.9733 11.3822 11.7911 12.2000 11.6357 11.0714 10.5071 9.9429 9.3786 8.8143 8.2500 8.1257 8.0014 7.8771 7.7529 7.6286 7.5043 7.3800 7.4286 7.4771 7.5257 7.5743 7.6229 7.6714 7.7200 7.8914 8.0629 8.2343 8.4057 8.5771 8.7486 8.9200 8.7700 8.6200 8.4700 8.3200 8.1700 8.0200 7.8700 8.1457
[0210] Table 8. Effluent BOD Concentration (mg / L)
[0211]
[0212]
[0213] Test sample:
[0214] Table 9. External variable: Influent BOD concentration (mg / L)
[0215] 115.5714 116.8571 118.1429 119.4286 120.7143 122.0000 119.2857 116.5714 113.8571 111.1429 108.4286 105.7143 103.0000 107.0000 111.0000 115.0000 119.0000 123.0000 127.0000 131.0000 127.8571 124.7143 121.5714 118.4286 115.2857 112.1429 109.0000 110.4286 111.8571 113.2857 114.7143 116.1429 117.5714 119.0000 118.7143 118.4286 118.1429 117.8571 117.5714 117.2857 117.0000 118.5714 120.1429 121.7143 123.2857 124.8571 126.4286 128.0000 125.0000 122.0000 119.0000 116.0000 113.0000 110.0000 107.0000 108.8571 110.7143 112.5714 114.4286 116.2857 118.1429 120.0000 121.5714 123.1429 124.7143 126.2857 127.8571 129.4286 131.0000 129.2857 127.5714 125.8571 124.1429 122.4286 120.7143 119.0000 118.5714 118.1429 117.7143 117.2857 116.8571 116.4286 116.0000 116.5714 117.1429 117.7143 118.2857 118.8571 119.4286 120.0000 118.0000 116.0000 114.0000 112.0000 110.0000 108.0000 106.0000 106.9000 107.8000 108.7000 109.6000 110.5000 111.4000 112.3000 113.2000 114.1000 115.0000
[0216] Table 10. External Variable: Dissolved Oxygen Concentration in the Biological Treatment Tank (mg / L)
[0217] 3642.0000 3718.0000 3842.0000 3806.0000 3742.0000 3826.0000 3780.0000 3742.0000 3780.0000 4456.0000 4318.0000 4294.0000 4380.0000 4292.0000 4346.0000 4298.0000 4316.0000 4256.0000 4324.0000 4248.0000 4326.0000 4274.0000 4352.0000 4286.0000 4172.0000 4246.0000 4350.0000 4282.0000 4156.0000 4038.0000 4122.0000 4290.0000 4342.0000 4406.0000 4530.0000 4628.0000 4596.0000 4478.0000 4324.0000 4244.0000 4276.0000 4358.0000 4418.0000 4372.0000 4458.0000 4524.0000 4658.0000 4762.0000 4630.0000 4576.0000 4472.0000 4436.0000 4286.0000 4124.0000 4038.0000 4176.0000 4262.0000 4342.0000 4316.0000 4408.0000 4526.0000 4670.0000 4538.0000 4408.0000 4292.0000 4276.0000 4108.0000 4048.0000 4152.0000 4072.0000 4058.0000 4174.0000 4198.0000 4236.0000 4372.0000 4298.0000 4370.0000 4512.0000 4472.0000 4558.0000 4576.0000 4654.0000 4682.0000 4760.0000 4786.0000 4692.0000 4572.0000 4536.0000 4682.0000 4736.0000 4862.0000 4758.0000 4672.0000 4758.0000 4682.0000 4558.0000 4462.0000 4498.0000 4326.0000 4286.0000 4302.0000 4246.0000 4158.0000 4076.0000 4294.0000 4372.0000 4298.0000
[0218] Table 11. External Variables: Oil Content in Influent (mg / L)
[0219]
[0220]
[0221] Table 12. External variable: Ammonia nitrogen concentration in effluent (mg / L)
[0222] 33.7400 31.4600 29.4200 27.3700 28.6200 28.9500 30.2400 28.2600 30.2600 27.5800 36.2800 33.4600 30.5800 29.6000 33.4500 31.9000 29.8800 28.5300 30.4500 33.7200 21.2600 29.6500 27.5800 29.3700 31.4500 30.2700 32.6800 30.7200 33.1600 34.7000 32.9400 28.6500 26.9400 28.7300 27.6400 28.2500 30.0200 27.5600 29.8300 28.6800 29.4700 31.9500 32.0800 30.1900 27.6500 25.9200 28.7600 29.6800 27.4800 28.1000 30.1200 31.4200 33.7800 31.2600 29.7800 30.7300 30.5500 29.4400 30.5600 28.9400 34.0200 33.9000 36.6000 32.5700 30.9400 29.1600 31.2000 29.9300 28.5000 29.6500 28.2000 30.4200 28.5600 28.8500 29.4700 29.8700 27.9700 28.9400 28.0600 30.2800 31.0200 29.7000 29.6800 28.9200 27.6900 28.9900 29.3800 27.6400 27.6300 29.2800 27.8600 29.0300 27.8400 29.3000 27.6500 28.4300 22.1800 25.4000 27.1200 29.4700 27.8200 29.1800 27.4600 24.3000 26.9400 25.6200 23.7200
[0223] Table 13. External Variable: Influent Color (mg / L)
[0224] 2.4600 2.0900 1.7800 1.8400 2.2600 3.7800 2.9500 1.8500 2.4700 2.0000 1.9000 2.5400 2.7000 2.4800 2.7600 2.2600 1.9400 2.1000 1.8500 2.6800 2.0500 1.8400 2.6000 2.7100 2.2600 2.0900 1.7900 2.0400 2.4500 2.1600 2.8600 3.0800 2.7600 2.8700 2.5800 2.7200 2.9300 2.3000 2.5700 2.9000 3.1200 2.9800 3.0300 2.7800 2.3600 2.7400 3.4200 3.4500 3.4000 3.1000 3.6400 2.7600 3.2300 3.3800 3.0500 4.4000 2.9300 3.1700 3.6200 4.9500 4.7500 5.2600 5.1800 4.8000 5.2800 3.8700 5.7500 5.3000 5.5300 5.7800 4.7500 5.7200 4.3800 6.0300 6.7600 6.1300 5.8400 6.3000 6.1300 5.3700 6.2500 6.8200 6.6200 6.2400 6.3700 6.5400 5.8900 6.5200 7.8000 7.2300 6.9400 7.1200 6.7700 6.1300 6.5800 7.0400 8.8300 12.2000 10.7800 9.8300 8.6900 8.1700 8.7700 7.5800 7.1500 7.9300 7.0600
[0225] Table 14. External variable: Total nitrogen concentration in effluent (mg / L)
[0226] 41.2786 40.5729 39.8671 39.1614 38.4557 37.7500 37.9314 38.1129 38.2943 38.4757 38.6571 38.8386 39.0200 39.3829 39.7457 40.1086 40.4714 40.8343 41.1971 41.5600 41.3657 41.1714 40.9771 40.7829 40.5886 40.3943 40.2000 39.8743 39.5486 39.2229 38.8971 38.5714 38.2457 37.9200 38.0514 38.1829 38.3143 38.4457 38.5771 38.7086 38.8400 38.5557 38.2714 37.9871 37.7029 37.4186 37.1343 36.8500 36.6943 36.5386 36.3829 36.2271 36.0714 35.9157 35.7600 36.4086 37.0571 37.7057 38.3543 39.0029 39.6514 40.3000 39.9043 39.5086 39.1129 38.7171 38.3214 37.9257 37.5300 37.7457 37.9614 38.1771 38.3929 38.6086 38.8243 39.0400 38.9986 38.9571 38.9157 38.8743 38.8329 38.7914 38.7500 38.6314 38.5129 38.3943 38.2757 38.1571 38.0386 37.9200 37.4100 36.9000 36.3900 35.8800 35.3700 34.8600 34.3500 34.1830 34.0160 33.8490 33.6820 33.5150 33.3480 33.1810 33.0140 32.8470 32.6800
[0227] Table 15. External variable: Influent phosphate concentration (mg / L)
[0228] 8.4214 8.6971 8.9729 9.2486 9.5243 9.8000 9.5943 9.3886 9.1829 8.9771 8.7714 8.5657 8.3600 8.2829 8.2057 8.1286 8.0514 7.9743 7.8971 7.8200 7.6400 7.4600 7.2800 7.1000 6.9200 6.7400 6.5600 6.4643 6.3686 6.2729 6.1771 6.0814 5.9857 5.8900 6.0843 6.2786 6.4729 6.6671 6.8614 7.0557 7.2500 7.3814 7.5129 7.6443 7.7757 7.9071 8.0386 8.1700 8.1286 8.0871 8.0457 8.0043 7.9629 7.9214 7.8800 8.2171 8.5543 8.8914 9.2286 9.5657 9.9029 10.2400 10.6371 11.0343 11.4314 11.8286 12.2257 12.6229 13.0200 13.2014 13.3829 13.5643 13.7457 13.9271 14.1086 14.2900 14.2200 14.1500 14.0800 14.0100 13.9400 13.8700 13.8000 13.8943 13.9886 14.0829 14.1771 14.2714 14.3657 14.4600 14.8400 15.2200 15.6000 15.9800 16.3600 16.7400 17.1200 16.9530 16.7860 16.6190 16.4520 16.2850 16.1180 15.9510 15.7840 15.6170 15.4500
[0229] Table 16. Effluent BOD Concentration (mg / L)
[0230] 14.0000 14.2000 14.4000 14.6000 14.8000 15.0000 14.8286 14.6571 14.4857 14.3143 14.1429 13.9714 13.8000 13.9429 14.0857 14.2286 14.3714 14.5143 14.6571 14.8000 14.6714 14.5429 14.4143 14.2857 14.1571 14.0286 13.9000 13.8857 13.8714 13.8571 13.8429 13.8286 13.8143 13.8000 13.6286 13.4571 13.2857 13.1143 12.9429 12.7714 12.6000 12.6429 12.6857 12.7286 12.7714 12.8143 12.8571 12.9000 12.7429 12.5857 12.4286 12.2714 12.1143 11.9571 11.8000 12.0000 12.2000 12.4000 12.6000 12.8000 13.0000 13.2000 13.1429 13.0857 13.0286 12.9714 12.9143 12.8571 12.8000 12.7571 12.7143 12.6714 12.6286 12.5857 12.5429 12.5000 12.5571 12.6143 12.6714 12.7286 12.7857 12.8429 12.9000 12.8571 12.8143 12.7714 12.7286 12.6857 12.6429 12.6000 12.5286 12.4571 12.3857 12.3143 12.2429 12.1714 12.1000 12.1700 12.2400 12.3100 12.3800 12.4500 12.5200 12.5900 12.6600 12.7300 12.8000
[0231] Table 17. Predicted BOD values (mg / L) for effluent according to this invention
[0232] 14.1020 14.0459 14.3072 14.4116 14.5570 14.8097 14.8221 14.5101 14.3305 14.3043 13.9947 14.0117 13.6931 13.6999 14.0998 14.0558 14.2657 14.4192 14.4591 14.6978 14.7130 14.4850 14.3651 14.3109 14.0810 14.1608 13.7940 13.8973 13.9793 13.8539 13.8250 13.9171 13.7287 13.9312 13.6700 13.6904 13.3353 13.2422 13.0233 12.9762 12.6635 12.5998 12.7778 12.7611 12.7865 12.8953 12.8234 12.9638 12.8628 12.6487 12.5361 12.3278 12.2539 12.1146 11.8960 11.8659 12.2421 12.3995 12.5956 12.7201 13.0711 13.0234 13.3609 12.9589 13.1385 12.8738 12.9327 12.7922 12.7756 12.6807 12.6320 12.6210 12.5630 12.5230 12.4876 12.4400 12.3993 12.5329 12.5570 12.6139 12.6800 12.7164 12.7887 12.8390 12.6925 12.7203 12.6260 12.6110 12.5537 12.5077 12.4779 12.3942 12.3194 12.2355 12.1523 12.0591 12.0206 11.8802 12.0644 12.0241 12.1483 12.2635 12.2330 12.4151 12.4195 12.5282 12.5713
Claims
1. A WSFA-AFE-based ILSTM neural network-based effluent BOD concentration prediction method, characterized by Includes the following steps: Step 1: Select historical multivariate time series data of effluent BOD concentration to generate prediction samples; Obtain effluent BOD concentration data from wastewater treatment plants ,in Where t = 1, 2, ..., T, T represents the time span; N represents the number of all variables, which is 8 variables in this case; x t The columns in the table represent: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, influent phosphate concentration, and effluent BOD concentration, respectively; in addition, let For x t The last column represents the predicted variable, which is the effluent BOD concentration. x represents t The first seven columns represent external variables: influent BOD concentration, dissolved oxygen concentration in the biological treatment tank, influent oil content, effluent ammonia nitrogen concentration, influent color, effluent total nitrogen concentration, and influent phosphate concentration. A sliding window method is used to... The most recent M data points are truncated for prediction; M is a value between 2 and 8; N represents the number of all variables, which is 8. Step 2: Design the WSFA-AFE method; Step 2.1: Design a weighted slow feature analysis to obtain a mapping matrix g p , generate slow features and weight them using a weighting coefficient ; Step 2.1.1: Obtain the second-order extension term S from matrix X, where N represents the total number of variables, which is 8; (1) Step 2.1.2: Solving the mapping matrix g p and mapping the second order spreading term S to the slow feature s; Let where P = (N - 1) + N(N - 1) / 2, N = 8, so P = 35, g p may be obtained by solving the following equation, where p = 1, 2,..., P: where, is g p derivative with respect to time, denotes time average; equation (2) ensures that g p derivative or rate of change of the square of g is the same as p, and is some value less than p; Step 2.1.3: Select the desired slow feature F from s; and u represents the number of selected slow features, and the vector g p (S) Using the AR model in matlab to model the slow degree of slow features, and sequentially calculating the slow degree difference with the previous slow feature; when the slow degree difference is more than 1.5 times different from the previous slow degree difference, stop selecting slow features; wherein f t indicates all selected slow features at time t; Step 2.1.4: Set the maximum sliding window L using the preset parameters. max Taking 8, the multivariate time series X is reconstructed into E; in , And r=1,2,…,L max +1; its last column This represents the predicted effluent BOD concentration, with the i-th column of E representing the desired concentration. i From coefficients Weighted, where It can be calculated using the following formula: (7) wherein, is and the maximum information coefficient between is E in the historical data L max the column total of data points; Step 2.1.5: Calculate the input weighting matrix, L max =8 and u=3; Using weighting each element of the input matrix, ; Step 2.2: Design an adaptive sliding window algorithm; (8) (9) L max and L min Representing the maximum and minimum values of the sliding window, set to 8 and 2 respectively. It is L max and L min The average value is 5; yes and The difference between the Euclidean norms, of which The historical time-based predictor variable used at time t measures the data fluctuation from a distance perspective. yes and Cosine similarity between them measures the fluctuation of data from the perspective of direction; It is V t and V t-1 The difference in absolute value, V t and V t-1 Representing R respectively t and R t-1 The variance; , and They are , and Average value at historical moments; Step 3: Design the ILSTM neural network structure. ILSTM has been optimized in terms of both structure and algorithm. In terms of structure: the designed ILSTM neural network structure includes three gates: the forget gate, the input gate, and the output gate. Each value of the recursive term weight in each gate represents the connection between the neuron's output at the previous time step and the neuron at the current time step, rather than the connection between the neuron and all neurons in the standard LSTM. The number of hidden layer units in the ILSTM is set to 15. The computational functions of each structure in the ILSTM are as follows: ① input gate: input gate i t The number of new information added to the current state unit is controlled and calculated as follows: (10) in, Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.
4. t The vector formed by sequentially connecting the first and second elements of row t-1; Let W be the output vector at time t-1. i and Q i These are the input weight matrix and the recursive term weight matrix in the input gate, respectively. i This is the bias matrix in the input gate. This represents matrix element-wise multiplication. It is the sigmoid activation function; ②Forget gate: The forget gate f t The degree of forgetting the state information of the previous time is determined to allow the network to reset its state, and is calculated as follows: (11) in, Let be the input vector at time t, and let be the first tL of matrix E in step 2.1.
4. t The vector formed by sequentially connecting the first and second elements of row t-1; Let W be the output vector at time t-1. f and Q f These are the input weight matrix and the recursive term weight matrix in the forget gate, respectively. f This is the bias matrix in the forget gate. This represents matrix element-wise multiplication. It is the sigmoid activation function; ③ Current state unit c t : The current state information is combined with the previous state information as follows: (12) where c t-1 is the state information of the previous time, i t represents the input gate, f t represents the forget gate, z t is the state information of the current time, and is calculated as follows: (13) wherein, is the input vector at time t, is the first t-L t columns of the matrix E in step 2.1.4; is the output vector at time t-1, W z and Q z are the input weight matrix and the recurrent term weight matrix in the current state, respectively, b z is the bias matrix in the current state; (4) Output gate: The output gate determines the final output h of the LSTM at the current time t , which is calculated as follows: (14) (15) wherein, is the input vector at time t, is the first t-L t columns of the matrix E in step 2.1.4; is the output vector at time t-1, W o and Q o are the input weight matrix and the recurrent term weight matrix in the output gate, respectively, b o is the bias matrix in the output gate, is the output vector at time t. Step 4: Design the ILSTM neural network learning algorithm: Step 4.1: Define the loss function; (16) wherein, and are the expected and actual outputs of the ILSTM, respectively, for the model output of different cell state dimensions , which need to be converted to a single dimension , as shown in equation (17), where and are the weight matrix and bias of the output layer. (17) Step 4.2: Design the AMSGD algorithm to update the ILSTM model parameters ① Calculate the gradient of the output layer parameters; For the output layer, the loss function is... and The gradients are calculated as shown in formulas (18) and (19): (18) (19) ② Update the output layer parameters; weight and The update equations are given by equations (20) and (21), respectively: (20) (21) in, These are the output layer weights at time t+1. These are the output layer weights at time t. These are the output layer weights at time t-1. It is the output layer bias at time t+1. It is the output layer bias at time t. It is the output layer bias at time t-1; The learning rate is set to 0.
01. The momentum coefficient, The value is 0.9; iii. define the partial derivatives of the loss function pair , , , , . Definitions The partial derivative of the loss function with respect to is denoted by and is given by formula (22): (22) Similarly defined , , , are the partial derivatives of the loss function pair , , , with respect to as shown in equations (23)-(26): ; ④ Calculate the gradient of the hidden layer parameters; The gradients of the loss function with respect to each weight matrix and bias vector throughout the process are shown in equations (27)-(29): wherein is any one of {,, , , , } ; ⑤ Update hidden layer parameters; The weight update formulas are shown in formulas (30)-(32): (30) (31) (32) In the formula, for{ , , , Any one of} , , These represent the input weight matrix, the recursive term weight matrix, and the bias vector, respectively. The learning rate is 0.
01. The momentum coefficient, The value is set to 0.9; at this point, all parameters have been updated. ⑥ After each iteration, determine the stopping condition. The stopping condition is reaching the maximum number of iterations, 2000. When the stopping condition is reached, the parameter update process ends; otherwise, continue to return to ① to train parameters. In addition, during the learning process, an adaptive adjustment mechanism for the learning rate is set up, as shown in formula (33): (33) RMSE(n) is the root mean square error function in the nth iteration. If the direction of weight correction is incorrect, the error function value increases, and it needs to be multiplied by a damping factor. To reduce the learning rate; when the error function value decreases, it indicates that the direction of weight correction is correct, and it can be improved by multiplying by an increment factor. To increase the learning step size; k dec With k inc Set them to 0.95 and 1.05 respectively; Setting upper and lower thresholds for the learning rate limits its adjustment range to a certain range, between 0.001 and 0.
1. Step 5: Effluent BOD prediction; The test sample data is used as the input to the trained ILSTM neural network to obtain the output of the ILSTM neural network.
Citation Information
Patent Citations
PSO-based recursive RBF neural network effluent BOD prediction method
CN109657790A
An effluent BOD prediction method based on a simplified long-short-term memory neural network
CN112949894A