Method for real-time prediction of water quality of circulating cooling water based on tree ensemble learning model

CN122986369APending Publication Date: 2026-10-27CHANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611188080.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

但这些方法往往存在明显局限:对传感器数据间复杂的非线性耦合关系刻画能力不足,导致预测精度有限;模型多为黑箱结构,决策过程缺乏透明度,难以与工艺机理结合,不易获得现场运维人员的信任;多数模型仅停留在预测阶段,未能与现场控制系统深度集成形成闭环,无法实现自动化智能调控;此外,模型超参数多依赖经验设置,缺乏自适应优化机制,难以持续保持最佳性能

Benefits of technology

1、利用响应速度在秒级的基础物化传感器数据,通过MIC和VIF进行特征筛选,构建了核心特征集,并基于此建立了轻量化树集成学习模型,实现了对COD水质的分钟级实时预测;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122986369A_ABST
    Figure CN122986369A_ABST
Patent Text Reader

Abstract

The application provides a circulating cooling water quality real-time prediction method based on a tree ensemble learning model, which comprises the following steps: deploying a multi-source sensor to collect historical monitoring data, preprocessing and feature screening to construct a data set; constructing a parallel ensemble model of random forest and extreme gradient boosting, and performing global hyperparameter optimization by using a Harris eagle optimization algorithm; after training the optimized model by using a training set, extracting core input features by using an explainability analysis, reconstructing a simplified prediction model according to the core input features, and performing retraining and hyperparameter optimization; adopting kernel density estimation to fit a prediction error distribution, and calculating a probability interval of a specified confidence level for a prediction value; inputting real-time screened features into the optimized simplified model, outputting a water quality index prediction value and a prediction interval, and generating a field control decision in combination with a process threshold. By the method, high-precision prediction of water quality indexes such as COD, reliability evaluation of prediction results, model explainability and continuous evolution are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial water treatment and intelligent monitoring technology, and in particular to a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model. Background Technology

[0002] As a core auxiliary system in industrial production, the stability of circulating cooling water systems directly impacts production safety, heat exchange efficiency, equipment lifespan, and operating cost control. Currently, these systems primarily rely on online water quality analyzers to monitor key indicators such as COD, total phosphorus, and total iron to promptly detect material leaks or water quality anomalies. However, most mainstream online analyzers are designed based on national standard chemical methods, such as photometry or titration. Their analytical processes involve chemical reactions and colorimetric measurements, and a single test typically takes several minutes to tens of minutes, making it difficult to achieve high-frequency real-time monitoring at the second or minute level. This monitoring delay prevents the system from capturing instantaneous changes in water quality, thus creating environmental risks and potential production safety hazards.

[0003] Meanwhile, circulating cooling water systems typically deploy numerous sensors for basic physicochemical parameters such as pH, conductivity, temperature, and turbidity. These sensors respond rapidly and provide continuous data, reflecting the indirect state of the water body in real time. However, they cannot directly measure water quality indicators. Therefore, how to utilize these high-frequency and readily available indirect parameters to calculate water quality indicators that are difficult to monitor quickly and directly through data modeling has become a key technical challenge for achieving early warning and precise control.

[0004] In existing technologies, some studies have attempted to use statistical methods or simple machine learning models such as linear regression and support vector machines to establish predictive relationships between water quality indicators. However, these methods often have significant limitations: they are insufficient in characterizing the complex nonlinear coupling relationships between sensor data, resulting in limited prediction accuracy; the models are mostly black-box structures, lacking transparency in the decision-making process, making it difficult to integrate with process mechanisms and gain the trust of on-site operation and maintenance personnel; most models only remain at the prediction stage, failing to deeply integrate with the on-site control system to form a closed loop, and thus unable to achieve automated intelligent control; furthermore, the model hyperparameters mostly rely on empirical settings, lacking adaptive optimization mechanisms, making it difficult to maintain optimal performance continuously.

[0005] Therefore, there is an urgent need to develop a real-time intelligent water quality prediction and control method that can integrate multi-source high-frequency data, has high-precision prediction capabilities, an interpretable model, and can achieve closed-loop integration with the control system, in order to make up for the shortcomings of existing technologies and improve the operational safety and management efficiency of circulating water systems. Summary of the Invention

[0006] To address the above issues, this invention constructs a real-time prediction and control system based on multi-source sensor data by integrating MIC and VIF feature screening, HHO algorithm-optimized RF and XGBoost lightweight integrated learning models, KDE uncertainty quantification, SHAP interpretability analysis, and an online retraining mechanism. This system achieves high-precision prediction of water quality indicators such as COD, reliability assessment of prediction results, interpretability of the model, and continuous evolution. Ultimately, through prediction-control closed-loop integration, it significantly improves the autonomy, responsiveness, and long-term operational stability of water quality management.

[0007] According to an embodiment of the present invention, a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model is provided.

[0008] In a first aspect of the invention, a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model is provided. The method includes: Step S01: Deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and select effective features to construct a dataset; Step S02: Construct a tree ensemble learning model for real-time water quality prediction, including a parallel ensemble random forest model and a limit gradient boosting model, and use the Harris Eagle optimization algorithm for global hyperparameter optimization. Step S03: Train the hyperparameter-optimized tree ensemble learning model using the training set, and then perform interpretability analysis on the trained tree ensemble model and select the core input features based on the actual monitoring frequency. Step S04: Reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, use kernel density estimation to fit the prediction error distribution and calculate the prediction interval with a specified confidence level for the predicted water quality index. Step S05: Input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

[0009] Furthermore, the multi-source sensor mentioned in step S01 includes at least a temperature sensor, a pH sensor, and a conductivity sensor, used to collect indirect characteristic parameters of water quality in real time.

[0010] Furthermore, the preprocessing described in step S01 includes: performing missing value imputation and outlier analysis on historical monitoring data; and standardizing the data using the Z-scorce method. The maximum information coefficient is used to measure the correlation between any two water quality characteristics. The maximum information coefficient can capture generalized correlations, including nonlinear relationships. Calculate the variance inflation factor to diagnose multicollinearity among features, and remove strongly collinear features with a variance inflation factor greater than a preset threshold; The core sensor feature data that has been screened are standardized and divided into training set, validation set and test set in chronological order.

[0011] Furthermore, the random forest model described in step S02 performs sampling with replacement on the training set containing historical monitoring records, randomly generates multiple sub-training sets, and trains a regression decision tree independently for each subset. When constructing each decision tree, a feature subset is randomly selected as a candidate variable at each node, and the optimal split point is found on that subset according to the minimum mean square error criterion. Specifically, the objective function for node splitting is: , In the formula, , The sample set for the left and right child nodes. , These represent the average measured values ​​of water quality indicators corresponding to the left and right child node sample sets, respectively.

[0012] Furthermore, the specific steps of the limiting gradient boosting model described in step S02 are as follows: In the In the next iteration, the calculation before The residuals between the COD predictions and actual COD values ​​of the training samples from each decision tree are used to construct the 1st decision tree. A decision tree; The first Prediction results of decision trees With the preceding Cumulative prediction results of decision trees Add them together to get the current total predicted value. ; The optimization objective function of the model includes a parameter related to the first... The number of leaf nodes and the regularization term associated with the leaf node weight vectors of the decision tree. ,in and The preset regularization coefficient; When optimizing the objective function, a loss function is used. For the aforementioned The first and second derivative information of the cumulative prediction results of each decision tree.

[0013] Furthermore, the process of the Harris Eagle optimization algorithm described in step S03 is as follows: The fitness function is used to evaluate the performance of each individual, with the error between the actual value and the fitted value in the dataset as the fitness function. Dynamically adjust the behavior of the eagle flock based on the escape energy formula: , In the formula, The initial escape energy, This is the current iteration number. This represents the maximum number of iterations.

[0014] When escape energy At that time, a global random search is performed in the hyperparameter search space; When escape energy At that time, a local fine search is performed around the currently discovered optimal hyperparameter combination. By simulating hunting behaviors such as rapid encirclement and dive attack by eagles, dense sampling is performed near the current optimal solution to finely adjust the hyperparameter values. In each iteration, the global best position is updated and used as a benchmark to guide the next search step; The optimal combination of hyperparameters is output when the maximum number of iterations is reached or the fitness function converges within the search space.

[0015] Furthermore, the kernel density estimation function described in step S04 is: , in, The probability density function representing the COD prediction error. This represents the bandwidth that determines the interval of error data distribution. It is the first One COD prediction error sample, This indicates the number of samples with prediction errors.

[0016] In a second aspect of the invention, an apparatus for real-time prediction of circulating cooling water quality based on a tree ensemble learning model is provided. The apparatus includes: Data acquisition module: used to deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and filter out effective features to construct a dataset; Model building module: used to build tree ensemble learning models for real-time water quality prediction, including parallel ensemble random forest models and extreme gradient boosting models, and using Harris Eagle optimization algorithm for global hyperparameter optimization; Model training module: Used to train the hyperparameter-optimized tree ensemble learning model using the training set, and to select core input features by performing interpretability analysis on the trained tree ensemble model and combining it with the actual monitoring frequency. Model reconstruction module: It is used to reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, it uses kernel density estimation to fit the prediction error distribution and calculates the prediction interval with a specified confidence level for the predicted value of water quality index. Model inference module: It is used to input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

[0017] In a third aspect of the invention, an electronic device is provided. The electronic device includes a memory and a processor, the memory storing a computer program, the processor executing the program to implement the method according to a first aspect of the invention.

[0018] In a fourth aspect of the invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method according to a first aspect of the invention.

[0019] This invention constructs a real-time prediction and control system based on multi-source sensor data by integrating MIC and VIF feature screening, HHO algorithm-optimized RF and XGBoost lightweight integrated learning model, KDE uncertainty quantification, SHAP interpretability analysis, and online retraining mechanism. It achieves high-precision prediction of water quality indicators such as COD, reliability assessment of prediction results, interpretability and continuous evolution of the model, and finally significantly improves the autonomy, responsiveness and long-term operational stability of water quality management through prediction-control closed-loop integration.

[0020] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of the present invention, nor is it intended to restrict the scope of the invention. Other features of the invention will become readily apparent from the following description.

[0021] The beneficial effects of this invention are: 1. Using basic physical sensor data with a response speed of seconds, feature selection was performed through MIC and VIF to construct a core feature set, and a lightweight tree ensemble learning model was established based on this to achieve real-time prediction of COD water quality at the minute level. 2. An ensemble learning model of RF and XGBoost optimized by the HHO algorithm was adopted to achieve high-precision point prediction of COD index; at the same time, KDE was introduced to calculate the prediction interval, quantify the prediction uncertainty, and ensure the high accuracy and high reliability of the prediction results. 3. By deeply integrating the real-time prediction module with the field control loop, and actively generating and executing control strategies based on real-time predicted values ​​and their confidence intervals, combined with process thresholds, a complete intelligent closed loop of monitoring-prediction-control is constructed, which greatly improves the system's autonomy and response speed and reduces reliance on manual intervention. 4. By applying model interpretation techniques such as SHAP and Weight importance, the contribution of features is quantified, and a model retraining and optimization mechanism based on new data is designed, so that the model has both good interpretability and continuous evolution capability, ensuring the long-term stability of prediction performance. Attached Figure Description

[0022] The above and other features, advantages, and aspects of the various embodiments of the present invention will become more apparent from the accompanying drawings and the following detailed description. Wherein: Figure 1 A schematic diagram of a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to an embodiment of the present invention is shown. Figure 2 A preprocessing flowchart according to an embodiment of the present invention is shown; Figure 3 A method flowchart according to an embodiment of the present invention is shown; Figure 4 A schematic diagram of the HHO optimization process according to an embodiment of the present invention is shown; Figure 5 A diagram illustrating the prediction performance of a decision tree-based water quality model according to an embodiment of the present invention is shown (taking COD as an example). Figure 6 A schematic diagram of interval prediction results at different confidence levels according to an embodiment of the present invention is shown; Figure 7 A block diagram of a device for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to an embodiment of the present invention is shown. Figure 8 A schematic diagram of a device for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to an embodiment of the present invention is shown. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] According to an embodiment of the present invention, a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model is proposed. By integrating MIC and VIF feature screening, HHO algorithm-optimized RF and XGBoost lightweight ensemble learning models, KDE uncertainty quantification, SHAP interpretability analysis, and online retraining mechanism, a real-time prediction and control system based on multi-source sensor data is constructed. This achieves high-precision prediction of water quality indicators such as COD, reliability assessment of prediction results, interpretability and continuous evolution of the model, and finally, through prediction-control closed-loop integration, significantly improves the autonomy, responsiveness and long-term operational stability of water quality management.

[0025] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments.

[0026] Figure 1 This is a schematic flowchart of a method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to an embodiment of the present invention. The method includes: Step S01: Deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and select effective features to construct a dataset; Step S02: Construct a tree ensemble learning model for real-time water quality prediction, including a parallel ensemble random forest model and a limit gradient boosting model, and use the Harris Eagle optimization algorithm for global hyperparameter optimization. Step S03: Train the hyperparameter-optimized tree ensemble learning model using the training set, and then perform interpretability analysis on the trained tree ensemble model and select the core input features based on the actual monitoring frequency. Step S04: Reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, use kernel density estimation to fit the prediction error distribution and calculate the prediction interval with a specified confidence level for the predicted water quality index. Step S05: Input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

[0027] It should be noted that although the operation of the method of the present invention has been described in a specific order in the above embodiments and figures, this does not require or imply that the operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0028] To provide a clearer explanation of the above-mentioned method for real-time prediction of circulating cooling water quality based on tree ensemble learning model, a specific embodiment is described below. However, it is worth noting that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation of the present invention.

[0029] The following example will further illustrate the method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model.

[0030] Step S01: Deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and select effective features to construct a dataset.

[0031] Multi-source sensors include at least a temperature sensor, a pH sensor, and a conductivity sensor, used to collect indirect characteristic parameters of water quality in real time.

[0032] like Figure 2 As shown, the preprocessing specifically includes: Perform missing value imputation and outlier analysis on historical monitoring data; The Z-scorce method was used for standardization, which facilitated the subsequent convergence and fitting of the water quality model. The maximum information coefficient (MIC) is used to measure the correlation between any two water quality characteristics. The maximum information coefficient can capture generalized correlations, including nonlinear relationships. The variance inflation factor (VIF) is calculated to diagnose multicollinearity among features and to remove strongly collinear features with a VIF greater than a preset threshold. The formula for calculating VIF is: , in, This is the coefficient of determination for the regression of this feature on other features; The core sensor feature data (including temperature, pH, conductivity, turbidity and their derived features) that have been screened are standardized and divided into training set, validation set and test set in chronological order.

[0033] In this embodiment, 13 water quality indicators of circulating cooling water from a large chemical enterprise were collected for a whole year (366 calendar days from January 1, 2024 to December 31, 2024), including temperature, conductivity, pH, turbidity, free chlorine, fluorescence, total alkalinity, chloride ion, concentration factor, calcium ion, iron ion, zinc ion, and COD (chemical oxygen demand). The sampling interval was 1-2 hours. All sensor signals were collected by PLC and transmitted to the edge computing server via industrial Ethernet, as shown in Table 1. Table 1

[0034] Historical data from each sensor under normal operating conditions over the past year, totaling approximately 500,000 records, were collected. First, data cleaning was performed to handle outliers and missing values ​​caused by sensor fluctuations, communication interruptions, etc. Then, the minimum acceptable value (MIC) was calculated between all sensor indicators (including some indicators' moving averages, rates of change, and other derived features) and the water quality indicators measured daily in the laboratory, retaining features with MIC values ​​greater than 0.3. Next, the variable value (VIF) of the retained features was calculated, and features with VIF greater than 10 were removed, ultimately selecting eight core input features. Finally, the data was standardized, and the preprocessed data was divided chronologically into a training set (first 70%), a validation set (middle 15%), and a test set (last 15%). Statistical analysis data of circulating cooling water monitoring indicators are shown in Table 2. Table 2

[0035] Step S02: Construct a tree ensemble learning model for real-time water quality prediction, including a parallel ensemble random forest model and a limit gradient boosting model, and use the Harris Eagle optimization algorithm for global hyperparameter optimization.

[0036] like Figure 3 The diagram shows the complete process of a tree ensemble learning model.

[0037] In the scenario of circulating cooling water quality prediction, the input of the Random Forest (RF) model is the selected core sensor features. The model first samples the training set containing historical monitoring records with replacement, randomly generating multiple sub-training sets, and training a regression decision tree independently for each subset. When constructing each decision tree, the model randomly selects a subset of features as candidate variables at each node, and finds the optimal split point on that subset according to the criterion of minimizing the mean squared error, thus growing the regression tree layer by layer.

[0038] Specifically, the objective function for node splitting is: , In the formula, , The sample sets for the left and right child nodes (e.g., the left child node could be all historical monitoring data at a certain time when pH < 8.5, and the right child node could be data with pH ≥ 8.5). , These represent the average true values ​​of water quality indicators corresponding to the sample sets of the left and right child nodes, respectively. After training, for newly input real-time sensor data, the model prediction result is the average value of the water quality indicator predicted by all regression trees. This invention uses the ensemble method of the Sklearn library in Python to initialize the RandomForestRegressor class, and uses regression decision trees as the basic learner to construct a random forest model. The number of trees is determined by subsequent HHO optimization.

[0039] The Extreme Gradient Boosting Regression Decision Tree (XGBoost) model achieves self-learning based on the Boosting concept. It continuously optimizes the objective function through a gradient boosting tree framework. In circulating cooling water quality prediction, the model input consists of selected core sensor features, and the prediction target is the water quality index value. The learning objective of each iteration is to correct the error (residual) of the previous stage, i.e., the error between the predicted water quality index value of the previous tree and the measured water quality index value. Each newly built tree learns from the error of the previous tree to gradually improve the overall water quality model's predictive ability. A regularization term is added to the loss function, and methods such as first and second derivative information are used during the optimization process to achieve better prediction results with less computational resources. The model's self-learning implementation process is as follows: XGBOOST objective function: , In the formula, A loss function used to measure the difference between predicted and actual values ​​of water quality indicators; For the front Regularization term of cumulative predictions of decision trees Submodel The complexity is used to control overfitting.

[0040] XGBoost, as a boosting additive model, uses a forward stepwise algorithm to optimize the objective function, with each iteration optimizing only the sub-model in the current step. In the... Step-by-step process: , In the formula, For the current sub-model; For the front The cumulative predictions of the decision trees.

[0041] The loss function is approximated by a second-order expansion: , in, The starting point for the expansion, i.e., the front Cumulative predicted value of trees , For the first The incremental contribution of each tree The predicted output function for the expansion points. To predict the first derivative of the output function, To predict the second derivative of the output function.

[0042] Will That is, before The loss function of the next iteration is considered as , Considered as Deltax Considered as a prediction The function, the objective function is optimized to: , Eliminate the constant term again: , in, loss function Forward Cumulative predicted value of trees The first derivative, For loss function Forward Cumulative predicted value of trees The second derivative of .

[0043] The regularization term for: , in, and This is the preset regularization coefficient.

[0044] Using the XGBRegressor class from the xgboost library, an XGBoost regression model is initialized with a gbtree as the base learner. The regression tree is constructed iteratively through gradient boosting to build the XGBoost model.

[0045] The Harris Eagle Optimization (HHO) metaheuristic algorithm is used to automatically optimize model hyperparameters (such as tree depth, learning rate, subsampling rate, etc.). By simulating the hunting behavior of eagle flocks, the HHO algorithm can effectively balance global exploration and local exploitation, avoid getting trapped in local optima, and thus automatically obtain a model configuration with better performance.

[0046] HHO optimization process as follows: Figure 4 As shown: Initialize the population and randomly generate the hyperparameter combination for each individual: Randomly generate the population position within the search space of the problem. Each individual represents a candidate solution and consists of a set of hyperparameters that need to be adjusted, such as the learning rate and the maximum depth of the tree. Calculate the fitness value: use the error between the actual value and the fitted value in the dataset as the fitness function to evaluate the quality of each individual; Update the flock's position and dynamically adjust the search strategy: Dynamically adjust the flock's behavior based on the escape energy formula. , In the formula, The initial escape energy (randomly initialized in the interval [-1,1], representing the global exploration tendency at the beginning of the algorithm). This is the current iteration number. This represents the maximum number of iterations.

[0047] In this embodiment, the core task of the HHO algorithm is to find an optimal configuration in the hyperparameter search space of the RF and XGBoost models so that the root mean square error (RMSE) of the fusion model in predicting water quality indicators on the validation set is minimized.

[0048] When escape energy When the time is 0, it indicates that the algorithm is in the exploration phase (corresponding to the flock of eagles moving away from the prey). At this time, HHO performs a global random search in the hyperparameter search space, trying different combinations of hyperparameters to discover unknown regions that may contain the optimal solution, and avoids getting trapped in local optima too early. When escape energy When the time is reached, it indicates that the algorithm has entered the development stage (corresponding to the eagle flock gradually approaching the prey). At this time, HHO performs a local fine search around the currently discovered optimal hyperparameter combination. By simulating the hunting behavior of the eagle flock, such as rapid encirclement and dive attack, it performs dense sampling near the current optimal solution and finely adjusts the hyperparameter values ​​to further improve the accuracy of water quality index prediction. In each iteration, the algorithm updates the globally optimal hyperparameter combination (that is, the configuration with the smallest RMSE on the validation set) and uses it as a benchmark to guide the position updates of subsequent individual eagles in the flock. The optimal combination of hyperparameters is output when the maximum number of iterations is reached or the fitness function converges within the search space (i.e., the RMSE no longer decreases significantly after multiple consecutive iterations).

[0049] Step S03: Train the hyperparameter-optimized tree ensemble learning model using the training set, and then perform interpretability analysis on the trained tree ensemble model and select the core input features based on the actual monitoring frequency.

[0050] Specifically, the Weight feature importance algorithm and SHAP method are used to perform interpretability analysis on the trained tree ensemble model, and core input features are selected in combination with the actual monitoring frequency.

[0051] The weight feature importance algorithm built into the tree model is used to calculate the total contribution of each water quality monitoring indicator to reducing the mean squared error (MSE) of each node when all nodes are split. The greater the contribution, the more important the feature. The contribution values ​​of all features are normalized to a sum of 1 to initially identify the dominant features with high contributions to water quality indicator prediction. This method only reflects the overall contribution of a feature and cannot reveal its positive or negative driving direction on the water quality indicator. Therefore, the SHAP method is further introduced. For each sample in the test set, the SHAP method uses the SHAP library to calculate the Shapley value of each input feature. This value indicates how much the feature pushes the water quality indicator value up or down from the baseline value (global average predicted value) in the prediction of this specific sample.

[0052] In this embodiment, combining the results of Weight and SHAP analysis with the actual monitoring frequency (excluding indicators with a detection cycle greater than 1 hour, such as free chlorine, total alkalinity, concentration factor, etc.), seven high-frequency and easily measurable indicators—conductivity, pH, turbidity, fluorescence, calcium ions, iron ions, and zinc ions—were selected as the core input features of the minute-level real-time prediction model to predict COD values. Figure 5 As shown.

[0053] Step S04: Reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, use kernel density estimation to fit the prediction error distribution and calculate the prediction interval with a specified confidence level for the predicted water quality index values.

[0054] The RF model integrates multiple decision trees in parallel and outputs predicted water quality indicators using the mean. The XGBoost model uses serial gradient boosting to fit the residuals round by round and outputs predicted water quality indicators. Kernel density estimation (KDE) is performed on the prediction errors of the two models using validation set data to construct the error probability density functions of RF and XGBoost, respectively, for subsequent calculation of prediction intervals.

[0055] The model training process aims to achieve high-precision predictions, and the specific steps are as follows: The loss function is defined as the mean squared error between the predicted value and the actual value, and its expression is: , In the formula: For the true value, For predicted values, Number of samples; The Adam optimization algorithm is used to adaptively adjust all trainable parameters in the model, and the parameters are iteratively updated along the gradient descent direction of the loss function until the loss value is lower than the preset threshold, thus completing the initial training of the model.

[0056] The model's output is not limited to a single predicted value, but combines KDE to generate a prediction interval with probabilistic significance, forming a conditional probability distribution of key water quality parameters.

[0057] KDE estimation is a nonparametric estimation method that can infer data distribution using a finite sample. This invention uses a Gaussian kernel function to fit the distribution of water quality index prediction errors generated by RF and XGBoost models on the validation set, constructing a water quality prediction interval to quantify model prediction uncertainty. The KDE function for water quality prediction error obtained using the Gaussian kernel function is as follows: , in, The probability density function representing the prediction error of water quality indicators. This represents the bandwidth that determines the interval of error data distribution. It is the first The water quality index prediction error sample (i.e., the first) (The difference between the predicted water quality index values ​​and the measured water quality index values ​​of each validation set sample). This indicates the number of prediction error samples. Through the KDE method described above, this invention extends deterministic point prediction to probabilistic interval prediction, providing more comprehensive uncertainty information for risk quantification decisions in subsequent closed-loop control.

[0058] In this embodiment, the kernel density estimation (KDE) of Gaussian kernels is used to fit the COD prediction errors of RF and XGB respectively, obtaining their error distributions, which are then used to calculate the 95% confidence intervals of future prediction values, such as... Figure 6 As shown in Table 3, the interval prediction evaluation results are presented: Table 3

[0059] Step S05: Input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

[0060] In actual prediction, the same set of input sensor data is simultaneously processed by RF and XGBoost models to obtain water quality index prediction values, and the mean of the two is used as the final prediction value. At the same time, based on the KDE error distribution established on the validation set, the prediction interval at a specified confidence level (such as 95%) is calculated as a quantitative indicator of prediction uncertainty.

[0061] Real-time data streams collected by a sensor network deployed on-site are preprocessed and input into a trained and optimized water quality prediction model. This model outputs the conditional probability distribution of key water quality parameters in real time. Based on this, the probability area of ​​the distribution exceeding a preset safety threshold is calculated, directly outputting the probability of water quality exceeding standards in the future. By setting multi-level probability thresholds (e.g., warning for >30%, automatic control for >70%), a shift from traditional threshold comparison to dynamic risk quantification decision-making is achieved. Simultaneously, this probability output can be combined with interpretability technologies such as SHAP (a method that uses game theory to explain the prediction results of machine learning models, indicating how much each feature contributes to the final prediction) to clearly trace the key sensor indicators leading to high anomaly probabilities and their contributions, making the decision-making process transparent and reliable, and achieving intelligent closed-loop control of monitoring-prediction-regulation. Furthermore, all data, prediction results, and control actions are uploaded to a cloud monitoring platform via industrial communication protocols.

[0062] In this embodiment, the trained and optimized model is deployed on an edge server. The detection frequency of the selected indicators can reach the second level, enabling water quality indicators to be predicted at the minute level. This frequency is far higher than that of existing online analyzers, meeting the requirement of issuing early warnings of water quality anomalies before environmental protection departments collect mixed samples at 15-minute intervals. This allows the enterprise's regulatory unit to respond to prevention and control measures in a timely and proactive manner. The system control logic is set as follows: if the predicted value exceeds 90% of the plant's control standard (e.g., 50 mg / L) (45 mg / L), an early warning is issued; if the predicted value exceeds the control standard, based on the predicted excess amount, a pre-set fuzzy control rule is used, which summarizes the operator's experience into rules, and the computer automatically executes the rule to calculate the percentage increase in the frequency of the phosphate corrosion inhibitor dosing pump, and issues an instruction to the PLC for execution. At the same time, all raw data, prediction results, control instructions, and execution status are uploaded to the factory cloud platform via the MQTT protocol to achieve visualized monitoring and historical analysis.

[0063] Through this implementation, the system successfully reduced the sensing-control delay for water quality detection from several hours to within minutes, achieving predictive preventative control, effectively stabilizing water quality, and reducing reagent consumption and wastewater discharge risks. The method of this invention is not only applicable to circulating cooling water, but can also be adapted for real-time prediction and intelligent control scenarios in other industrial wastewater or water treatment processes.

[0064] Based on the same inventive concept, this invention also proposes a device for real-time prediction of circulating cooling water quality based on a tree ensemble learning model. The implementation of this device can be found in the implementation of the method described above; repeated details will not be repeated. Figure 7 As shown, the device 100 includes: Data acquisition module 101: used to deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and select effective features to construct a dataset; Model building module 102: Used to build a tree ensemble learning model for real-time water quality prediction, including a parallel ensemble random forest model and an extreme gradient boosting model, and uses the Harris Eagle optimization algorithm for global hyperparameter optimization. Model training module 103: Used to train the hyperparameter-optimized tree ensemble learning model using the training set, and to select core input features by performing interpretability analysis on the trained tree ensemble model and combining it with the actual monitoring frequency. Model Reconstruction Module 104: This module is used to reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, it uses kernel density estimation to fit the prediction error distribution and calculates the prediction interval with a specified confidence level for the predicted values ​​of water quality indicators. Model inference module 105: It is used to input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

[0065] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0066] like Figure 8 As shown, the device includes a central processing unit (CPU), which can perform various appropriate actions and processes based on computer program instructions stored in read-only memory (ROM) or loaded from storage units into random access memory (RAM). The RAM can also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0067] Multiple components in the device are connected to the I / O interface, including: input units such as keyboards and mice; output units such as various types of displays and speakers; storage units such as disks and optical discs; and communication units such as network interface cards (NICs), modems, and wireless transceivers. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0068] The processing unit executes the various methods and processes described above, such as method steps S01 to S05. For example, in some embodiments, method steps S01 to S05 may be implemented as a computer software program tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of method steps S01 to S05 described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute method steps S01 to S05 by any other suitable means (e.g., by means of firmware).

[0069] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload programmable logic devices (CPLDs), and so on.

[0070] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0071] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0072] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.

[0073] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model, characterized in that, The method includes: Step S01: Deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and select effective features to construct a dataset; Step S02: Construct a tree ensemble learning model for real-time water quality prediction, including a parallel ensemble random forest model and a limit gradient boosting model, and use the Harris Eagle optimization algorithm for global hyperparameter optimization. Step S03: Train the hyperparameter-optimized tree ensemble learning model using the training set, and then perform interpretability analysis on the trained tree ensemble model and select the core input features based on the actual monitoring frequency. Step S04: Reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, kernel density estimation is used to fit the prediction error distribution and calculate the prediction interval with a specified confidence level for the predicted water quality index. Step S05: Input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

2. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The multi-source sensor mentioned in step S01 includes at least a temperature sensor, a pH sensor, and a conductivity sensor, which are used to collect indirect characteristic parameters of water quality in real time.

3. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The preprocessing described in step S01 includes: imputing missing values ​​and performing outlier analysis on historical monitoring data; and standardizing the data using the Z-scorce method. The maximum information coefficient is used to measure the correlation between any two water quality characteristics. The maximum information coefficient can capture generalized correlations, including nonlinear relationships. Calculate the variance inflation factor to diagnose multicollinearity among features, and remove strongly collinear features with a variance inflation factor greater than a preset threshold; The core sensor feature data that has been screened are standardized and divided into training set, validation set and test set in chronological order.

4. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The random forest model described in step S02 performs sampling with replacement on the training set containing historical monitoring records, randomly generates multiple sub-training sets, and trains a regression decision tree independently for each subset. When constructing each decision tree, a feature subset is randomly selected as a candidate variable at each node, and the optimal split point is found on that subset according to the minimum mean square error criterion. Specifically, the node splitting objective function is: , In the formula, , The sample set for the left and right child nodes. , These represent the average measured values ​​of water quality indicators corresponding to the left and right child node sample sets, respectively.

5. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The specific steps of the limiting gradient boosting model described in step S02 are as follows: In the In the next iteration, the calculation before The residuals between the COD predictions and actual COD values ​​of the training samples from each decision tree are used to construct the 1st decision tree. A decision tree; The first Prediction results of decision trees With the preceding Cumulative prediction results of decision trees Add them together to get the current total predicted value. ; The optimization objective function of the model includes a parameter related to the first... The number of leaf nodes and the regularization term associated with the leaf node weight vectors of the decision tree. ,in and The preset regularization coefficient; When optimizing the objective function, a loss function is used. For the aforementioned The first and second derivative information of the cumulative prediction results of each decision tree.

6. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The process of the Harris Eagle optimization algorithm described in step S03 is as follows: The fitness function is used to evaluate the performance of each individual, with the error between the actual value and the fitted value in the dataset as the fitness function. Dynamically adjust the behavior of the eagle flock based on the escape energy formula: , In the formula, The initial escape energy, This is the current iteration number. This represents the maximum number of iterations. When escape energy At that time, a global random search is performed in the hyperparameter search space; When escape energy At that time, a local fine search is performed around the currently discovered optimal hyperparameter combination. By simulating hunting behaviors such as rapid encirclement and dive attack by eagles, dense sampling is performed near the current optimal solution to finely adjust the hyperparameter values. In each iteration, the global best position is updated and used as a benchmark to guide the next search step; The optimal combination of hyperparameters is output when the maximum number of iterations is reached or the fitness function converges within the search space.

7. The method for real-time prediction of circulating cooling water quality based on a tree ensemble learning model according to claim 1, characterized in that, The kernel density estimation function mentioned in step S04 is: , in, The probability density function representing the COD prediction error. This represents the bandwidth that determines the interval of error data distribution. It is the first One COD prediction error sample, This indicates the number of samples with prediction errors.

8. A device for real-time prediction of circulating cooling water quality based on a tree ensemble learning model, characterized in that, The device implements the method as described in any one of claims 1 to 7, comprising: Data acquisition module: used to deploy multi-source sensors at key process nodes of the circulating cooling water system, acquire historical monitoring data of the multi-source sensors under normal operating conditions, preprocess the data, and filter out effective features to construct a dataset; Model building module: used to build tree ensemble learning models for real-time water quality prediction, including parallel ensemble random forest models and extreme gradient boosting models, and using Harris Eagle optimization algorithm for global hyperparameter optimization; Model training module: Used to train the hyperparameter-optimized tree ensemble learning model using the training set, and to select core input features by performing interpretability analysis on the trained tree ensemble model and combining it with the actual monitoring frequency. Model reconstruction module: It is used to reconstruct a simplified prediction model based on core features and perform retraining and hyperparameter optimization to obtain an optimized simplified prediction model. At the same time, it uses kernel density estimation to fit the prediction error distribution and calculates the prediction interval with a specified confidence level for the predicted value of water quality index. Model inference module: It is used to input the effective features selected in real time into the optimized simplified prediction model, output the current water quality index prediction value and its corresponding probability prediction interval in real time, and generate the control decision of the field actuator by combining the preset process threshold.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.