A neural network-based sewage treatment effluent ammonia nitrogen prediction method and system

A neural network model constructed using a two-layer sparse Bayesian echo state network solves the problem of real-time online measurement of ammonia nitrogen in urban wastewater treatment processes, enabling accurate online prediction and supporting the digital and intelligent operation of wastewater treatment processes.

CN119089139BActive Publication Date: 2026-11-10BEIJING INFORMATION SCI & TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411146007.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2026-11-10
Estimated Expiration
2044-08-20

AI Technical Summary

Technical Problem

Existing technologies make it difficult to achieve real-time online measurement of ammonia nitrogen in urban wastewater treatment processes. Traditional methods are inaccurate and costly, while models based on microbial reaction mechanisms are costly and time-consuming to develop.

Method used

A neural network model based on a two-layer sparse Bayesian echo state network is adopted. The model parameters are learned through the sparse Bayesian inference method, and the sparsity of the input layer and hidden layer is designed to construct a soft measurement model for effluent ammonia nitrogen in urban sewage treatment process, so as to realize online prediction of effluent ammonia nitrogen concentration.

Benefits of technology

It enables accurate online prediction of ammonia nitrogen in urban wastewater treatment processes, prevents overfitting, improves the self-organizing and generalization capabilities of neural networks, and supports the digital and intelligent operation of wastewater treatment processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089139B_ABST
    Figure CN119089139B_ABST
Patent Text Reader

Abstract

The application discloses a sewage treatment effluent ammonia nitrogen prediction method and system based on a neural network. The method designs a double-layer sparse Bayesian echo state network structure, learns model parameters through a sparse Bayesian inference method, and removes irrelevant input features through the sparsity of the input layer to achieve the purpose of data dimension reduction. The sparsity of the hidden layer can make the hidden layer have appropriate neurons, obtain a network size matched with historical data, effectively prevent overfitting, and improve the self-organizing ability and generalization ability of the neural network. Experimental results show that the intelligent prediction method can accurately measure the ammonia nitrogen concentration of the effluent of the urban sewage treatment process. The method creates conditions for the digital operation of the urban sewage treatment process, provides protection for the effluent water quality to meet the standards, practices the construction of intelligent environmental protection, and provides theoretical support and technical support for the safe and stable operation of the sewage treatment process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wastewater treatment technology, and in particular to a method and system for predicting ammonia nitrogen in wastewater effluent based on neural networks. Background Technology

[0002] Currently, freshwater resources are scarce and severely polluted. The deterioration of aquatic ecosystems in cities and major economic zones is a prominent issue, becoming a bottleneck restricting sustainable economic and social development. Eutrophication, caused by pollutants such as ammonia nitrogen and total nitrogen, is showing an increasingly serious trend. Eutrophication can lead to dense algal blooms or red tides, resulting in mass fish deaths. The "2023 State of the Environment Bulletin" released in May 2024 indicates that ammonia nitrogen is one of the important factors causing pollution. Therefore, establishing urban wastewater treatment plants and measuring the ammonia nitrogen concentration in the treated wastewater online is crucial for achieving closed-loop control of ammonia nitrogen emissions and improving effluent quality, which is of great significance for protecting the aquatic environment.

[0003] Traditional offline ammonia nitrogen measurement methods based on chemical reaction principles and conducted in laboratories are susceptible to fluctuations in measurement results due to external factors such as environment and human error, and the long testing cycle makes real-time online monitoring difficult. With the rapid development of sensor and automation technologies, some researchers have combined the chemical reaction principles of ammonia nitrogen detection with measuring instruments to design online ammonia nitrogen measurement instruments for wastewater. These instruments can achieve online measurement of ammonia nitrogen concentration, but their accuracy is low and equipment maintenance costs are high. Mechanism-based measurement methods have complex model structures; the International Water Quality Association has established several activated sludge models (ASM), which require numerous parameters to be tuned during use and are mostly used in wastewater treatment plant design. In wastewater treatment, the survival patterns and dependent conditions of microorganisms in wastewater are not fully understood, and field experiments are time-consuming and costly, posing a significant challenge to the establishment of traditional ammonia nitrogen prediction models based on microbial reaction mechanisms or mathematical statistics. With the development of brain-like model research and intelligent theory, the application of artificial intelligence technology to research data-driven soft measurement methods for wastewater treatment has become a hot topic. Building intelligent soft-sensor models based on historical data and utilizing easily measurable variables to monitor difficult-to-measurable variables in wastewater treatment in real time is a development trend for intelligent wastewater treatment plants. Due to the powerful nonlinear approximation capabilities of artificial neural networks, many scholars have applied them to soft-sensoring in wastewater treatment processes in recent years. By designing neural network structures and weight training algorithms that match specific tasks and optimizing network parameters, intelligent online detection of ammonia nitrogen concentration in urban wastewater treatment processes can be achieved, providing a guarantee for the digital and intelligent operation of urban wastewater treatment processes. Summary of the Invention

[0004] Based on this, this application provides a neural network-based method and system for predicting ammonia nitrogen in wastewater treatment effluent. This system enables rapid online detection of ammonia nitrogen in urban wastewater treatment processes. It can construct a soft-sensor model for ammonia nitrogen in urban wastewater treatment effluent based on a two-layer sparse Bayesian echo state network, achieving online prediction of effluent ammonia nitrogen concentration. The model utilizes sparse Bayesian inference to learn model parameters. The sparsity of the input layer removes irrelevant input features, achieving data dimensionality reduction. The sparsity of the hidden layer ensures that the hidden layer has appropriate neurons, obtaining a network size that matches historical data, effectively preventing overfitting and improving the self-organizing and generalizing abilities of the neural network.

[0005] Firstly, a neural network-based method for predicting ammonia nitrogen in wastewater treatment effluent is provided, the method comprising:

[0006] Acquire water sample data, and perform noise reduction, outlier removal, missing data supplementation, and normalization on the water sample data in sequence to obtain P groups of training samples. Take the first P1 group of data as the training samples and the second P2 group of data as the test samples.

[0007] Determine the input variables for the neural network model; specifically, the input variables include total phosphorus in the influent, redox potential, dissolved oxygen concentration, total suspended solids, and pH value.

[0008] Design a neural network model and train the output layer weights using training samples. The neural network is a two-layer sparse Bayesian echo-state network, consisting of an input layer, hidden layers, and an output layer. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The sigmoid function is used as the activation function for the hidden nodes, and a linear function is used as the activation function for the output nodes.

[0009] The trained neural network was tested using test samples, and the output of the neural network after the test was completed was used as the prediction result of ammonia nitrogen in the effluent.

[0010] Optionally, the water sample data is normalized according to the formula.

[0011]

[0012] Normalization is performed, where v i For the measured data set of wastewater influent before normalization, max(v i ) represents the maximum value in the array, min(v) i ) represents the minimum value in the array, v i ′ represents the corresponding normalized influent data value.

[0013] Optionally, a neural network model is designed, specifically including:

[0014] Determine the input layer neurons, update the hidden layer neuron states, and calculate the output layer output.

[0015] Optionally, determine the neurons in the input layer according to the formula.

[0016] u i (n)=v i (n)

[0017] Determine the output of the input layer neuron, where u i (n) is the output of the i-th input layer node in the n-th sample, i = 1, 2, ..., 5, and the input vector is u(n) = [u1(n), u2(n), u3(n), u4(n), u5(n)].

[0018] Optionally, updating the state of hidden layer neurons specifically includes:

[0019] A sub-reservoir is randomly generated. The reservoir weight W0 of each sub-reservoir module of the hidden layer is randomly generated in a uniform distribution according to the given reservoir size and sparsity. W0 is adjusted by the scaling factor α(W) (0<α(W)<1) and the spectral radius ρ(W0).

[0020] The input weight matrix W is generated according to a uniform distribution. in Initialize the reserve pool state x of the i-th sub-reserve pool module. i (0);

[0021] The reservoir is driven by the input signal u(n), and its update formula is:

[0022] x i (n)=f(W in u i (n)+Wx i (n-1))

[0023] Where, x i (n) is the vector of the i-th reserve pool in the hidden layer, denoted as H i (n)=(u i (n),x i (n)) T (i = 1, ..., 5), in order to overcome the influence of the initial transient, from n min Start collecting the internal state matrix H = (H(n) at time n) min +1),H(2),...,H(P)) T Where H(n) = (H1(1),H2(2),...,H5(P)) TP is the number of training samples.

[0024] Optionally, the calculation of the output layer output specifically includes:

[0025] Initialize hyperparameters α β and σ 2 ;

[0026] The formula for calculating the output value of the output layer is as follows:

[0027]

[0028] Where ε(n) is independent noise that follows a Gaussian distribution, with a mean of 0 and a variance of σ. 2 W out Output the weight vector for the reserve pool; the output of each submodule in the hidden layer is related to the unknown weight parameters β = (β1, β2, ..., β5). T Related, and let the expected output be T=(t(1),t(2),...,t(P)). T ;

[0029] The output formula is written in matrix form, giving the prior distribution of the likelihood function of the training samples and the output weights, as well as the posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo state network. After calculating the covariance and mean, the optimal values ​​of the hyperparameters are calculated using the second type of maximum likelihood method. After calculating the optimal values ​​of the output weights and weight parameters, the expected output is obtained.

[0030] Optionally, the output formula can be written in matrix form, specifically including:

[0031]

[0032] in, H β =(H(1)) T β,H(2) T β,...,H(P) T β) T .

[0033] Optionally, the prior distribution of the likelihood function and output weights of the training samples, and the posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo state network are given, specifically including:

[0034] Give the likelihood function of the training samples and the prior distribution of the output weights.

[0035]

[0036] in, and These are independent priors;

[0037] The posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo-state network is given as follows:

[0038]

[0039] According to Bayes' rule, the first term on the right-hand side of the equation...

[0040]

[0041] Optionally, after calculating the covariance and mean, the optimal values ​​of the hyperparameters are calculated using the second type of maximum likelihood method. The expected output is then obtained after calculating the optimal values ​​of the output weights and weight parameters, specifically including:

[0042] Calculate covariance Σ β mean μ β ,in:

[0043]

[0044]

[0045] Calculating hyperparameters using the second type of maximum likelihood method α β and σ 2 The optimal value of the hyperparameters is obtained by satisfying the posterior distribution of the hyperparameters. The maximum likelihood function is given below:

[0046]

[0047] The optimal values ​​of the hyperparameters are obtained by differentiating the marginal log-likelihood function:

[0048]

[0049] Calculate the output weight W out The optimal value of the weight parameter β is obtained. Σ β ,μ β Until convergence, we finally obtain W. out optimal value Optimal value of β

[0050] Predicted output based on

[0051]

[0052] The calculation yields y, where new This is the predicted result.

[0053] Secondly, a neural network-based ammonia nitrogen prediction system for wastewater treatment effluent is provided, the system comprising:

[0054] The data processing module is used to acquire water sample data, and to perform noise reduction, outlier data removal, missing data supplementation, and normalization on the water sample data in sequence to obtain P groups of training samples. The first P1 group of data is used as the training sample, and the second P2 group of data is used as the test sample.

[0055] The variable determination module is used to determine the input variables of the neural network model; wherein, the input variables specifically include total phosphorus in the influent, redox potential, dissolved oxygen concentration, total suspended solids, and pH value;

[0056] The model training module is used to design the neural network model and train the output layer weights of the network using training samples. The neural network is a two-layer sparse Bayesian echo-state network, consisting of an input layer, hidden layers, and an output layer. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The sigmoid function is used as the activation function for the hidden nodes, and a linear function is used as the activation function for the output nodes.

[0057] The results output module is used to test the trained neural network using test samples, and outputs the neural network as the predicted result of effluent ammonia nitrogen after the test.

[0058] The beneficial effects of the technical solutions provided in this application include at least the following:

[0059] (1) This invention addresses the problem of difficulty in online measurement of ammonia nitrogen in urban wastewater treatment processes. Based on a two-layer sparse Bayesian echo state network, it provides an intelligent prediction method for ammonia nitrogen in urban wastewater treatment processes, achieving accurate online prediction of ammonia nitrogen in urban wastewater treatment processes.

[0060] (2) This invention learns model parameters through sparse Bayesian inference. The sparsity of the input layer can remove irrelevant input features and achieve the purpose of data dimensionality reduction. The sparsity of the hidden layer can enable the hidden layer to have appropriate neurons, obtain a network size that matches the historical data, effectively prevent overfitting, and improve the self-organization and generalization capabilities of the neural network. Attached Figure Description

[0061] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0062] Figure 1 A flowchart illustrating the steps of a neural network-based method for predicting ammonia nitrogen in wastewater treatment effluent provided in this application;

[0063] Figure 2 This is a topology diagram of the two-layer sparse Bayesian echo state network of the present invention;

[0064] Figure 3 This is a diagram illustrating the predictive effect of the present invention on ammonia nitrogen in the effluent of urban wastewater treatment processes.

[0065] Figure 4 This is a prediction error diagram of ammonia nitrogen in the effluent of urban sewage treatment process according to the present invention. Detailed Implementation

[0066] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0067] In the description of this invention, the terms “comprising,” “having,” and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are expressly listed, but may also include other steps or units that are not expressly listed but are inherent to these processes, methods, products, or apparatuses, or steps or units added based on further optimizations of the inventive concept.

[0068] Ammonia nitrogen content in effluent is a crucial monitoring indicator for urban wastewater treatment plants and a key factor in water quality assessment. Addressing the challenge of real-time online measurement of effluent ammonia nitrogen in current urban wastewater treatment processes, this invention presents a method for predicting effluent ammonia nitrogen based on a two-layer sparse Bayesian echo state network, achieving real-time online prediction. This method employs a two-layer sparse Bayesian echo state network structure. Model parameters are learned through sparse Bayesian inference. The sparsity of the input layer removes irrelevant input features, achieving data dimensionality reduction. The sparsity of the hidden layer ensures appropriate neurons, resulting in a network size that matches historical data, effectively preventing overfitting and improving the self-organizing and generalizing abilities of the neural network. Experimental results demonstrate that this intelligent prediction method accurately measures effluent ammonia nitrogen concentration in urban wastewater treatment processes. This creates conditions for the digital and intelligent operation of urban wastewater treatment processes, ensures effluent water quality compliance, promotes smart environmental protection, and provides theoretical and technical support for the safe and stable operation of wastewater treatment processes. This invention belongs to both the fields of control science and engineering and environmental science and engineering.

[0069] This invention is described for ease of description only, and it uses the prediction of ammonia nitrogen in the effluent of the wastewater treatment process. Similarly, this invention can also be applied to the prediction of other key water quality parameters in the wastewater treatment process. As long as the principle of this invention is used for prediction, it should fall within the scope of this invention.

[0070] This invention provides an intelligent prediction method for ammonia nitrogen in urban wastewater treatment processes. A soft-sensor model for effluent ammonia nitrogen is constructed based on a two-layer sparse Bayesian echo state network, enabling online prediction of effluent ammonia nitrogen concentration. This model utilizes sparse Bayesian inference to learn model parameters. The sparsity of the input layer removes irrelevant input features, achieving data dimensionality reduction. The sparsity of the hidden layer ensures that it has appropriate neurons, achieving a network size that matches historical data, effectively preventing overfitting and improving the self-organizing and generalizing abilities of the neural network. Please refer to [reference needed]. Figure 1 The diagram illustrates a flowchart of a neural network-based method for predicting ammonia nitrogen in wastewater treatment effluent, as provided in an embodiment of this application. The method may include the following steps:

[0071] S1: Obtain water sample data, and sequentially perform noise reduction, outlier data removal, missing data supplementation, and normalization on the water sample data.

[0072] P groups of training samples are obtained, with the first P1 group of data used as the training samples and the second P2 group of data used as the test samples. In this step, the data undergoes noise reduction, outlier removal, missing data imputation, and normalization processing in sequence. The normalization calculation formula is as follows:

[0073]

[0074] Where v i For the measured data set of wastewater influent before normalization, max(v i ) represents the maximum value in the array, min(v) i ) represents the minimum value in the array, v i ′ represents the corresponding normalized influent data value.

[0075] S2, determine the input variables of the neural network model.

[0076] The neural network model input consisted of five variables: total phosphorus (TP), oxidation-reduction potential (ORP), dissolved oxygen concentration (DO), total suspended solids (TSS), and pH. v1, v2, v3, v4, and v5 represent the measured data sets of total phosphorus (TP), oxidation-reduction potential (ORP), dissolved oxygen concentration (DO), total suspended solids (TSS), and pH before normalization. v1′, v′2, v3′, v′4, and v5′ represent the normalized data sets of total phosphorus (TP), oxidation-reduction potential (ORP), dissolved oxygen concentration (DO), total suspended solids (TSS), and pH after normalization according to formula (1).

[0077] S3. Design a neural network model and train the output layer weights of the network using training samples.

[0078] The two-layer sparse Bayesian echo state network consists of an input layer, a hidden layer, and an output layer (e.g., ...). Figure 2 The diagram shows the topology of a two-layer sparse Bayesian echo-state network. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The input and hidden layer weights are fixed once generated; only the output layer weights need to be trained. The sigmoid function is used for the hidden node activation function, and a linear function is used for the output node activation function. The calculation formulas for each layer of the two-layer sparse Bayesian echo-state network are as follows:

[0079] 3.1) Determine the input layer neurons: This layer contains 5 neurons, and the output of the input layer neurons is:

[0080] u i (n)=v i (n) (2)

[0081] Among them, u i (n) is the output of the i-th input layer node in the n-th sample, i = 1, 2, ..., 5, and the input vector is u(n) = [u1(n), u2(n), u3(n), u4(n), u5(n)].

[0082] 3.2) Update the state of hidden layer neurons:

[0083] 3.2.1) Randomly generate a sub-reservoir. Based on the given reservoir size and sparsity, randomly generate the reservoir weight W0 for each sub-reservoir module of the hidden layer in a uniform distribution. Adjust W0 using a scaling factor α(W) (0 < α(W) < 1) and a spectral radius ρ(W0), i.e., W = (α... W / ρ(W0))W0,ρ(W)<1;

[0084] 3.2.2) Generate the input weight moments W according to a certain continuous probability distribution, such as a uniform distribution. in Initialize the reserve pool state x of the i-th sub-reserve pool module. i (0);

[0085] 3.2.3) The reservoir is driven by the input signal u(n), and its update formula is:

[0086] x i (n)=f(W in u i (n)+Wx i (n-1)) (3)

[0087] Where, x i (n) is the vector of the i-th reserve pool in the hidden layer, denoted as H i (n)=(u i (n),x i (n)) T (i = 1, ..., 5), in order to overcome the influence of the initial transient, from n min Start collecting the internal state matrix H = (H(n) at time n) min +1),H(2),...,H(P)) T Where H(n) = (H1(1),H2(2),...,H5(P)) T P is the number of training samples.

[0088] 3.3) Calculate the output of the output layer:

[0089] 3.3.1) Initialize hyperparameters α β and σ 2 ;

[0090] 3.3.1) Calculate the output value of the output layer, using the following formula:

[0091]

[0092] Where ε(n) is independent noise that follows a Gaussian distribution, with a mean of 0 and a variance of σ. 2 Wout Output the weight vector for the reserve pool; the output of each submodule in the hidden layer is related to the unknown weight parameters β = (β1, β2, ..., β5). T Related, and let the expected output be T=(t(1),t(2),...,t(P)). T .

[0093] 3.3.2) Rewrite the output formula (4) in matrix form as follows:

[0094]

[0095] in, H β =(H(1)) T β,H(2) T β,...,H(P) T β) T .

[0096] 3.3.3) Give the likelihood function of the training samples and the prior distribution of the output weights.

[0097]

[0098] in, and They are independent priors.

[0099] 3.3.4) Give the posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo state network.

[0100]

[0101] According to Bayes' rule, the first term on the right-hand side of equation (9) is...

[0102]

[0103] 3.3.5) Calculate the covariance Σ β mean μ β , specifically:

[0104]

[0105] 3.3.6) Calculate hyperparameters using the second type of maximum likelihood method. α β and σ 2 The optimal value of the hyperparameters is obtained by satisfying the posterior distribution of the hyperparameters. The maximum likelihood function is given below:

[0106]

[0107] The optimal values ​​of the hyperparameters are obtained by differentiating the marginal log-likelihood function.

[0108]

[0109]

[0110] 3.3.7) Calculate the output weight W out The optimal value of the weight parameter β

[0111] Based on (11)-(14) and (16)-(17), we obtain Σ β ,μ β This continues until convergence. Finally, W is obtained. out optimal value Optimal value of β

[0112] 3.3.8) The predicted output is calculated according to equation (19).

[0113]

[0114] S4. Test the trained neural network using test samples, and use the output of the neural network after the test as the prediction result of effluent ammonia nitrogen.

[0115] In this step, the trained network is used to test the test dataset. The auxiliary variables in the test samples are used as the input of the trained two-layer sparse Bayesian echo state network, and the output of the neural network is the prediction result of the effluent ammonia nitrogen.

[0116] The inventiveness of this invention is mainly reflected in:

[0117] (1) This invention addresses the problem of difficulty in online measurement of ammonia nitrogen in urban wastewater treatment processes. Based on a two-layer sparse Bayesian echo state network, it provides an intelligent prediction method for ammonia nitrogen in urban wastewater treatment processes, achieving accurate online prediction of ammonia nitrogen in urban wastewater treatment processes.

[0118] (2) This invention learns model parameters through sparse Bayesian inference. The sparsity of the input layer can remove irrelevant input features and achieve the purpose of data dimensionality reduction. The sparsity of the hidden layer can enable the hidden layer to have appropriate neurons, obtain a network size that matches the historical data, effectively prevent overfitting, and improve the self-organization and generalization capabilities of the neural network.

[0119] Special note: This invention is for ease of description only and uses the prediction of ammonia nitrogen in the effluent of the wastewater treatment process. Similarly, this invention can also be applied to the prediction of other key water quality parameters in the wastewater treatment process. As long as the principle of this invention is used for prediction, it should fall within the scope of this invention.

[0120] The following is a specific embodiment of the method described above:

[0121] S1, Data Preprocessing:

[0122] The experimental data underwent noise reduction, outlier removal, missing data imputation, and normalization processes in sequence, leaving 2029 sets of data and 11 variables. The 2029 sets of data samples were divided into two parts: 1200 sets of data were used as training samples, and the remaining 829 sets of data were used as test samples.

[0123] S2, Selection of auxiliary variables:

[0124] The data for this experiment came from the daily water quality analysis report of a wastewater treatment plant. Auxiliary variables were selected based on partial least squares regression, using five variables—total phosphorus (TP), oxidation-reduction potential (ORP), dissolved oxygen concentration (DO), total suspended solids (TSS), and pH—as input variables for the ammonia nitrogen soft measurement model. The specific implementation steps are as follows:

[0125] 2.1) Let the input matrix be X and the output matrix be Y. After standardization, we obtain X0 and Y0. Extract the first principal component score vector from X0, denoted as t1, and extract the first principal component score vector from Y0, denoted as u1. Then, there are weight vectors w1 and c1 such that t1 = X0w1, u1 = Y0c1. Maximizing t1 and u1 advances the feature information, satisfying variance maximization, i.e., Var(t1) → max, Var(u1) → max; t1 and u1 satisfy correlation maximization, Corr(t1, u1) → max. This satisfies the objective covariance maximization.

[0126]

[0127] When the number of principal component scores is 0, the fitting error matrix corresponding to X0 is denoted as E0, and the fitting error matrix corresponding to Y0 is denoted as F0, that is, E0 = X0, F0 = Y0.

[0128] 2.2) Under the premise of formula (20) and the weight vector being a unit vector, w1 is obtained as a matrix. The eigenvector corresponding to the largest eigenvalue, where c1 is a matrix. The eigenvector corresponding to the largest eigenvalue.

[0129] 2.3) Given t1 = X0w1, u1 = Y0c1, we obtain t1, u1. Based on the idea of ​​principal component regression, we model Y0 on t1 and X0 on t1, resulting in formulas (21) and (22).

[0130]

[0131] in, F1 is the fitting error matrix of Y0 corresponding to t1; E1 is the fitting error matrix of X0 corresponding to t1.

[0132] 2.4) Treat E1 and F1 as the new X0 and Y0, and obtain the scores t2 and u2 of the second pair of principal components by formulas (21) and (22). Repeat this process to obtain the scores of all m pairs of principal components.

[0133] 2.5) Using 10-fold cross-validation and Q-factor authentication 2 The metric is used to optimize the selection of the logarithm of the principal components.

[0134] Design of a two-layer sparse Bayesian echo state network:

[0135] A two-layer sparse Bayesian echo-state network consists of an input layer, a hidden layer, and an output layer (e.g., ...). Figure 2 The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layer, and 1 neuron in the output layer. The input and hidden layer weights are fixed once generated; only the output layer weights need to be trained. The sigmoid function is used for the hidden node activation function, and a linear function is used for the output node activation function. The calculation formulas for each layer of the two-layer sparse Bayesian echo state network are as follows:

[0136] 3.1) Determine the input layer neurons: This layer contains 5 neurons, and the output of the input layer neurons is:

[0137] u i (n)=v i (n) (23)

[0138] Among them, u i (n) is the output of the i-th input layer node in the n-th sample, i = 1, 2, ..., 5, and the input vector is u(n) = [u1(n), u2(n), u3(n), u4(n), u5(n)].

[0139] 3.2) Update the state of hidden layer neurons:

[0140] 3.2.1) Randomly generate a sub-reservoir. Based on the given reservoir size and sparsity, randomly generate the reservoir weight W0 for each sub-reservoir module of the hidden layer in a uniform distribution. Adjust W0 using a scaling factor α(W) (0 < α(W) < 1) and a spectral radius ρ(W0), i.e., W = (α... W / ρ(W0))W0,ρ(W)<1;

[0141] 3.2.2) Generate the input weight moments W according to a certain continuous probability distribution, such as a uniform distribution. in Initialize the reserve pool state x of the i-th sub-reserve pool module. i (0);

[0142] 3.2.3) The reservoir is driven by the input signal u(n), and its update formula is:

[0143] x i (n)=f(W in u i (n)+Wx i (n-1)) (24)

[0144] Where, x i (n) is the vector of the i-th reserve pool in the hidden layer, denoted as H i (n)=(u i (n),x i (n)) T (i = 1, ..., 5), in order to overcome the influence of the initial transient, from n min Start collecting the internal state matrix H = (H(n) at time n) min +1),H(2),...,H(P)) T Where H(n) = (H1(1),H2(2),...,H5(P)) T P is the number of training samples.

[0145] 3.3) Calculate the output of the output layer:

[0146] 3.3.1) Initialize hyperparameters α β and σ 2 ;

[0147] 3.3.1) Calculate the output value of the output layer using the following formula:

[0148]

[0149] Where ε(n) is independent noise that follows a Gaussian distribution, with a mean of 0 and a variance of σ. 2 W outOutput the weight vector for the reserve pool; the output of each submodule in the hidden layer is related to the unknown weight parameters β = (β1, β2, ..., β5). T Related, and let the expected output be T=(t(1),t(2),...,t(P)). T .

[0150] 3.3.2) The output formula (4) can be written in matrix form as follows:

[0151]

[0152] in, H β =(H(1)) T β,H(2) T β,...,H(P) T β) T .

[0153] 3.3.3) Give the likelihood function of the training samples and the prior distribution of the output weights:

[0154]

[0155] in, and They are independent priors.

[0156] 3.3.4) The posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo state network is given:

[0157]

[0158] According to Bayes' rule, the first term on the right-hand side of equation (9) is...

[0159]

[0160] 3.3.5) Calculate the covariance Σ β mean μ β ,

[0161]

[0162] 3.3.6) Calculate hyperparameters using the second type of maximum likelihood method. α β and σ 2 The optimal value of the hyperparameters is obtained by satisfying the posterior distribution of the hyperparameters. The maximum likelihood function is given below.

[0163]

[0164] The optimal values ​​of the hyperparameters are obtained by differentiating the marginal log-likelihood function:

[0165]

[0166] 3.3.7) Calculate the output weight W out The optimal value of the weight parameter β:

[0167] Based on (11)-(14) and (16)-(17), we obtain Σ β ,μ β This continues until convergence. Finally, W is obtained. out optimal value Optimal value of β

[0168] 3.3.8) The predicted output is calculated according to equation (19):

[0169]

[0170] 4. Test the trained two-layer sparse Bayesian echo-state network

[0171] The test sample data is used as input to a trained two-layer sparse Bayesian echo state network, and the output of the neural network is the predicted result of effluent ammonia nitrogen. For example... Figure 3 X-axis: time, unit is sample / day; Y-axis: effluent ammonia nitrogen, unit is mg / L. The two-day line graphs in the figure correspond to the expected effluent ammonia nitrogen concentration and the actual network output effluent ammonia nitrogen predicted concentration (DLSBESN), respectively. The most different parts of the figure (sample days 1365-1380) are enlarged by using a small plot.

[0172] The error between the actual output ammonia nitrogen concentration and the expected output ammonia nitrogen concentration is as follows: Figure 4 X-axis: time, unit is sample / day; Y-axis: difference between network output ammonia nitrogen concentration and expected effluent ammonia nitrogen concentration, unit is mg / L. The results prove the effectiveness of the method.

[0173] This application also provides a neural network-based system for predicting ammonia nitrogen in wastewater treatment effluent, including:

[0174] The data processing module is used to acquire water sample data, and to perform noise reduction, outlier data removal, missing data supplementation, and normalization on the water sample data in sequence to obtain P groups of training samples. The first P1 group of data is used as the training sample, and the second P2 group of data is used as the test sample.

[0175] The variable determination module is used to determine the input variables of the neural network model; wherein, the input variables specifically include total phosphorus in the influent, redox potential, dissolved oxygen concentration, total suspended solids, and pH value;

[0176] The model training module is used to design the neural network model and train the output layer weights of the network using training samples. The neural network is a two-layer sparse Bayesian echo-state network, consisting of an input layer, hidden layers, and an output layer. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The sigmoid function is used as the activation function for the hidden nodes, and a linear function is used as the activation function for the output nodes.

[0177] The results output module is used to test the trained neural network using test samples, and outputs the neural network as the predicted result of effluent ammonia nitrogen after the test.

[0178] Specific limitations regarding the wastewater effluent ammonia nitrogen prediction system can be found in the above section on the limitations of neural network-based wastewater effluent ammonia nitrogen prediction, and will not be repeated here. Each module in the aforementioned wastewater effluent ammonia nitrogen prediction system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, allowing the processor to call and execute the corresponding operations of each module.

[0179] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0180] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for predicting ammonia nitrogen in wastewater effluent based on neural networks, characterized in that, The method includes: Acquire water sample data, and perform noise reduction, outlier removal, missing data supplementation, and normalization on the water sample data in sequence to obtain P groups of training samples. Take the first P1 group of data as the training samples and the second P2 group of data as the test samples. Determine the input variables for the neural network model; specifically, the input variables include total phosphorus in the influent, redox potential, dissolved oxygen concentration, total suspended solids, and pH value. Design a neural network model and train the output layer weights using training samples. The neural network is a two-layer sparse Bayesian echo-state network, consisting of an input layer, hidden layers, and an output layer. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The sigmoid function is used as the activation function for the hidden nodes, and a linear function is used as the activation function for the output nodes. The trained neural network was tested using test samples, and the output of the neural network after the test was completed was used as the prediction result of ammonia nitrogen in the effluent. In the normalization process of water sample data, the specific steps are based on the formula. ; Normalization was performed, where This is a set of measured wastewater influent data before normalization. The maximum value in the array. The minimum value in the array. This corresponds to the normalized influent data value; Designing neural network models specifically includes: Determine the input layer neurons, update the hidden layer neuron states, and calculate the output layer output; In the input layer neurons, according to the formula ; Determine the output of the input layer neurons, where, The output of the i-th input layer node in the n-th sample. The input vector is ; Updating the hidden layer neuron states specifically includes: A sub-reservoir is randomly generated. Based on the given reservoir size and sparsity, the reservoir weights of each sub-reservoir module in the hidden layer are randomly generated in a uniform distribution. Through the scaling factor and spectral radius Adjustment ; The input weight matrix is ​​generated according to a uniform distribution. Initialize the reserve pool state of the i-th sub-reserve pool module. ; Using input signal The driving reserve pool is updated using the following formula: ; in, Let be the vector of the i-th reserve pool in the hidden layer, denoted as To overcome the effects of the initial transient, from Start collecting the internal state matrix at each time step ,in P represents the number of training samples.

2. The method for predicting ammonia nitrogen in wastewater effluent according to claim 1, characterized in that, The output of the computational output layer specifically includes: Initialize hyperparameters and ; The formula for calculating the output value of the output layer is as follows: ; in, It is independent noise that follows a Gaussian distribution, with a mean of 0 and a variance of . , Output a weight vector for the reserve pool; output the unknown weight parameters for each submodule of the hidden layer. Related, and let the expected output be denoted as ; The output formula is written in matrix form, giving the prior distribution of the likelihood function of the training samples and the output weights, as well as the posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo state network. After calculating the covariance and mean, the optimal values ​​of the hyperparameters are calculated using the second type of maximum likelihood method. After calculating the optimal values ​​of the output weights and weight parameters, the expected output is obtained.

3. The method for predicting ammonia nitrogen in wastewater effluent according to claim 2, characterized in that, Write the output formula in matrix form, specifically including: ; in, , .

4. The method for predicting ammonia nitrogen in wastewater effluent according to claim 3, characterized in that, The prior distributions of the likelihood function and output weights for the training samples, as well as the posterior distributions of the unknown parameters of the two-layer sparse Bayesian echo state network, are given, specifically including: Give the likelihood function of the training samples and the prior distribution of the output weights. ; ; ; in, and These are independent priors; The posterior distribution of the unknown parameters of the two-layer sparse Bayesian echo-state network is given as follows: ; According to Bayes' rule, the first term on the right-hand side of the equation... 。 5. The method for predicting ammonia nitrogen in wastewater effluent according to claim 4, characterized in that, After calculating the covariance and mean, the optimal values ​​of the hyperparameters are calculated using the second type of maximum likelihood method. After calculating the optimal values ​​of the output weights and weight parameters, the expected output is obtained, specifically including: Calculate covariance mean ,in: ; ; ; ; Calculating hyperparameters using the second type of maximum likelihood method and The optimal value of the hyperparameters is obtained by satisfying the posterior distribution of the hyperparameters. The maximum likelihood function is given below: ; The optimal values ​​of the hyperparameters are obtained by differentiating the marginal log-likelihood function: ; ; ; Calculate the output weights and weight parameters Find the optimal value. until convergence, ultimately obtaining optimal value , optimal value ; Predicted output based on ; The calculation yields y, where new This is the predicted result.

6. A neural network-based system for predicting ammonia nitrogen in wastewater treatment effluent, characterized in that, The system includes: The data processing module is used to acquire water sample data, and to perform noise reduction, outlier data removal, missing data supplementation, and normalization on the water sample data in sequence to obtain P groups of training samples. The first P1 group of data is used as the training sample, and the second P2 group of data is used as the test sample. The variable determination module is used to determine the input variables of the neural network model; wherein, the input variables specifically include total phosphorus in the influent, redox potential, dissolved oxygen concentration, total suspended solids, and pH value; The model training module is used to design the neural network model and train the output layer weights of the network using training samples. The neural network is a two-layer sparse Bayesian echo-state network, consisting of an input layer, hidden layers, and an output layer. The network topology is 5-m-1, with 5 neurons in the input layer, m neurons in the hidden layers, and 1 neuron in the output layer. The sigmoid function is used as the activation function for the hidden nodes, and a linear function is used as the activation function for the output nodes. The result output module is used to test the trained neural network using test samples, and outputs the neural network as the prediction result of effluent ammonia nitrogen after the test is completed. In the normalization process of water sample data, the specific steps are based on the formula. ; Normalization was performed, where This is a set of measured wastewater influent data before normalization. The maximum value in the array. The minimum value in the array. This corresponds to the normalized influent data value; Designing neural network models specifically includes: Determine the input layer neurons, update the hidden layer neuron states, and calculate the output layer output; In the input layer neurons, according to the formula ; Determine the output of the input layer neurons, where, The output of the i-th input layer node in the n-th sample. The input vector is ; Updating the hidden layer neuron states specifically includes: A sub-reservoir is randomly generated. Based on the given reservoir size and sparsity, the reservoir weights of each sub-reservoir module in the hidden layer are randomly generated in a uniform distribution. Through the scaling factor and spectral radius Adjustment ; The input weight matrix is ​​generated according to a uniform distribution. Initialize the reserve pool state of the i-th sub-reserve pool module. ; Using input signal The driving reserve pool is updated using the following formula: ; in, Let be the vector of the i-th reserve pool in the hidden layer, denoted as To overcome the effects of the initial transient, from Start collecting the internal state matrix at each time step ,in P represents the number of training samples.

Citation Information

Patent Citations

  • Knowledge-based robust effluent ammonia nitrogen soft measurement method

    CN110542748A

  • Effluent NH4-N soft measurement method based on ELM-SL0 neural network

    CN110837886A