Outlet water total phosphorus concentration robust soft measurement method based on small-world neural network
Through a robust soft measurement method based on small world neural network, combined with a central mixed correlation entropy and a robust loss function with adaptive Lasso punishment, the problem of difficult to accurately detect the total phosphorus concentration of effluent during sewage treatment is solved, and the problem of the difficulty in detecting the total phosphorus concentration in the effluent treatment process is realized. Accurate prediction in the presence of noise and outliers reduces costs and improves accuracy.
Patent Information
- Application Number
- CN202410976773.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-02-14
AI Technical Summary
The total phosphorus concentration of effluent during sewage treatment is difficult to accurately detect, especially in the presence of noise and outliers, the prior art has problems of complex operation and high cost.
Using a robust soft measurement method based on small world neural networks, a robust feedforward small world neural network model is designed by selecting auxiliary variables, data normalization, and combining a robust and adaptive Lasso punishment with a central hybrid correlation entropy and adaptive Lasso punishment The loss function is trained in the model to achieve accurate prediction of the total phosphorus concentration in the effluent.
In the presence of noise and outliers, accurate prediction of the total phosphorus concentration of the effluent water is achieved, which reduces the network complexity and improves the prediction accuracy of the model, which is convenient to operate and low cost.
Smart Images

Figure CN119443168A_ABST
Abstract
Description
Technical Field
[0001] The present invention is a robust soft measurement method for effluent total phosphorus concentration based on a small-world neural network, which aims to achieve accurate prediction of effluent total phosphorus concentration in the presence of noise and outliers. It involves the field of artificial intelligence and is directly applicable to the field of sewage treatment. Background Art
[0002] Total phosphorus refers to the total content of phosphorus in water. It is closely related to algae reproduction and eutrophication of water bodies. It is one of the important indicators for evaluating the effluent quality of sewage treatment plants. In order to effectively control water pollution, it is necessary to accurately measure the total phosphorus concentration of the effluent from sewage treatment plants. At present, the methods for measuring total phosphorus in effluent include spectrophotometry, atomic absorption spectroscopy, and electrochemical methods. Spectrophotometry has high accuracy and sensitivity, but the operation is relatively complicated; atomic absorption spectroscopy has high measurement accuracy, but the operation is complicated and requires professional equipment and technical support; the electrochemical method is easy to operate, but its accuracy is slightly inferior to spectrophotometry and atomic absorption spectroscopy. Therefore, how to detect the total phosphorus concentration of effluent at low cost and high efficiency is a difficult problem faced by the sewage treatment process.
[0003] Soft measurement is a data-driven method that uses easy-to-measure variables to predict difficult-to-measure variables. It is widely used in the field of sewage treatment due to its ease of operation and is a key technology for detecting sewage quality parameters. However, as a data-driven method, its measurement accuracy depends largely on the quality of the data set, and the actual sewage treatment process data collection process will inevitably have noise and outliers. The present invention proposes a robust soft measurement method for effluent total phosphorus concentration based on a small-world neural network, which achieves accurate prediction of effluent total phosphorus concentration in the presence of noise and outliers. Summary of the invention
[0004] 1. Technical problems that the present invention needs and can solve:
[0005] The present invention proposes a robust soft measurement method for effluent total phosphorus concentration based on a small-world neural network. According to the data collected during the actual sewage treatment process, the method realizes accurate prediction of the effluent total phosphorus concentration in the presence of noise and outliers, thus solving the problem of difficulty in detecting effluent total phosphorus in the actual sewage treatment process.
[0006] 2. Specific technical solutions of the present invention:
[0007] The present invention proposes a robust soft sensing method for effluent total phosphorus concentration based on a small-world neural network. The algorithm comprises the following steps:
[0008] Step 1: Select auxiliary variables;
[0009] Collect actual water quality parameter data of sewage treatment plant X = [x 1,...x q ,...x Q ], where x q represents the qth variable, x Q represents the output variable (total phosphorus in effluent), the other variables are the original input variables, and Q represents the number of all variables; the qth variable is calculated according to formula (1) 1 variables and q 2 Spearman rank correlation of variables:
[0010]
[0011] Among them, D p is the qth of the pth sample 1 variables and q 2 The rank difference between variables, P is the number of samples in the data set; sort and screen the variables that have a significant correlation S with the output variable, then delete the variables with less correlation to determine the final auxiliary variables;
[0012] Step 2: Data normalization;
[0013] The auxiliary variables obtained in step 1 are normalized to [-1, 1] according to formula (2), and the output variables are normalized to [0, 1] according to formula (3):
[0014]
[0015] in, and y represent the normalized mth auxiliary variable and output variable respectively; min(x m ) and max(x m ) represent the minimum and maximum values of the mth auxiliary variable, min(x m ) and max(x m ) represent the minimum and maximum values of the output variables respectively;
[0016] Step 3: Design a robust feedforward small-world neural network model;
[0017] Step 3.1: Construct a regular feedforward neural network;
[0018] Construct an L-layer regular feedforward neural network; it consists of an input layer, a hidden layer, and an output layer. The nodes in the same layer are not connected, and the nodes in two adjacent layers are connected in pairs. The output of the nodes in the previous layer is the input of the nodes in the next layer. The weight matrix W is randomly initialized and the value range is set to [-1,1]. The number of reconnection edges ν is set according to half of the maximum number of reconnection edges in the network.
[0019] Step 3.2: Design robust wiring rules to construct a feedforward small-world neural network;
[0020] Step 3.2.1: According to the Spearman rank correlation S between each variable and the output variable obtained in step 1, set the threshold ζ, which ranges from (0,1); select input variables with S ≥ ζ, and randomly disconnect one connection for each of them. Assume that it is the connection from the i-th neuron in the first layer to the j-th neuron in the second layer. The connection weight is expressed as (1≤i≤m 1 , 1≤j≤m 2 , m 1 and m 2 denote the number of neurons in the first and second layers respectively); then, disconnect it from the terminal neuron (the jth neuron in the second layer), Set to 0, and then directly reconnect the i-th neuron in the 1st layer to the output variable of the L-th layer across layers. The connection weight is expressed as And initialize randomly in [-1,1];
[0021] Step 3.2.2: Randomly select a connection, assuming it is the connection from the i-th neuron in the l-th layer to the j-th neuron in the l+1-th layer, and the connection weight is expressed as (1≤i≤m l , 1≤j≤m l+1 , 1≤l≤L-2,m l and m l+1 denotes the number of neurons in the lth layer and the l+1th layer respectively); then, disconnect it from the terminal neuron (the jth neuron in the l+1th layer), is set to 0 and randomly reconnected to another neuron in the subsequent layer, recorded as the kth neuron in the sth layer, and the connection weight is expressed as (1≤k≤m s , l+2≤s≤L,m s represents the number of neurons in the sth layer) and is randomly initialized within [-1,1]; if the rewired connection already exists, rewiring is performed again until a new connection is generated;
[0022] Step 3.2.3: Repeat step 3.2.2 until the number of reconnected edges ν is reached;
[0023] Step 3.3: Obtain information output of each layer of the robust feedforward neural network;
[0024] ① Input layer: The input vector is recorded as The output of the i-th neuron in the input layer is calculated as:
[0025]
[0026] in, represents the i-th input variable of the input layer, m 1 represents the number of neurons in the first layer;
[0027] ② Hidden layer: The output of the j-th neuron in the l-th layer (1 < l < L) is:
[0028]
[0029] where, m s is the number of neurons in the s-th layer, represents the connection weight between the i-th neuron in the s-th layer and the j-th neuron in the l-th layer, represents the output of the i-th neuron in the s-th layer, and f(·) is the Sigmoid activation function;
[0030] ③ Output layer: The output of the neurons in the output layer is:
[0031]
[0032] where, represents the connection weight between the i-th neuron in the s-th layer and the output neuron in the L-th layer, represents the output of the i-th neuron in the s-th layer;
[0033] Step 4: Design a robust feedforward small-world neural network training algorithm;
[0034] Step 4.1: Define a robust loss function as shown in formula (7):
[0035] J(W) = V(T, Y) + L(W) (7)
[0036] where, V(T, Y) is a centered mixed correlation entropy function, T represents the expected output, Y represents the actual output, L(W) is the adaptive Lasso penalty, and W is the weight matrix;
[0037] Step 4.1.1: Define the mixed correlation entropy with K sub-kernels for the expected output T and the actual output Y as shown in formula (8):
[0038]
[0039] where, α = [α 1 ,..., α k ,..., α K T is the mixed coefficient vector, and α k represents the mixed coefficient of the k-th sub-kernel, σ = [σ 1 ,..., σ k ,..., σ K T is the kernel width vector, σ k represents the kernel width of the kth sub-kernel, e is the error between the expected output T and the actual output Y, E[·] represents the expected operation, and the kernel function is the Gaussian kernel function, as shown in formula (9):
[0040]
[0041] Step 4.1.2: Further introduce the center value into the mixed correlation entropy defined by formula (8) so that the sub-cores can be concentrated in different positions (not limited to zero mean), as shown in formula (10):
[0042]
[0043] Where N is the number of training samples, c = [c 1 ,...,c k ,...c K ] T is the center vector, c k represents the center of the k-th sub-core;
[0044] Step 4.1.3: Define the adaptive Lasso penalty to achieve different degrees of compression of weights, uniformly reduce the impact of noise and outliers on weights, and further improve the robustness of the network, as shown in formula (11):
[0045] L(W)=λ||β⊙W|| 1 (11)
[0046] Among them, λ is the regularization coefficient, and its value range is [10 -5 ,10 -1 ]; W is the weight matrix, β is the adaptive weight matrix, represents the adaptive weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer, which is defined as follows:
[0047]
[0048] in, is the connection weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer obtained by training without adding the adaptive Lasso penalty loss function;
[0049] Step 4.2: Initialize training iteration number t=1, maximum iteration number t max ;
[0050] Step 4.3: According to the robust loss function defined in formula (7), the back propagation algorithm is used to update the connection weights. The connection weight update obtained is shown in formula (13):
[0051]
[0052] in, and denote the connection weights of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t+1-th iteration and the t-th iteration respectively; represents the weight change of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t-th iteration, which is defined as follows:
[0053]
[0054] Among them, μ is the learning rate, the value range is (0,0.1], N is the number of training samples, K is the number of Gaussian kernels, α k is the mixing coefficient of the kth sub-core, σ k is the kernel width of the kth sub-kernel, c k is the center of the kth sub-nucleus, is the output of the ith neuron in layer l, represents the adaptive weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer defined by formula (12) at the t-th iteration, sign(·) is the sign function, represents the error of the jth neuron in the sth layer and is defined as follows:
[0055]
[0056] Where L is the number of network layers, is the connection weight matrix between the jth neuron in the sth layer and the neurons in the dth layer, δ d is the error of the d-th layer neuron, is the output of the jth neuron in the sth layer, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0057] Step 4.4: Design an adaptive adjustment strategy for the Gaussian kernel center c;
[0058] Define the output mean square error (MSE), as shown in formula (16):
[0059]
[0060] Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0061] Define the error change rate η during the training process as shown in formula (17):
[0062]
[0063] Where MSE(t-1) and MSE(t) are the mean square errors defined by formula (16) at the t-1th iteration and the tth iteration, respectively. When the iteration number t = 1, the Gaussian kernel center is initialized using the robust k-medoids clustering algorithm. The threshold γ is set in the range of (0, 1). When the error change rate η>γ, the Gaussian kernel center c is updated using the robust k-medoids clustering algorithm according to the current error distribution. The steps are as follows:
[0064] ① Make sure the number of clusters is equal to the number of Gaussian kernels K in step 4.1.1;
[0065] ② Randomly select K points in the current error data as the initial clustering centers;
[0066] ③ Calculate the distance between other data points and the cluster center, and assign each point to the cluster with the closest distance;
[0067] ④ For all other points except the center point in the kth (1≤k≤K) class, select a data point as the candidate center point, and calculate the total distance from all data points in the cluster to the new center point when it is the new center point. If the total distance decreases, then use this data point as the new center point;
[0068] ⑤ Repeat steps ③ to ④ until all center points no longer change or the maximum number of iterations set has been reached;
[0069] Step 4.5: Sparse the network connection weights;
[0070] Define the weight threshold as 0.005, and delete the network connections whose current weight is less than 0.005; at the same time, identify whether each neuron is connected to the subsequent layer. If not, delete all the weights of the neuron connected to the neurons in the previous layer;
[0071] Step 4.6: Calculate the training root mean square error (RMSE) according to formula (18):
[0072]
[0073] Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0074] Step 4.7: The number of iterations t increases by 1. When the number of iterations reaches the set maximum value t max Stop training when , otherwise repeat steps 4.3 to 4.6;
[0075] Step 5: Prediction of effluent total phosphorus;
[0076] The test sample data was used as the input of the trained robust feedforward small-world neural network to obtain the output of the network, which was then denormalized to obtain the predicted value of the effluent total phosphorus concentration.
[0077] 3. Compared with the prior art, the present invention has the following obvious advantages and beneficial effects:
[0078] (1) The present invention uses a soft measurement method to predict the total phosphorus in effluent, which solves the problems of complex operation and high cost of total phosphorus measurement in effluent during sewage treatment. A robust soft measurement method for total phosphorus concentration in effluent based on a small-world neural network is proposed, which has the advantages of convenient operation, robust model, and high measurement accuracy.
[0079] (2) In view of the inevitable problems of noise and outliers in the actual sewage treatment process, the present invention designs a robust feedforward small-world neural network and proposes a robust loss function that combines the mixed correlation entropy with center and the adaptive Lasso penalty for model training. This improves the robustness of the soft sensor model in terms of structure and algorithm, reduces the network complexity, and improves the prediction accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 This is the RMSE graph of the total phosphorus concentration in effluent of the present invention;
[0081] Figure 2 This is a prediction effect diagram of the total phosphorus concentration in effluent of the present invention;
[0082] Figure 3 is a prediction error diagram of the effluent total phosphorus concentration of the present invention; DETAILED DESCRIPTION
[0083] The present invention obtains a robust soft measurement method for effluent total phosphorus concentration based on a small-world neural network, realizes accurate measurement of effluent total phosphorus concentration according to data collected during the actual sewage treatment process, solves the problem of difficulty in measuring effluent total phosphorus concentration during the sewage treatment process, and improves the water quality detection level of sewage treatment plants;
[0084] The experimental data comes from 2309 sets of samples from a sewage treatment plant in Beijing, China from April to November 2021. The collected variables include (1) influent flow, (2) effluent flow, (3) return flow, (4) regulating tank water level, (5) influent pH, (6) influent chemical oxygen demand (COD), (7) effluent COD, (8) effluent total nitrogen, and (9) effluent total phosphorus, among which effluent total phosphorus is the target variable and the remaining variables are auxiliary variables; 1600 sets of data are randomly selected as training samples, and the remaining 709 sets of data are used as test samples;
[0085] Step 1: Select auxiliary variables;
[0086] Collect actual water quality parameter data of sewage treatment plant X = [x 1 ,...x q ,...x Q ], where x q represents the qth variable, x Q represents the output variable (total phosphorus in effluent), the other variables are the original input variables, and Q represents the number of all variables; the qth variable is calculated according to formula (1) 1 variables and q 2 Spearman rank correlation of variables:
[0087]
[0088] Among them, D p is the qth of the pth sample 1 variables and q 2 The rank difference between the variables, P is the number of samples in the data set; the variables with significant correlation S with the output variable are sorted and screened, and then the variables with less correlation are deleted to determine the final auxiliary variables; in this embodiment, P is 2309, and the following 6 variables are determined as auxiliary variables for model input according to the correlation and significance, including effluent flow, return flow, influent pH, influent COD, effluent COD, and effluent total nitrogen;
[0089] Step 2: Data normalization;
[0090] The auxiliary variables obtained in step 1 are normalized to [-1, 1] according to formula (2), and the output variables are normalized to [0, 1] according to formula (3):
[0091]
[0092] in, and y represent the normalized mth auxiliary variable and output variable respectively; min(x m ) and max(x m) represent the minimum and maximum values of the mth auxiliary variable, min(x m ) and max(x m ) represent the minimum and maximum values of the output variables respectively;
[0093] Step 3: Design a robust feedforward small-world neural network model;
[0094] Step 3.1: Construct a regular feedforward neural network;
[0095] Construct an L-layer regular feedforward neural network; it consists of an input layer, a hidden layer and an output layer. The nodes in the same layer are not connected, the nodes between two adjacent layers are connected in pairs, and the output of the nodes in the previous layer is the input of the nodes in the next layer; randomly initialize the weight matrix W, set the value range to [-1,1], and set the number of reconnected edges ν according to half of the maximum number of reconnected edges in the network; in this embodiment, L is 4, the number of neurons in the input layer is the same as the number of auxiliary variables, which is 6, the initial number of neurons in each hidden layer is 20, and the output layer is 1 neuron, so the initial network structure is [6,20,20,1], and the number of reconnected edges ν is 70;
[0096] Step 3.2: Design robust wiring rules to construct a feedforward small-world neural network;
[0097] Step 3.2.1: According to the Spearman rank correlation S between each variable and the output variable obtained in step 1, set the threshold ζ, the value range is (0,1), select the input variables with S ≥ ζ, and randomly disconnect one connection for each of them. Assume that it is the connection from the i-th neuron in the first layer to the j-th neuron in the second layer. The connection weight is expressed as (1≤i≤m 1 , 1≤j≤m 2 , m 1 and m 2 denotes the number of neurons in the first and second layers respectively); then, disconnect it from the terminal neuron (the jth neuron in the second layer), Set to 0, and then directly reconnect the i-th neuron in the 1st layer to the output variable of the L-th layer across layers. The connection weight is expressed as And randomly initialized in [-1,1]; in this embodiment, ζ is 0.25;
[0098] Step 3.2.2: Randomly select a connection, assuming it is the connection from the i-th neuron in the l-th layer to the j-th neuron in the l+1-th layer, and the connection weight is expressed as (1≤i≤m l , 1≤j≤m l+1 , 1≤l≤L-2,m l and m l+1representing the number of neurons in the $l$-th layer and the $(l + 1)$-th layer respectively); then, disconnect it from the terminal neuron (the $j$-th neuron in the $(l + 1)$-th layer), set it to 0, and randomly reconnect it to another neuron in the subsequent layer, denoted as the $k$-th neuron in the $s$-th layer, and the connection weight is represented as (1 ≤ $k$ ≤ $m$ s , $l + 2$ ≤ $s$ ≤ $L$, $m$ s representing the number of neurons in the $s$-th layer), and randomly initialize it within [-1, 1]; if the re-wired connection already exists, re-wire it again until a new connection is generated;
[0099] Step 3.2.3: Repeat Step 3.2.2 until the number of reconnected edges $\nu$ is reached;
[0100] Step 3.3: Obtain the information output of each layer of the robust feedforward neural network;
[0101] ① Input layer: The input vector is denoted as The output of the $i$-th neuron in the input layer is calculated as:
[0102]
[0103] where, represents the $i$-th input variable of the input layer, $m$ 1 represents the number of neurons in the 1st layer;
[0104] ② Hidden layer: The output of the $j$-th neuron in the $l$-th layer (1 < $l$ < $L$) is:
[0105]
[0106] where, $m$ s is the number of neurons in the $s$-th layer, represents the connection weight between the $i$-th neuron in the $s$-th layer and the $j$-th neuron in the $l$-th layer, represents the output of the $i$-th neuron in the $s$-th layer, and $f(·)$ is the Sigmoid activation function;
[0107] ③ Output layer: The output of the neurons in the output layer is:
[0108]
[0109] where, represents the connection weight between the $i$-th neuron in the $s$-th layer and the output neuron in the $L$-th layer, represents the output of the $i$-th neuron in the $s$-th layer;
[0110] Step 4: Design a training algorithm for the robust feedforward small-world neural network;
[0111] Step 4.1: Define the robust loss function as shown in formula (7):
[0112] J(W)=V(T,Y)+L(W) (7)
[0113] Among them, V(T,Y) is a mixed correlation entropy function with a center, T represents the expected output, Y represents the actual output, L(W) is the adaptive Lasso penalty, and W is the weight matrix;
[0114] Step 4.1.1: Define the mixed correlation entropy of the expected output T and the actual output Y with K sub-kernels, as shown in formula (8):
[0115]
[0116] Where α=[α 1 ,...,α k ,...,α K ] T is the mixing coefficient vector, α k represents the mixing coefficient of the kth sub-core, σ=[σ 1 ,...,σ k ,...,σ K ] T is the kernel width vector, σ k represents the kernel width of the kth sub-kernel, e is the error between the expected output T and the actual output Y, E[·] represents the expected operation, and the kernel function is the Gaussian kernel function, as shown in formula (9):
[0117]
[0118] In this embodiment, K=2 is set, and the grid search method is used to determine the parameter α of each sub-core. k and σ k , α k The value of is searched in {0.9, 0.8, 0.7, 0.6, 0.5}, σ k The value of is searched in {0.1, 0.3, 0.5, 0.7, 1, 3, 5, 7, 10}. In this embodiment, α is determined to be [0.9, 0.1], σ is determined to be [3, 1];
[0119] Step 4.1.2: Further introduce the center value into the mixed correlation entropy defined by formula (8) so that the sub-cores can be concentrated in different positions (not limited to zero mean), as shown in formula (10):
[0120]
[0121] Where N is the number of training samples, c = [c 1,...,c k ,...c K ] T is the center vector, c k represents the center of the k-th sub-core; in this embodiment, N is 1600, and c is adaptively determined during the training process;
[0122] Step 4.1.3: Define the adaptive Lasso penalty to achieve different degrees of compression of weights, uniformly reduce the impact of noise and outliers on weights, and further improve the robustness of the network, as shown in formula (11):
[0123] L(W)=λ||β⊙W 1 || (11)
[0124] Among them, λ is the regularization coefficient, and the value range of λ is [10 -5 ,10 -1 ], W is the weight matrix, β is the adaptive weight matrix, represents the adaptive weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer, which is defined as follows:
[0125]
[0126] in, is the connection weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer obtained by training without adding the adaptive Lasso penalty loss function; in this embodiment, λ is 10 -3 ;
[0127] Step 4.2: Initialize training iteration number t=1, maximum iteration number t max ; In this example, t max Take 10000;
[0128] Step 4.3: According to the robust loss function defined in formula (7), the back propagation algorithm is used to update the connection weights. The connection weight update obtained is shown in formula (13):
[0129]
[0130] in, and denote the connection weights of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t+1-th iteration and the t-th iteration respectively; represents the weight change of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t-th iteration, which is defined as follows:
[0131]
[0132] Wherein, μ is the learning rate, and its value range is (0, 0.1]. In this embodiment, μ is 0.0008; N is the number of training samples, K is the number of Gaussian kernels, and α k is the mixing coefficient of the kth sub-core, σ k is the kernel width of the kth sub-kernel, c k is the center of the kth sub-nucleus, is the output of the ith neuron in the lth layer, sign(·) is the sign function, represents the adaptive weights of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer defined by formula (12) at the t-th iteration, represents the error of the jth neuron in the sth layer and is defined as follows:
[0133]
[0134] Where L is the number of network layers, is the connection weight matrix between the jth neuron in the sth layer and the neurons in the dth layer, δ d is the error of the d-th layer neuron, is the output of the jth neuron in the sth layer, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0135] Step 4.4: Design an adaptive adjustment strategy for the Gaussian kernel center c;
[0136] Define the output mean square error (MSE), as shown in formula (16):
[0137]
[0138] Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0139] Define the error change rate η during the training process as shown in formula (17):
[0140]
[0141] Wherein, MSE(t-1) and MSE(t) are the mean square errors defined by formula (16) at the t-1th iteration and the tth iteration, respectively; when the number of iterations t=1, the Gaussian kernel center is initialized using the robust k-medoids clustering algorithm; a threshold γ is set, and the value range is (0,1). In this embodiment, γ is 0.5; when the error change rate η>γ, the Gaussian kernel center c is updated using the robust k-medoids clustering algorithm according to the current error distribution, and the steps are as follows:
[0142] ① Determine that the number of clusters is equal to the number of Gaussian kernels K in step 4.1.1; in this example, set K = 2;
[0143] ② Randomly select K points in the current error data as the initial clustering centers;
[0144] ③ Calculate the distance between other data points and the cluster center, and assign each point to the cluster with the closest distance;
[0145] ④ For all other points except the center point in the kth (1≤k≤K) class, select a data point as the candidate center point, and calculate the total distance from all data points in the cluster to the new center point when it is the new center point. If the total distance decreases, then use this data point as the new center point;
[0146] ⑤ Repeat steps ③ to ④ until all center points no longer change or the maximum number of iterations set has been reached;
[0147] Step 4.5: Sparse the network connection weights;
[0148] Define the weight threshold as 0.005, and delete the network connections whose current weight is less than 0.005; at the same time, identify whether each neuron is connected to the subsequent layer. If not, delete all the weights of the neuron connected to the neurons in the previous layer;
[0149] Step 4.6: Calculate the training root mean square error (RMSE) according to formula (18):
[0150]
[0151] Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer;
[0152] Step 4.7: The number of iterations t increases by 1. When the number of iterations reaches the set maximum value t max Stop training when , otherwise repeat steps 4.3 to 4.6;
[0153] Step 5: Prediction of effluent total phosphorus;
[0154] The test sample data was used as the input of the trained robust feedforward small-world neural network to obtain the output of the network, which was then denormalized to obtain the predicted value of the effluent total phosphorus concentration.
[0155] In this embodiment, the training RMSE change diagram is as follows: Figure 1 As shown, the X-axis is the number of training steps, and the Y-axis is the training RMSE, the unit is mg / L; the prediction effect of effluent total phosphorus concentration is as follows Figure 2 As shown, the X-axis is the number of samples, the unit is / sample, the Y-axis is the effluent total phosphorus concentration, the unit is mg / L, the dotted line is the actual output value of the effluent total phosphorus concentration, and the solid line is the predicted output value of the effluent total phosphorus concentration; the effluent total phosphorus concentration prediction error diagram is shown in Figure 3 As shown, the X-axis is the number of samples, the unit is / sample, and the Y-axis is the predicted total phosphorus concentration in the effluent, the unit is mg / L; it can be seen that the predicted value of the total phosphorus concentration in the effluent of the present invention is basically fitted with its actual value curve, with high accuracy, and can achieve accurate prediction of the total phosphorus in the effluent in the presence of noise and abnormal values. Table 1 is the total phosphorus concentration in the effluent predicted by the present invention.
[0156] Table 1. Total phosphorus concentration in effluent predicted by the present invention (mg / L)
[0157]
[0158]
[0159]
Claims
1. A robust soft-sensing method for total phosphorus concentration in effluent water based on a small-world neural network, characterized in that: include: Step 1: Select auxiliary variables; Collect actual water quality parameter data of sewage treatment plant X=[x1,...x q ,...x Q ], where x q represents the qth variable, x Q represents the output variable, i.e., the total phosphorus in the effluent, and the other variables are the original input variables. Q represents the number of all variables. The Spearman rank correlation between the q1th variable and the q2th variable is calculated according to formula (1): Among them, D p is the rank difference between the q1th variable and the q2th variable of the pth sample, and P is the number of samples in the data set; sort and screen the variables that have a significant correlation S with the output variable, and then delete the variables with less correlation to determine the final auxiliary variables; Step 2: Data normalization; The auxiliary variables obtained in step 1 are normalized to [-1, 1] according to formula (2), and the output variables are normalized to [0, 1] according to formula (3): in, and y represent the normalized mth auxiliary variable and output variable respectively; min(x m ) and max(x m ) represent the minimum and maximum values of the mth auxiliary variable, min(x m ) and max(x m ) represent the minimum and maximum values of the output variables respectively; Step 3: Design a robust feedforward small-world neural network model; Step 3.1: Construct a regular feedforward neural network; Construct an L-layer regular feedforward neural network; it consists of an input layer, a hidden layer, and an output layer. The nodes in the same layer are not connected, and the nodes in two adjacent layers are connected in pairs. The output of the nodes in the previous layer is the input of the nodes in the next layer. The weight matrix W is randomly initialized and the value range is set to [-1,1]. The number of reconnection edges ν is set according to half of the maximum number of reconnection edges in the network. Step 3.2: Design robust wiring rules to construct a feedforward small-world neural network; Step 3.2.1: According to the Spearman rank correlation S between each variable and the output variable obtained in step 1, set the threshold ζ, which ranges from (0,1); select input variables with S ≥ ζ, and randomly disconnect one connection for each of them. Assume that it is the connection from the i-th neuron in the first layer to the j-th neuron in the second layer. The connection weight is expressed as Where 1≤i≤m1, 1≤j≤m2, m1 and m2 represent the number of neurons in the first and second layers respectively; then, disconnect it from the terminal neuron, i.e., the jth neuron in the second layer. Set to 0, and then directly reconnect the i-th neuron in the 1st layer to the output variable of the L-th layer across layers. The connection weight is expressed as And initialize randomly in [-1,1]; Step 3.2.2: Randomly select a connection, assuming it is the connection from the i-th neuron in the l-th layer to the j-th neuron in the l+1-th layer, and the connection weight is expressed as Where 1≤i≤m l , 1≤j≤m l+1 , 1≤l≤L-2,m l and m l+1 denote the number of neurons in the lth layer and the l+1th layer respectively; then, disconnect it from the terminal neuron, i.e., the jth neuron in the l+1th layer. is set to 0 and randomly reconnected to another neuron in the subsequent layer, recorded as the kth neuron in the sth layer, and the connection weight is expressed as Where 1≤k≤m s , l+2≤s≤L,m s Represents the number of neurons in the sth layer and is randomly initialized within [-1,1]; if the rewired connection already exists, rewiring is performed again until a new connection is generated; Step 3.2.3: Repeat step 3.2.2 until the number of reconnected edges ν is reached; Step 3.3: Obtain information output of each layer of the robust feedforward neural network; ① Input layer: The input vector is recorded as The output of the i-th neuron in the input layer is calculated as: in, represents the i-th input variable of the input layer, and m1 represents the number of neurons in the first layer; ②Hidden layer: The output of the jth neuron in the lth layer is: Among them, 1 <l<L,m s is the number of neurons in the sth layer, represents the connection weight between the i-th neuron in the s-th layer and the j-th neuron in the l-th layer, represents the output of the i-th neuron in the s-th layer, and f(·) is the Sigmoid activation function; ③Output layer: The neuron output of the output layer is: in, represents the connection weight between the i-th neuron in the s-th layer and the output neuron in the L-th layer, represents the output of the i-th neuron in the s-th layer; Step 4: Design a robust feedforward small-world neural network training algorithm; Step 4.1: Define the robust loss function as shown in formula (7): J(W)=V(T,Y)+L(W) (7) Among them, V(T,Y) is a mixed correlation entropy function with a center, T represents the expected output, Y represents the actual output, L(W) is the adaptive Lasso penalty, and W is the weight matrix; Step 4.1.1: Define the mixed correlation entropy of the expected output T and the actual output Y with K sub-kernels, as shown in formula (8): Among them, α=[α1,...,α k ,...,α K ] T is the mixing coefficient vector, α k represents the mixing coefficient of the kth sub-core, σ=[σ1,...,σ k ,…,σ K ] T is the kernel width vector, σ k represents the kernel width of the kth sub-kernel, e is the error between the expected output T and the actual output Y, E[·] represents the expected operation, and the kernel function is the Gaussian kernel function, as shown in formula (9): Step 4.1.2: Further introduce the central value into the mixed correlation entropy defined in formula (8), which is defined as shown in formula (10): Where N is the number of training samples, c = [c1,…,c k ,…c K ] T is the center vector, c k represents the center of the k-th sub-core; Step 4.1.3: Define the adaptive Lasso penalty to achieve different degrees of compression of weights and uniformly reduce the impact of noise and outliers on weights, as shown in formula (11): L(W)=λ||β⊙W||1 (11) Among them, λ is the regularization coefficient, and its value range is [10 -5 ,10 -1 ]; W is the weight matrix, β is the adaptive weight matrix, represents the adaptive weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer, which is defined as follows: in, is the connection weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer obtained by training without adding the adaptive Lasso penalty loss function; Step 4.2: Initialize training iteration number t=1, maximum iteration number t max ; Step 4.3: According to the robust loss function defined in formula (7), the back propagation algorithm is used to update the connection weights. The connection weight update obtained is shown in formula (13): in, and denote the connection weights of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t+1-th iteration and the t-th iteration respectively; represents the weight change of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer at the t-th iteration, which is defined as follows: Among them, μ is the learning rate, the value range is (0,0.1], N is the number of training samples, K is the number of Gaussian kernels, α k is the mixing coefficient of the kth sub-core, σ k is the kernel width of the kth sub-kernel, c k is the center of the kth sub-nucleus, is the output of the ith neuron in layer l, represents the adaptive weight of the i-th neuron in the l-th layer and the j-th neuron in the s-th layer defined by formula (12) at the t-th iteration, sign(·) is the sign function, represents the error of the jth neuron in the sth layer and is defined as follows: Where L is the number of network layers, is the connection weight matrix between the jth neuron in the sth layer and the neurons in the dth layer, δ d is the error of the d-th layer neuron, is the output of the jth neuron in the sth layer, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer; Step 4.4: Design an adaptive adjustment strategy for the Gaussian kernel center c; Define the output mean square error MSE as shown in formula (16): Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer; Define the error change rate η during the training process as shown in formula (17): Where MSE(t-1) and MSE(t) are the mean square errors defined by formula (16) at the t-1th iteration and the tth iteration, respectively. When the iteration number t = 1, the Gaussian kernel center is initialized using the robust k-medoids clustering algorithm. The threshold γ is set in the range of (0, 1). When the error change rate η>γ, the Gaussian kernel center c is updated using the robust k-medoids clustering algorithm according to the current error distribution. The steps are as follows: ① Determine that the number of clusters is equal to the number of Gaussian kernels K in step 4.1.1; ② Randomly select K points in the current error data as the initial clustering centers; ③ Calculate the distance between other data points and the cluster center, and assign each point to the cluster with the closest distance; ④ For all other points in the kth class except the center point, and 1≤k≤K, select a data point as the candidate center point, and calculate the total distance from all data points in the cluster to the new center point when it is the new center point. If the total distance decreases, then use this data point as the new center point; ⑤ Repeat steps ③ to ④ until all center points no longer change or the maximum number of iterations set has been reached; Step 4.5: Sparse the network connection weights; Define the weight threshold as 0.005, and delete the network connections whose current weight is less than 0.005; at the same time, identify whether each neuron is connected to the subsequent layer. If not, delete all the weights of the neuron connected to the neurons in the previous layer; Step 4.6: Calculate the training root mean square error RMSE according to formula (18): Where N is the number of training samples, y n represents the expected output of the nth sample, represents the predicted output of the nth sample of the output neuron in the Lth layer; Step 4.7: The number of iterations t increases by 1. When the number of iterations reaches the set maximum value t max Stop training when , otherwise repeat steps 4.3 to 4.6; Step 5: Prediction of effluent total phosphorus; The test sample data was used as the input of the trained robust feedforward small-world neural network to obtain the output of the network, which was then denormalized to obtain the predicted value of the effluent total phosphorus concentration.