A soft sensor modeling method for key indicators of industrial processes
By adopting a multi-model integration method based on error weights in complex industrial processes and combining multiple machine learning models for error correction and weight distribution, the problems of high measurement cost of traditional hardware instruments and insufficient prediction performance of a single model are solved, and a higher level of performance is achieved. The prediction accuracy and robustness are suitable for online monitoring of complex industrial processes.
Patent Information
- Application Number
- CN202410182707.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-02-18
AI Technical Summary
In complex industrial processes, traditional hardware instruments have high measurement costs, are difficult to maintain, and are difficult to monitor complex nonlinear processes. A single machine learning model has limitations in predictive performance, and it is difficult to achieve online monitoring of key indicators.
A multi-model integration method based on error weights is adopted, through a combination of models such as t-distributed random neighbor embedding, recurrent neural network, lightweight gradient boosting, K-neighbor algorithm, extreme gradient boosting, improved chameleon algorithm and least squares support vector machine. Error correction and weight allocation, building a multi-layer soft sensor ensemble model to improve prediction accuracy and robustness.
The accuracy and robustness of the soft measurement model are improved, which can better adapt to complex industrial processes, reduce costs, improve production efficiency and ensure product quality.
Smart Images

Figure CN118070928B
Abstract
Description
Technical Field
[0001] The invention relates to the field of soft-sensing modeling of key indicators of complex industrial processes, and in particular to a soft-sensing modeling method of key indicators of complex industrial processes based on multi-model integration of error weights. Background Art
[0002] Manufacturing is an important pillar of national economic development. Ensuring production quality is a key task for corporate competitiveness. However, the complexity and uncertainty of the production process increase the difficulty of measuring key quality indicators. Traditional hardware instrument measurement has problems such as high cost, difficult maintenance, and insufficient monitoring of complex nonlinear processes. Therefore, new solutions need to be sought. Soft measurement technology can flexibly, in real time and accurately monitor and predict key quality indicators, providing better production quality assurance. Soft measurement technology has broad application prospects, which can reduce measurement costs and improve production efficiency. With the improvement of computer technology and data processing capabilities, soft measurement methods have gradually begun to be applied in industrial production processes. By establishing mathematical models, soft measurement technology can monitor and predict key quality indicators in real time and provide accurate detection results. Compared with hardware measurement equipment, soft measurement has lower cost and is suitable for different production environments and products.
[0003] With the development and popularization of machine learning technology, machine learning methods have also been widely used in soft measurement of complex industrial processes. Machine learning methods such as support vector machines, artificial neural networks, and decision trees can handle complex nonlinear relationships and interactions between multiple variables, and improve the modeling accuracy and robustness of soft measurement.
[0004] However, a single machine learning model still has some limitations. In order to further improve the prediction performance, ensemble learning methods have been introduced into complex industrial process soft measurement. Ensemble learning methods combine the prediction results of multiple single models to obtain better overall performance and generalization ability.
[0005] The present invention proposes an improved ensemble learning method, which takes into account the error weights of different models in prediction. By giving higher weights to models with smaller prediction errors, the accuracy of the overall prediction can be improved. This method can better utilize the complementarity between different models and improve the robustness and generalization ability of prediction. In the actual production process, it is helpful for engineers to better understand and control industrial processes, improve production efficiency, reduce costs and ensure product quality. Summary of the invention
[0006] Purpose of the invention: In view of the problem that some key indicator variables in industrial production processes are difficult to monitor online, the present invention proposes a soft measurement modeling method for key indicators of industrial processes. This method can improve modeling accuracy, enhance the robustness of the model, adapt to complex industrial processes, and improve real-time performance and response speed.
[0007] Technical solution: The present invention discloses a soft-sensing modeling method for key indicators of industrial processes, comprising the following steps:
[0008] S1. Collect key indicator data that need to be measured in the industrial process as the basis for establishing a soft sensor model;
[0009] S2. Use the t-distributed random neighbor embedding (t-SNE) method to extract features from the collected variables to reduce the input dimension of the original data and finally obtain the final input variables of the soft sensor model;
[0010] S3. Construct a multi-layer soft sensor integrated model. The first layer establishes a base model based on error correction. The processed data in S2 are input into the recurrent neural network (GRU), lightweight gradient boosting (LightGBM), and K-nearest neighbor algorithm (KNN) for training, and extreme gradient boosting (XGBoost) is used for error correction.
[0011] S4. The improved chameleon algorithm (TOCSA) is used to optimize the XGBoost model parameters, wherein the improved chameleon algorithm is an improved chameleon algorithm using chaos reverse initialization, and the optimized XGBoost model is used to correct the base model results;
[0012] S5. The second layer establishes a fusion model based on error weighting. According to the error of the soft measurement prediction result of the base model in S3, different weights are assigned to each model of GRU, LightGBM, and KNN. The soft measurement prediction results of each model in the first layer are weighted and fused to obtain the calculation result based on error weighting. The least squares support vector machine (LSSVM) model is used to further predict this fusion result, and two sets of prediction results are obtained: the calculation result based on error weighting and the prediction result based on the error fusion of the LSSVM model.
[0013] S6. The third layer establishes a quadratic error weighted integrated model, and the two sets of results obtained in S5 are weighted based on the errors again to obtain the final soft measurement prediction results;
[0014] S7. Use established models to predict variables that are difficult to measure in industry.
[0015] Furthermore, the key indicator data to be measured in step S1 is connected to a network or a computer through a data acquisition instrument to achieve real-time data acquisition and processing.
[0016] Furthermore, in step S2, t-SNE is used to extract features from the collected variables. The specific steps are as follows:
[0017] S3.1 Calculate similarity: For a given high-dimensional data set, calculate the similarity between data points. The Gaussian kernel function is used to calculate the similarity between data points. The calculation formula is as follows:
[0018]
[0019] Among them, x i and x j is a high-dimensional space data sample; ||x i -x j || represents the Euclidean distance between data point i and data point j; δ i Is x i is the Gaussian variance of the center point;
[0020] S3.2 Define conditional probability: Using similarity information, define the conditional probability distribution between each pair of data points, indicating that at a given data point x i In the case of data point x j The probability of becoming its neighboring point; the calculation formula is as follows:
[0021]
[0022] Among them, p j|i represents the spatial probability distribution, and x j May become x i The probability of the neighboring points; x i is a high-dimensional data sample;
[0023] S3.3 Define t distribution: By symmetrizing and normalizing the conditional probability, we get the conditional probability of t distribution. The formula is as follows:
[0024]
[0025] Among them, y i is a low-dimensional data point;
[0026] S3.4 Define KL divergence: Calculate the KL divergence between data points in high-dimensional space and low-dimensional space. The goal is to make the conditional probability distribution in high-dimensional space and low-dimensional space as close as possible; the calculation formula is as follows:
[0027]
[0028] Among them, P i and Q i Represent the conditional probability distribution in high-dimensional space and low-dimensional space respectively;
[0029] S3.5 Gradient Descent: Through optimization methods such as gradient descent, the KL divergence is minimized to determine the position of each data point in the low-dimensional space. The calculation formula is as follows:
[0030]
[0031] Continuously update the position of each data point in the low-dimensional space, the iterative formula is:
[0032]
[0033] Where μ is the learning rate and η(t) is the coefficient for the tth iteration.
[0034] Furthermore, the training and soft measurement prediction steps of the GRU model in step S3 are as follows:
[0035] S4.1 uses the processed variables in S2 as the input x of the GRU model;
[0036] S4.2 Initialize the hidden state: First, initialize the hidden state h0 to a zero vector or a random vector;
[0037] S4.3 Forward propagation: For each time t in the input sequence, do the following:
[0038] S4.3.1 Update Gate: Calculate the update gate vector z t , the degree of information inflow after control is as follows:
[0039] z t =σ(W z ·[h t-1 ,x t ]) (7)
[0040] S4.3.2 Reset gate: Calculate the reset gate vector r t , controls the degree to which previous information is forgotten, the formula is as follows:
[0041] r t =σ(W z ·[h t-1 ,x t ]) (8)
[0042] S4.3.3 Candidate hidden states: Calculating candidate hidden state vectors Used to update the hidden state, the formula is as follows:
[0043]
[0044] S4.3.4 Update the hidden state: Update the gate vector z according to t and the candidate hidden state vector Calculate the hidden state vector h at the current moment t , the formula is as follows:
[0045]
[0046] Among them, x t Represents the input vector at the current moment; W z , W r , W h Respectively represent the weight parameters of the update gate, reset gate and candidate hidden state; σ represents the sigmoid function; tanh represents the hyperbolic tangent function; represents element-wise multiplication;
[0047] S4.4 Output prediction: Based on the final hidden state h t , using the fully connected layer or other output layer for the final output prediction.
[0048] Furthermore, the training and soft measurement prediction steps of the LightGBM model in step S3 are as follows:
[0049] S5.1 Initialize model parameters: First, you need to set the hyperparameters of the LightGBM model;
[0050] S5.2 Building a decision tree: LightGBM gradually builds a decision tree in an iterative manner to gradually optimize the prediction results. Each iteration builds a new decision tree and adds it to the model.
[0051] S5.3 Calculate the score of the sample: For the sample that needs to be predicted, LightGBM calculates the corresponding score based on the currently constructed decision tree. The score represents the probability or predicted value of the sample belonging to the positive class;
[0052] S5.4 Merge the scores of multiple decision trees: If there are multiple decision trees, LightGBM performs weighted sum or average of their scores to obtain the final prediction result.
[0053] Furthermore, the training and soft measurement prediction steps of the KNN model in step S3 are as follows:
[0054] S6.1 Select K value: First, you need to select a suitable K value, that is, how many nearest neighbors to choose for prediction. The selection of K value may have a great impact on the results and needs to be tuned through cross-validation method;
[0055] S6.2 Calculate the distance: For the sample to be predicted, calculate its distance from all samples in the training set. The calculation formula is as follows:
[0056]
[0057] Among them, x i Indicates the position of point A, y i Indicates the position of point B;
[0058] S6.3 Determine the nearest neighbor: Based on the calculated distance, select the K training samples closest to the sample to be predicted as the nearest neighbors;
[0059] S6.4 makes predictions: adopts the average value principle, that is, selects the average value of the target values of the K nearest neighbors as the prediction result.
[0060] Furthermore, the XGBoost model error correction step in step S3 is as follows:
[0061] S7.1 Train the initial model: First, train an initial XGBoost model using the original data;
[0062] S7.2 Calculate residuals: Use GRU, LightGBM and KNN models to predict the training data respectively to obtain the prediction results. Then, calculate the residual of each sample, that is, the difference between the true value and the predicted value.
[0063] S7.3 Build a new model: Use the residual as the target variable and continue to train a new XGBoost model. The goal of this new model is to reduce the error by fitting the residual.
[0064] S7.4 obtains the prediction results: Use the prediction results of the GRU, LightGBM and KNN models to add the prediction results of the XGBoost model to obtain the updated prediction results.
[0065] Furthermore, in step S4, the improved chameleon algorithm is used to optimize the hyperparameters of the XGBoost model, wherein the optimized hyperparameters are the number of iterations, the weight and the learning rate, and then the optimized XGBoost model is used for error correction. The steps of the improved chameleon algorithm are as follows:
[0066] S8.1 Set the algorithm population size N, upper and lower bounds lb, ub, dimension Dim and maximum number of iterations T;
[0067] S8.2 uses a chaotic reverse strategy to replace the random initialization of the original algorithm. The formula is as follows:
[0068]
[0069] in, and Indicates lower and upper bounds; Represents the population generated by the Tent mapping; represents the population generated by reverse learning, is the chaotic sequence generated by Tent mapping, and the formula is as follows:
[0070]
[0071] Among them, r∈(0,1);
[0072] S8.3 merges the two populations, calculates the fitness value of each individual, and selects the first N as the final population;
[0073] S8.4 Search for prey. For each individual, update its position based on the information of its neighbor individuals. The formula is as follows:
[0074]
[0075] in, is the position of the i-th chameleon in the t-th iteration of the j-dimensional space; p1, p2 are control coefficients; r1, r2 are random numbers in [0,1]; Best represents the best position of the i-th chameleon in the j-dimensional space; j is the global optimal position of the chameleon; pro is the perception probability of the chameleon; sgn(rand-0.5) represents the rotation direction of the chameleon; η is the parameter that controls the search ability, and the expression is as follows:
[0076]
[0077] Among them, α is a sensitive parameter;
[0078] S8.5 detects prey, and its mathematical model is described as follows:
[0079]
[0080] in, represents the center position of the i-th chameleon at the j-th iteration; B is the rotation matrix, expressed as follows:
[0081]
[0082] in, Represents the vector after the two vectors z1 and z2 are orthogonal to each other; r∈(0,1);
[0083] S8.6 captures prey, and its mathematical model is described as follows:
[0084]
[0085] in, represents the speed of the tth iteration; represents the speed of the previous iteration; a represents the acceleration, and the formula is as follows:
[0086] a=2590×(1-e -log ( t) ) (19).
[0087] Furthermore, in step S5, a second layer model is established, and the steps are as follows:
[0088] S9.1 represents the final prediction results of the three models in S3 as y1, y2 and y3 respectively, then the error-based fusion strategy can be expressed as:
[0089] Y=w1y1+w2y2+w3y3 (20)
[0090] Among them, w1, w2 and w3 represent the error weight coefficients, and their calculation formula is as follows:
[0091]
[0092] e all =e1+e2+e3 (22)
[0093] Among them, e1, e2 and e3 represent the prediction errors of GRU, LightGBM and KNN after using XGBoost error correction respectively;
[0094] S9.2 sends the fused result Y to the LSSVM model for prediction, and obtains the calculation result based on the error weight, which is recorded as Y′.
[0095] Furthermore, in step S6, the third layer model is established by assigning weights to the prediction results Y based on error fusion and the calculation results Y′ based on error weights, and obtaining the final soft measurement prediction results, as follows:
[0096] Y final =w4Y+w5Y′ (23)
[0097]
[0098] e=e4+e5 (25)
[0099] Wherein, e4 and e5 represent the prediction errors of Y and Y′ respectively.
[0100] Beneficial effects:
[0101] First, the method improves the precision and accuracy of the soft sensor model by integrating the prediction results of multiple models. Compared with a single model, the advantage of the present invention is that the multi-model integration method can better cope with various variables and characteristics in complex industrial processes. A single model is often difficult to fully capture the complexity and is easily affected by interference and noise. Multi-model integration can improve the robustness and adaptability of the model by combining the prediction results of multiple models, thereby better adapting to complex industrial processes.
[0102] Secondly, by introducing the chameleon algorithm to optimize the model hyperparameters, the model structure and parameters can be better adjusted to improve the performance and adaptability of the model. The chameleon algorithm can adaptively adjust the model hyperparameters according to the complexity of the problem and the characteristics of the data, thereby improving the generalization and robustness of the model.
[0103] In addition, by adding chaos and reverse learning to improve initialization, the diversity of the algorithm population can be improved. This can increase the algorithm search space, improve the model's exploration ability and global search ability, and help find a better model solution.
[0104] Finally, considering the prediction error of the model, the traditional weight allocation method often allocates weights based on the performance indicators or empirical rules of the model, ignoring the prediction error of the model. The introduction of error weights can allocate weights according to the size of the model's prediction error, and allocate greater weights to models with smaller prediction errors, thereby improving the accuracy and stability of the overall model. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] Figure 1 It is a flow chart of the soft-sensing modeling method for key indicators of industrial processes provided by the present invention;
[0106] Figure 2 It is a flow chart of the algorithm for optimizing model parameters in the soft-sensing modeling method for key indicators of industrial processes provided by the present invention;
[0107] Figure 3 It is a structural diagram of the GRU neural network in the present invention;
[0108] Figure 4 It is the structure diagram of the LightGBM algorithm in the present invention;
[0109] Figure 5 It is a schematic diagram of the KNN algorithm in the present invention;
[0110] Figure 6 It is a diagram of the total nitrogen soft measurement results of the present invention. DETAILED DESCRIPTION
[0111] The embodiments of the present invention will be further described below in conjunction with the accompanying drawings.
[0112] like Figure 1 As shown, the present invention provides a soft sensor modeling method for key indicators of industrial processes, comprising the following steps:
[0113] S1. Connect the network or computer through the data acquisition instrument to realize real-time data acquisition and processing. As the basis for establishing the soft measurement model, the effluent quality data of a sewage treatment plant in Shandong is used as the specific implementation data.
[0114] S2. Use the t-distributed random neighbor embedding (t-SNE) method to extract features from the collected variables to reduce the input dimension of the original data and thus reduce the computational complexity, and finally obtain the final input variables of the soft sensor model. The steps are as follows:
[0115] S2.1 Calculate similarity: For a given high-dimensional data set, we first need to calculate the similarity between data points. Generally, the similarity between data points can be calculated using the Gaussian kernel function. The calculation formula is as follows:
[0116]
[0117] Among them, x i and x j is a high-dimensional space data sample; ||x i -x j || represents the Euclidean distance between data point i and data point j; δ i Is x i is the Gaussian variance of the center point.
[0118] S2.2 Define conditional probability: Using similarity information, define the conditional probability distribution between each pair of data points, indicating that at a given data point x i In the case of data point x j The probability of becoming its neighboring point. The calculation formula is as follows:
[0119]
[0120] Among them, p j|i represents the spatial probability distribution, and x j May become x i The probability of the neighboring points; x i is a high-dimensional data sample.
[0121] S2.3 Define t distribution: By symmetrizing and normalizing the conditional probability, we get the conditional probability of t distribution. The formula is as follows:
[0122]
[0123] Among them, y i is a low-dimensional data point.
[0124] S2.4 Define KL divergence: Calculate the KL divergence between data points in high-dimensional space and low-dimensional space, with the goal of making the conditional probability distribution in high-dimensional space and low-dimensional space as close as possible. The calculation formula is as follows:
[0125]
[0126] Among them, P i and Qi Represent the conditional probability distribution in high-dimensional space and low-dimensional space respectively.
[0127] S2.5 Gradient descent: Through optimization methods such as gradient descent, the KL divergence is minimized to determine the position of each data point in the low-dimensional space. The calculation formula is as follows:
[0128]
[0129] Continuously update the position of each data point in the low-dimensional space, the iterative formula is:
[0130]
[0131] Where μ is the learning rate and η(t) is the coefficient for the tth iteration.
[0132] S3. Establish a base model based on error correction. Input the processed data in S2 into the recurrent neural network (GRU), lightweight gradient boosting (LightGBM), K-nearest neighbor algorithm (KNN) for training, and use extreme gradient boosting (XGBoost) for error correction;.
[0133] S3.1 Establish the GRU soft measurement model.
[0134] S3.1.1 uses the processed variables in S2 as the input x of the GRU model.
[0135] S3.1.2 Initialize the hidden state: First, initialize the hidden state h0 to a zero vector or a random vector.
[0136] S3.1.3 Forward propagation: For each time t in the input sequence, do the following:
[0137] (1) Update gate: Calculate the update gate vector z t , the degree of information inflow after control is as follows:
[0138] z t =σ(W z ·[h t-1 ,x t ]) (32)
[0139] (2) Reset gate: Calculate the reset gate vector r t , controls the degree to which previous information is forgotten, the formula is as follows:
[0140] r t =σ(W z ·[h t-1 ,x t ]) (33)
[0141] (3) Candidate hidden state: Calculate the candidate hidden state vector Used to update the hidden state, the formula is as follows:
[0142]
[0143] (4) Update the hidden state: Update the gate vector z t and the candidate hidden state vector Calculate the hidden state vector h at the current moment t , the formula is as follows:
[0144]
[0145] In the above formula, x t Represents the input vector at the current moment; W z , W r , W h They represent the weight parameters of the update gate, reset gate, and candidate hidden state respectively; σ represents the sigmoid function; tanh represents the hyperbolic tangent function; represents element-wise multiplication.
[0146] S3.1.4 Output prediction: Based on the final hidden state h t , using the fully connected layer or other output layer for the final output prediction.
[0147] S3.2 Establish the LightGBM soft measurement model.
[0148] S3.2.1 Initialize model parameters: First, you need to set the hyperparameters of the LightGBM model, such as learning rate, number of trees, maximum depth of trees, etc.
[0149] S3.2.2 Building a decision tree: LightGBM gradually builds a decision tree in an iterative manner to gradually optimize the prediction results. Each iteration builds a new decision tree and adds it to the model.
[0150] S3.2.3 Calculate the score of the sample: For the sample that needs to be predicted, LightGBM will calculate the corresponding score based on the currently built decision tree. The score usually indicates the probability or predicted value of the sample belonging to the positive class.
[0151] S3.2.4 Merge the scores of multiple decision trees: If there are multiple decision trees, LightGBM will perform weighted sum or average of their scores to get the final prediction result.
[0152] S3.3 Establish KNN soft measurement model.
[0153] S3.3.1 Select K value: First, you need to select a suitable K value, that is, how many nearest neighbors to choose for prediction. The choice of K value may have a significant impact on the results and needs to be tuned through methods such as cross-validation.
[0154] S3.3.2 Calculate the distance: For the sample to be predicted, calculate its distance from all samples in the training set. The calculation formula is as follows:
[0155]
[0156] Among them, x i Indicates the position of point A, y i Indicates the location of point B.
[0157] S3.3.3 Determine the nearest neighbor: Based on the calculated distance, select the K training samples closest to the sample to be predicted as the nearest neighbors.
[0158] S3.3.4 makes predictions: adopts the average value principle, that is, selects the average value of the target values of the K nearest neighbors as the prediction result.
[0159] S4. Perform error correction on the result obtained in S3, where the error correction model is XGBoost, and the steps are as follows:
[0160] S4.1 Train the initial model: First, train an initial XGBoost model using the original data.
[0161] S4.2 Calculate residuals: Use GRU, LightGBM and KNN models to predict the training data and get the prediction results. Then, calculate the residual of each sample, that is, the difference between the true value and the predicted value.
[0162] S4.3 Build a new model: Continue training a new XGBoost model with the residual as the target variable. The goal of this new model is to reduce the error by fitting the residual.
[0163] S4.4 obtains the prediction results: the prediction results of the GRU, LightGBM and KNN models are added to the prediction results of the XGBoost model to obtain the updated prediction results.
[0164] S5. The improved Chameleon Algorithm (TOCSA) is used to optimize the parameters of XGBoost. The improved algorithm steps are as follows:
[0165] S5.1 Set the algorithm population size N, upper and lower bounds lb, ub, dimension Dim and maximum number of iterations T;
[0166] S5.2 uses the chaos reverse strategy to replace the random initialization of the original algorithm. The formula is as follows:
[0167]
[0168] in, and Indicates lower and upper bounds; Represents the population generated by the Tent mapping; Represents the population generated by reverse learning. is the chaotic sequence generated by Tent mapping, and the formula is as follows:
[0169]
[0170] Among them, r∈(0,1).
[0171] S5.3 merges the two populations, calculates the fitness value of each individual, and selects the first N as the final population;
[0172] S5.4 Search for prey. For each individual, update its position based on the information of its neighbor individuals. The formula is as follows:
[0173]
[0174] in, is the position of the i-th chameleon in the t-th iteration of the j-dimensional space; p1, p2 are control coefficients; r1, r2 are random numbers in [0,1]; Best represents the best position of the i-th chameleon in the j-dimensional space; j is the global optimal position of the chameleon; pro is the perception probability of the chameleon; sgn(rand-0.5) represents the rotation direction of the chameleon; η is the parameter that controls the search ability, and the expression is as follows:
[0175]
[0176] Among them, α is a sensitive parameter.
[0177] S5.5 detects prey, and its mathematical model is described as follows:
[0178]
[0179] in, represents the center position of the i-th chameleon at the j-th iteration; B is the rotation matrix, expressed as follows:
[0180]
[0181] in, Represents the vector after the two vectors z1 and z2 are orthogonal to each other; r∈(0,1).
[0182] S5.6 captures prey, and its mathematical model is described as follows:
[0183]
[0184] in, represents the speed of the tth iteration; represents the speed of the previous iteration; a represents the acceleration, and the formula is as follows:
[0185] a=2590×(1-e -log(t) ) (44)
[0186] S6 uses the improved Chameleon algorithm to optimize the learning rate, number of trees, and maximum tree depth of the XGBoost model. The optimized model is then used for error correction. The steps are as follows:
[0187] S6.1 sets the population size, maximum number of iterations and other parameters of the TOCSA algorithm, and sets the value range of the XGBoost parameters to be optimized.
[0188] S6.2 sets the objective function and takes the root mean square error between the true value and the predicted value as the objective function in the algorithm iteration process.
[0189] S6.3 calculates the fitness value and records the optimal position of each generation.
[0190] S6.4 updates the optimal position and updates the algorithm and other parameters at the same time.
[0191] S6.5 determines whether the maximum number of iterations has been reached. If so, the optimal model parameters are output; if not, the iteration cycle continues.
[0192] S6.6 assigns the obtained optimal parameters to the XGBoost error correction model.
[0193] S6.7 trains the XGBoost model as an error correction model, and uses the base model prediction results as input to obtain the error correction results of the first-layer base model.
[0194] S7. Establish the second layer model, the steps are as follows:
[0195] S7.1 represents the final prediction results of the three models in S4 as y1, y2 and y3 respectively, then the error-based fusion strategy can be expressed as:
[0196] Y=w1y1+w2y2+w3y3 (45)
[0197] Among them, w1, w2 and w3 represent the error weight coefficients, and their calculation formula is as follows:
[0198]
[0199] e all =e1+e2+e3 (47)
[0200] Among them, e1, e2 and e3 represent the prediction errors of GRU, LightGBM and KNN after using XGBoost error correction.
[0201] S7.2 sends the fused result Y to the least squares support vector machine (LSSVM) model for prediction, and obtains the calculation result based on the error weight, which is recorded as Y′.
[0202] S8. Establish the third layer model, and assign the error weights to the prediction result Y based on error fusion and the calculation result Y′ based on error weights described in S7 to obtain the final soft measurement prediction result. The formula is as follows:
[0203] Y final =w4Y+w5Y′ (48)
[0204]
[0205] e=e4+e5 (50)
[0206] Wherein, e4 and e5 represent the prediction errors of Y and Y′ respectively.
[0207] S9. In order to evaluate the accuracy of the soft sensor model (TOCSA-Ensemble) proposed in the present invention, the root mean square error (RMSE), the coefficient of determination (R), the mean relative error (MAE) and the mean absolute percentage error (MAPE) are selected as evaluation indicators, and the calculation formula is as follows:
[0208]
[0209]
[0210]
[0211]
[0212] Among them, actual(x i ) is the true value of the i-th sample, forecast(x i ) is the predicted value of the i-th sample, and Represent the average of the true value and the predicted value respectively, and n represents the number of all samples.
[0213] S10. The soft measurement model trained by the above process is used to soft measure the total nitrogen content in the industrial wastewater treatment process. The values of various indicators (including RMSE, MAE, R, MAPE) are shown in Table 1. The prediction results of soft measurement are shown in Table 1. Figure 6 shown.
[0214] Table 1 Statistical table of various indicators of the model of the present invention and the single model
[0215]
[0216] It can be seen from Table 1 that the RMSE of the multi-model ensemble (TOCSA-Ensemble) proposed in the present invention is at least 22.66% lower than that of a single model. Similarly, the MAE and MAPE index values are also significantly optimized, and the R value is the highest, indicating that the model has the best fit. This shows that the model proposed in the present invention has a good soft measurement effect in the process of chemical wastewater treatment and has certain practical application value.
[0217] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A soft sensor modeling method for key indicators of industrial processes, characterized in that: The following steps are involved: S1. Collect key indicator data that need to be measured in the industrial process as the basis for establishing a soft sensor model; S2. Use the t-distributed random neighbor embedding (t-SNE) method to extract features from the collected variables to reduce the input dimension of the original data and finally obtain the final input variables of the soft sensor model; S3. Construct a multi-layer soft sensor integrated model. The first layer establishes a base model based on error correction. The processed data in S2 are input into the recurrent neural network (GRU), lightweight gradient boosting (LightGBM), and K-nearest neighbor algorithm (KNN) for training, and extreme gradient boosting (XGBoost) is used for error correction. The steps for XGBoost model error correction are as follows: S7.1 Train the initial model: First, train an initial XGBoost model using the original data; S7.2 Calculate residuals: Use GRU, LightGBM and KNN models to predict the training data respectively to obtain the prediction results. Then, calculate the residual of each sample, that is, the difference between the true value and the predicted value. S7.3 Build a new model: Use the residual as the target variable and continue to train a new XGBoost model. The goal of this new model is to reduce the error by fitting the residual. S7.4 obtains the prediction results: the prediction results of the GRU, LightGBM and KNN models are added to the prediction results of the XGBoost model to obtain the updated prediction results; S4. The improved chameleon algorithm (TOCSA) is used to optimize the XGBoost model parameters, wherein the improved chameleon algorithm is an improved chameleon algorithm using chaos reverse initialization, and the optimized XGBoost model is used to correct the base model results; The steps of the improved chameleon algorithm are as follows: S8.1 Set the algorithm population size N, upper and lower bounds lb, ub, dimension Dim and maximum number of iterations T; S8.2 uses a chaotic reverse strategy to replace the random initialization of the original algorithm. The formula is as follows: in, and Indicates lower and upper bounds; Represents the population generated by the Tent mapping; represents the population generated by reverse learning, is the chaotic sequence generated by Tent mapping, and the formula is as follows: Among them, r∈(0,1); S8.3 merges the two populations, calculates the fitness value of each individual, and selects the first N as the final population; S8.4 Search for prey. For each individual, update its position based on the information of its neighbor individuals. The formula is as follows: in, is the position of the ith chameleon in the tth iteration of the jth dimension; p1, p2 are control coefficients; r1, r2 are random numbers in [0,1]; Best represents the best position of the i-th chameleon in the j-dimensional space; j is the global optimal position of the chameleon; pro is the perception probability of the chameleon; sgn(rand-0.5) represents the rotation direction of the chameleon; η is the parameter that controls the search ability, and the expression is as follows: Among them, α is a sensitive parameter; S8.5 detects prey, and its mathematical model is described as follows: in, represents the center position of the i-th chameleon at the j-th iteration; B is the rotation matrix, expressed as follows: in, Represents the vector after the two vectors z1 and z2 are orthogonal to each other; r∈(0,1); S8.6 captures prey, and its mathematical model is described as follows: in, represents the speed of the tth iteration; represents the speed of the previous iteration; a represents the acceleration, and the formula is as follows: a=2590×(1-e -log(t) ) (19) S5. The second layer establishes a fusion model based on error weighting. According to the error of the soft measurement prediction result of the base model in S3, different weights are assigned to each model of GRU, LightGBM, and KNN. The soft measurement prediction results of each model in the first layer are weighted and fused to obtain the calculation result based on error weighting. The least squares support vector machine (LSSVM) model is used to further predict this fusion result, and two sets of prediction results are obtained: the calculation result based on error weighting and the prediction result based on the error fusion of the LSSVM model. The second layer establishes a fusion model based on error weighting, and its steps are as follows: S9.1 represents the final prediction results of the three models in S3 as y1, y2 and y3 respectively, then the error-based fusion strategy can be expressed as: Y=w1y1+w2y2+w3y3 (20) Among them, w1, w2 and w3 represent the error weight coefficients, and their calculation formula is as follows: <h2 style=";text-align:left;direction:ltr">e<h2 style=";text-align:left;direction:ltr"> all <h2 style=";text-align:left;direction:ltr"> = e1+e2+e3 (22) Among them, e1, e2 and e3 represent the prediction errors of GRU, LightGBM and KNN after using XGBoost error correction respectively; S9.2 sends the fused result Y into the LSSVM model for prediction, and obtains the calculation result based on the error weight, which is recorded as Y′; S6. The third layer establishes a quadratic error weighted integrated model, and the two sets of results obtained in S5 are weighted based on the errors again to obtain the final soft measurement prediction results; The third layer establishes a quadratic error weighted integrated model, which is to assign weights to the prediction results Y based on error fusion and the calculation results Y′ based on error weights to obtain the final soft sensor prediction results. The formula is as follows: Y final =w4Y+w5Y′ (23) e=e4+e5 (25) Among them, e4 and e5 represent the prediction errors of Y and Y′ respectively; S7. Use established models to predict variables that are difficult to measure in industry.
2. The method for soft-sensing modeling of key indicators of industrial processes according to claim 1, characterized in that: The key indicator data to be measured in step S1 is connected to a network or a computer through a data acquisition instrument to achieve real-time data acquisition and processing.
3. The method for soft-sensing modeling of key indicators of industrial processes according to claim 1, characterized in that: In step S2, t-SNE is used to extract features from the collected variables. The specific steps are as follows: S3.1 Calculate similarity: For a given high-dimensional data set, calculate the similarity between data points. The Gaussian kernel function is used to calculate the similarity between data points. The calculation formula is as follows: Among them, x i and x j is a high-dimensional space data sample; ||x i -x j || represents the Euclidean distance between data point i and data point j; δ i Is x i is the Gaussian variance of the center point; S3.2 Define conditional probability: Using similarity information, define the conditional probability distribution between each pair of data points, indicating that at a given data point x i In the case of data point x j The probability of becoming its neighboring point; the calculation formula is as follows: Among them, p j|i represents the spatial probability distribution, and x j May become x i The probability of the neighboring points; x i is a high-dimensional data sample; S3.3 Definition of t distribution: The conditional probability of t distribution is obtained by symmetrizing and normalizing the conditional probability; the formula is as follows: Among them, y i is a low-dimensional data point; S3.4 Define KL divergence: Calculate the KL divergence between data points in high-dimensional space and low-dimensional space. The goal is to make the conditional probability distribution in high-dimensional space and low-dimensional space as close as possible; the calculation formula is as follows: Among them, P i and Q i Represent the conditional probability distribution in high-dimensional space and low-dimensional space respectively; S3.5 Gradient Descent: Through the gradient descent optimization method, minimize the KL divergence and determine the position of each data point in the low-dimensional space. The calculation formula is as follows: Continuously update the position of each data point in the low-dimensional space, the iterative formula is: Where μ is the learning rate and η(t) is the coefficient for the tth iteration.
4. The method for soft-sensing modeling of key indicators of industrial processes according to claim 1, characterized in that: The training and soft measurement prediction steps of the GRU model in step S3 are as follows: S4.1 uses the processed variables in S2 as the input x of the GRU model; S4.2 Initialize the hidden state: First, initialize the hidden state h0 to a zero vector or a random vector; S4.3 Forward propagation: For each time t in the input sequence, do the following: S4.3.1 Update Gate: Calculate the update gate vector z t , the degree of information inflow after control is as follows: z t =σ(W z ·[h t-1 ,x t ]) (7) S4.3.2 Reset gate: Calculate the reset gate vector r t , controls the degree to which previous information is forgotten, the formula is as follows: r t =σ(W z ·[h t-1 ,x t ]) (8) S4.3.3 Candidate hidden states: Calculating candidate hidden state vectors Used to update the hidden state, the formula is as follows: S4.3.4 Update the hidden state: Update the gate vector z according to t and the candidate hidden state vector Calculate the hidden state vector h at the current moment t , the formula is as follows: Among them, x t Represents the input vector at the current moment; W z , W r , W h Respectively represent the weight parameters of the update gate, reset gate and candidate hidden state; σ represents the sigmoid function; tanh represents the hyperbolic tangent function; · represents element-wise multiplication; S4.4 Output prediction: Based on the final hidden state h t , using the fully connected layer or other output layer for the final output prediction.
5. The method for soft-sensing modeling of key indicators of industrial processes according to claim 1, characterized in that: The training and soft measurement prediction steps of the LightGBM model in step S3 are as follows: S5.1 Initialize model parameters: First, you need to set the hyperparameters of the LightGBM model; S5.2 Building a decision tree: LightGBM gradually builds a decision tree in an iterative manner to gradually optimize the prediction results. Each iteration builds a new decision tree and adds it to the model. S5.3 Calculate the score of the sample: For the sample that needs to be predicted, LightGBM calculates the corresponding score based on the currently constructed decision tree. The score represents the probability or predicted value of the sample belonging to the positive class; S5.4 Merge the scores of multiple decision trees: If there are multiple decision trees, LightGBM performs weighted sum or average of their scores to obtain the final prediction result.
6. The method for soft-sensing modeling of key indicators of industrial processes according to claim 1, characterized in that: The training and soft measurement prediction steps of the KNN model in step S3 are as follows: S6.1 Select K value: First, you need to select a suitable K value, that is, how many nearest neighbors to choose for prediction. The selection of K value may have a great impact on the results and needs to be tuned through cross-validation method; S6.2 Calculate the distance: For the sample to be predicted, calculate its distance from all samples in the training set. The calculation formula is as follows: Among them, x i Indicates the position of point A, y i Indicates the position of point B; S6.3 Determine the nearest neighbor: Based on the calculated distance, select the K training samples closest to the sample to be predicted as the nearest neighbors; S6.4 makes predictions: adopts the average value principle, that is, selects the average value of the target values of the K nearest neighbors as the prediction result.
