Method for accurately predicting double coagulants in waterworks based on automatic machine learning

By applying automatic machine learning technology in water plants, a double coagulant dosage prediction model is constructed, which solves the problem of subjectivity and inefficiency of traditional dosage methods, and achieves precise control of dosage and stable management of water quality.

CN119626387AActive Publication Date: 2025-03-14TIANJIN UNIV

Patent Information

Application Number
CN202411720961.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-14
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

Traditional artificial control dosing methods have strong subjectivity in the application of double coagulants, waste of agents and lag in water quality supervision and monitoring, and it is difficult to adapt to the demand for stable water quality control in large-scale production.

Method used

Using an automatic machine learning method, by collecting water quality indicators and dosage data, performing missing value pretreatment and correlation analysis, a double coagulant dosage prediction model was constructed, and a TOPT regressor was used for hyperparameter tuning, and the optimal model was screened for dosage optimization prediction.

Benefits of technology

The accurate prediction of the dosage of double coagulant in the water plant is achieved, the quality of the effluent is stabilized, the overuse of the agent is reduced, the cost is reduced, and the model construction efficiency and prediction accuracy are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119626387A_ABST
    Figure CN119626387A_ABST
Patent Text Reader

Abstract

The invention discloses a waterworks double-coagulant accurate prediction method based on automatic machine learning, and the method comprises the steps: firstly obtaining the water quality data of a waterworks, the agent dosage data of two coagulants, and other basic data, and carrying out the preprocessing of the data; an automatic machine learning method is adopted, and a tap water double-coagulant dosage prediction model under the production condition is built; the model is optimized according to an actual effluent target value, and accurate prediction of the dosage of the two coagulants is realized by using the optimal model. According to the invention, accurate calculation and intelligent regulation and control of the dosage of the coagulant in the waterworks are realized, and the predictive capability of the double coagulant is particularly emphasized, so that the innovation point ensures that the effluent quality reaches the drinking water standard, meanwhile, the dependence on manpower is remarkably reduced, the operation cost and the medicament cost of the waterworks are saved, and the economic benefit is increased. And double improvement of economic benefits and environmental benefits is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to water quality management and water treatment process optimization in the field of smart water services, and in particular to a method for predicting the dosage of dual coagulants in a water plant based on automatic machine learning. Background Art

[0002] With the upgrading of technology and services in the water industry, the demand for smart dosing systems in water plants with practical uses as the core is becoming increasingly strong. The conventional treatment process of water treatment plants includes coagulation, sedimentation, filtration and disinfection. Coagulation is the main component of the water production cost of drinking water plants. It has the characteristics of multivariate factors (water temperature, pH value, turbidity, etc.), nonlinear mapping, and multi-disturbance changes, which increases the difficulty of accurate calculation of dosing amount.

[0003] The traditional manual control dosing method is particularly limited in the application of dual coagulants because of its strong subjectivity, waste of reagents, and difficulty in adapting to the demand for stable water quality control in large-scale production, resulting in lag in water quality supervision and monitoring. Mechanism models are difficult to identify the complex chemical reactions involved in the treatment of dual coagulants and the nonlinear relationship between components, and are difficult to promote in practical applications. In contrast, data-driven models based on machine learning can capture complex functional relationships from limited data sets and build nonlinear, multivariable dynamic black box models suitable for dual coagulant systems. However, the current model algorithm faces problems such as insufficient generalization ability and poor convergence when predicting the dosage of dual coagulants, and is still in the tedious stage of manual selection of algorithms, with low work efficiency. The emergence of automated machine learning (AutoML) technology aims to build efficient and high-performance machine learning processes for specific application scenarios (such as dual coagulant dosage prediction) through automation technology, so as to design, optimize and deploy models with minimal human intervention, and greatly reduce the computational and labor costs of machine learning pipeline development. Although AutoML has demonstrated significant advantages in hyperparameter adjustment and algorithm selection in multiple machine learning scenarios, its application in the field of dual coagulant dosage prediction is still insufficient. Introducing AutoML technology into the field of dual coagulant prediction is expected to significantly improve model building efficiency and prediction accuracy, injecting new impetus into technological innovation and industrial upgrading in the water treatment industry. Summary of the invention

[0004] In view of the problems that traditional dosing methods have no early warning, easily cause fluctuations in water quality and quantity, and there are problems such as waste of reagents and a large risk of exceeding standards, the present invention proposes a precise prediction method for double coagulants in tap water plants based on automatic machine learning. The automatic machine learning method is used to train a tap water double coagulant dosage prediction model constructed based on production conditions, and verification is performed until the optimal model is found, thereby achieving standardized and precise control of the coagulant dosage.

[0005] The present invention is achieved by the following technical solutions:

[0006] A method for accurately predicting dual coagulants in water plants based on automatic machine learning, including:

[0007] S1. Collect water quality indicators and dual coagulant dosage data as the original data set, preprocess missing values ​​and random errors, and divide the preprocessed original data set into a training set and a test set;

[0008] S2. Using the Spearman rank correlation coefficient method, a correlation analysis is performed between water quality indicators and the dosage of dual coagulants. According to the correlation analysis results, water quality indicators with significant correlation with dual coagulants are selected as water quality parameter prediction factors;

[0009] S3, this step further includes:

[0010] i) establishing a tap water dual coagulant dosage prediction model under production conditions, wherein the prediction factor is used as the input variable of the model, the TOPT regressor is used as the model subject, and the dual coagulant dosage is used as the target variable; the tap water dual coagulant dosage prediction model further includes a ferric chloride coagulant dosage prediction model and a polyaluminium chloride coagulant dosage prediction model, wherein the input variable of the ferric chloride coagulant dosage prediction model is the water quality parameter prediction factor, the input variable of the polyaluminium chloride coagulant dosage prediction model is the ferric chloride dosage and the water quality parameter prediction factor, and the output variables of the two models are both coagulant dosage;

[0011] ii) performing hyperparameter tuning on the TOPT regressor;

[0012] iii) sending the pre-processed sample set to the TPOT regressor after hyperparameter tuning; using the training set to train the tap water dual coagulant dosage prediction model, using the root mean square error, mean absolute error, and determination coefficient as verification indicators to verify the accuracy of the model, optimizing the FeCl3 coagulant and PACl coagulant dosage prediction model, and combining the automatic machine learning method to screen out the optimal model;

[0013] S4. Set the effluent water quality as the target value, take the dosage as the target variable, and use the optimal model to optimize the prediction of the dual coagulant dosage.

[0014] The water quality parameter prediction factors further include raw water temperature, conductivity, ammonia nitrogen, oxygen consumption, effluent turbidity, pH value and inlet flow rate.

[0015] The S2 is analyzed using the Spearman correlation coefficient method, which is relatively less sensitive to nonlinear relationships and outliers, as shown in the following formula:

[0016]

[0017] Among them, D i is the rank difference corresponding to the two variables, and n is the sample size.

[0018] The sample set is a feature matrix and target variables that have a significant impact on the coagulation reaction process and are selected based on actual production conditions.

[0019] The hyperparameter optimization of the TOPT regressor includes: setting the number of iterations generations to 50, the number of model pipelines retained by the genetic algorithm in each generation population_size to 8, the cross-validation strategy cv to 10 folds repeated 3 times, the amount of information output by TPOT at runtime verbosity to 2, the scoring function scoring used to evaluate model performance to neg_mean_squared_error, and the seed of the random number generator random_state to 42.

[0020] The optimal model further includes an optimized FeCl3 coagulant dosage prediction model and a PACl coagulant dosage prediction model.

[0021] Combining the automatic machine learning method to screen out the optimal model further includes using the optimized FeCl3 coagulant dosage prediction model and the PACl coagulant dosage prediction model to predict the optimized FeCl3 and PACl dosages of the two water sources, setting the effluent water quality as the target value, that is, taking the raw water quality parameters and the target effluent water quality parameters as feature variables, and taking the dosage as the target variable, and screening out the optimal algorithm through automatic machine learning.

[0022] The automatic machine learning method adopts the TOPT automatic machine learning library.

[0023] Compared with the prior art, the present invention exhibits the following unique and beneficial technical effects in the application of dual coagulants:

[0024] 1) The present invention proposes a dual coagulant multi-factor dynamic control strategy. This strategy innovatively achieves accurate prediction of the dosage of two coagulants (such as FeCl3 and PACl) in the water plant in response to the real-time fluctuation of raw water quality. It not only stabilizes the effluent quality and meets production needs, but also significantly reduces the excessive use of agents and achieves effective cost savings.

[0025] 2) The present invention has high practicality and immediate response capability, can be easily deployed in the existing production environment, and can be quickly put into use to ensure that the water plant can quickly adjust the coagulant dosage when facing water quality changes to maintain the stability of the effluent water quality;

[0026] 3) The present invention is not only applicable to the accurate prediction of dual coagulant systems, but also shows a high degree of versatility and can be seamlessly connected to various water purification facilities; in addition, its technical framework can also be extended to the accurate prediction of disinfectants, providing the possibility for comprehensive intelligence in the field of water treatment;

[0027] 4) Continuous iteration and performance improvement: The present invention trains and adjusts the model by collecting and integrating new data samples, and the present invention has continuous iteration performance. This not only increases the universality and accuracy of the model, but also ensures that the technology can be continuously optimized as the actual production environment changes, maintaining its leading edge and practicality, that is, realizing intelligent and precise dosing control. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 This is a flow chart of a method for accurately predicting dual coagulants in a water plant based on automatic machine learning of the present invention;

[0029] Figure 2 Produce process flow chart for water plant;

[0030] Figure 3 It is the schematic diagram of the Spearman rank correlation coefficient matrix of the FeCl3 coagulant dosage prediction model;

[0031] Figure 4 This is a schematic diagram of the Spearman rank correlation coefficient matrix of the PACl coagulant dosage prediction model;

[0032] Figure 5 Schematic diagram of the training and testing results of the RF model in predicting FeCl3 dosage using the AutoML method;

[0033] Figure 6 Schematic diagram of the training and testing results of the ERT model in predicting PACl dosage using the AutoML method;

[0034] Figure 7 Schematic diagram of the optimized dosage of the two coagulants. DETAILED DESCRIPTION

[0035] The technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings.

[0036] Embodiment 1

[0037] like Figure 1 As shown, the overall process of the method for accurately predicting dual coagulants in a water plant based on automatic machine learning of the present invention includes the following specific steps:

[0038] Step 1: Collect water quality indicators and dosage data, clean and preprocess the original data set, divide the preprocessed data set into training set and test set, and prepare for model training and verification:

[0039] Step 1.1, collect water quality and dosage data: obtain the data of various factors affecting the coagulation reaction process of the water plant from 2020.10 to 2024.5, the actual operation data such as the dosage of two coagulants as the original data. The actual operation data at least includes inlet flow, raw water quality indicators (water temperature, turbidity, pH value, oxygen consumption, conductivity, ammonia nitrogen), outlet water quality indicators (water temperature, turbidity, pH value, oxygen consumption, conductivity), FeCl3 dosage, PACl dosage; In order to ensure the adequacy and reliability of the data, the data sampling time interval is 24h, and at the same time confirm that all monitoring instruments are in good operating condition and the readings are within the effective range. The original data is collected in real time and manually detected by various measuring devices during the daily operation of the water plant. Due to sensor failure, personal experience and subjective judgment of operators, etc., the data records may be incomplete or missing, so there will be garbage data in the data set;

[0040] Step 1.2, preprocess the data set to ensure the quality and accuracy of the data and reduce the pollution of junk data to the database, including processing missing values ​​and eliminating random errors: First, conduct a comprehensive scan of the data set to identify all records or fields containing missing values. For the dosage with a large proportion of missing values, the mode is used to fill in. For the water quality parameters with a small proportion of missing values, the prediction model K neighbor is used to predict the missing values; secondly, random errors are usually caused by accidental factors in the measurement process. The moving average filtering method with a window size of 5 is used to smooth the data sequence and reduce the impact of noise. At the same time, the characteristics of the original signal are retained as much as possible. The data before and after processing are compared to check whether the distribution of the data is reasonable, which effectively improves the integrity and accuracy of the data;

[0041] Step 1.3, divide the data set: divide the original data into training set and test set in a ratio of 8:2, and 20% of the test samples are used to test the generalization ability of the model. For example, the data source is the actual production data of a water plant from October 2020 to May 2024, with a total of 1,339 data, which are divided into training set (1,071) and test set (268) in a ratio of 8:2;

[0042] Step 2: Conduct correlation analysis between various characteristics such as influent flow, raw water quality index, effluent water quality index and coagulant dosage. Specifically, the Spearman correlation coefficient method (ρ) with relatively low sensitivity to nonlinear relationships and outliers is used for analysis, and factors with high correlation with coagulation reaction results are selected as input variables of the model:

[0043] The Spearman correlation coefficient (ρ) is a statistic used to measure the monotonic relationship (not necessarily a linear relationship) between two variables. It is based on the level of the variable rather than the specific value, and is relatively less sensitive to nonlinear relationships and outliers. This method can identify and analyze the features in the data that contribute highly to the model prediction, remove irrelevant or redundant variables, reduce computational complexity and the risk of overfitting, and not only enhance the prediction accuracy and robustness of the model, but also help the model capture the inherent laws and patterns in the data more clearly. The calculation formula of the Spearman correlation coefficient is as follows:

[0044]

[0045] Among them, D i is the rank difference corresponding to the two variables, and n is the sample size.

[0046] The Spearman rank correlation coefficient indicates the direction of the correlation between X (independent variable) and Y (dependent variable). If Y tends to increase as X increases, the Spearman rank correlation coefficient is positive. If Y tends to decrease as X increases, the Spearman correlation coefficient is negative. A Spearman correlation coefficient of zero indicates that Y does not have any trend as X increases. As X and Y become closer to a completely monotonic correlation, the Spearman correlation coefficient increases in absolute value. When X and Y are completely monotonic, the absolute value of the Spearman correlation coefficient is 1.

[0047] like Figure 3As shown in the figure, it is the Spearman rank correlation coefficient matrix of the FeCl3 coagulant dosage prediction model, which shows the correlation results between the input parameters and the target variables. The variables that are strongly correlated with the FeCl3 coagulant dosage, that is, the variables with significant correlation, include raw water temperature (ρ is -0.88), raw water conductivity (ρ is 0.76), raw water oxygen consumption (ρ is 0.83), effluent water temperature (ρ is -0.87), and effluent conductivity (ρ is 0.74). The variables that are moderately correlated include raw water ammonia nitrogen (ρ is 0.49), effluent turbidity (ρ is 0.31), effluent pH value (ρ is -0.61), effluent oxygen consumption (ρ is 0.58), and inlet flow rate (ρ is -0.65). The raw water turbidity (ρ is -0.0095) and raw water pH value (ρ is 0.054) have weak correlation with the coagulant dosage. In addition, the raw water temperature is highly linearly correlated with the raw water conductivity and raw water oxygen consumption (ρ is -0.92 and -0.96, respectively), and the outlet water temperature is highly linearly correlated with the raw water conductivity and raw water oxygen consumption (ρ is -0.93 and -0.96, respectively). Therefore, only one feature can be retained in the subsequent model training. Combined with actual factors, the feature matrix used for model training includes raw water temperature, raw water ammonia nitrogen, raw water conductivity, raw water oxygen consumption, outlet water turbidity, outlet water pH, outlet water oxygen consumption, and inlet flow rate. The FeCl3 dosage is used as the target variable of the model. By constructing the model, the relationship between raw water quality, dosage and outlet water quality can be reflected.

[0048] like Figure 4As shown in the figure, it is the Spearman rank correlation coefficient matrix of the PACl coagulant dosage prediction model, which shows the correlation results between the input parameters and the target variables. The variables that are strongly correlated with the PACl coagulant dosage, that is, the variables with significant correlation, include FeCl3 dosage (ρ is 0.68), raw water temperature (ρ is -0.71), raw water ammonia nitrogen (ρ is 0.84), effluent pH value (ρ is -0.91), and inlet flow rate (ρ is -0.68). The variables that are moderately correlated include raw water turbidity (ρ is 0.44), raw water conductivity (ρ is 0.52), raw water pH value (ρ is -0.46), raw water oxygen consumption (ρ is 0.51), effluent temperature (ρ is -0.51), effluent conductivity (ρ is 0.37), effluent turbidity (ρ is -0.35), and effluent oxygen consumption (ρ is -0.084) has a weak correlation with the coagulant dosage. In addition, the raw water conductivity and the outlet water conductivity are highly linearly correlated (ρ is 0.98), and the raw water temperature is highly linearly correlated with the raw water conductivity and the outlet water temperature (ρ is -0.91 and -0.91, respectively). Therefore, only one feature can be retained in the subsequent model training. Combined with actual factors, the feature matrix used for model training includes FeCl3 dosage, raw water temperature, raw water pH, raw water ammonia nitrogen, raw water turbidity, raw water conductivity, outlet water pH, outlet water turbidity, and inlet flow rate. The PACl dosage is used as the target variable of the model. By constructing a model, the relationship between raw water quality, dosage, and outlet water quality can be reflected;

[0049] Step 3, combining the automatic machine learning method to establish a prediction model for the dosing of dual coagulants in tap water under production conditions for all periods of time, the automatic machine learning method uses the TOPT automatic machine learning library, and uses ten-fold repetitions for three cross-validations; evaluate the model results to ensure the accuracy and stability of the model, and the verification indicators include root mean square error (RMSE), mean absolute error (MAE), determination coefficient (R 2 );

[0050] Automatic machine learning (AutoML) is a technology designed to simplify the process of building machine learning models. It automates the design and training process of machine learning models, including steps such as model selection and hyperparameter optimization. Its core idea is to automatically select appropriate algorithms, parameters, and features to achieve the best model performance on a given data set.

[0051] The AutoML workflow usually consists of the following steps:

[0052] 1. Problem definition: The user provides a description of the machine learning task and related datasets.

[0053] 2. Search space definition: The AutoML system defines a search space that contains multiple potential model structures and hyperparameter combinations.

[0054] 3. Search strategy: Use search algorithms (such as grid search, random search, Bayesian optimization, etc.) to explore the optimal model and hyperparameter combination in the search space.

[0055] 4. Model training and evaluation: Train the searched candidate models and evaluate them on the validation test set to select the best model.

[0056] 5. Model deployment: Deploy the selected model to the production environment for prediction or decision making.

[0057] Tree-based Pipeline Optimization Tool (TOPT) is an open source automated machine learning library based on Python. It combines the functions of genetic programming algorithms and Scikit-Learn library to automatically design and optimize machine learning pipelines. It uses TOPT regressor (TPOTRegressor) for drug dosage prediction.

[0058] Step 3.1, use the accurate prediction model of coagulant dosage based on TOPT regressor to predict the actual dosage of FeCl3. Specifically, directly call TPOT regressor in the accurate prediction model of coagulant dosage, use the processed feature set as model input, and the dosage as model output. According to the set parameters of TPOT regressor, automatically select the best model that meets the current sample set from multiple models, and use this selected optimal model to predict the corresponding dosage. The specific steps are as follows:

[0059] Step 3.1.1, according to the actual environment to be analyzed, select the characteristic matrix 1 and the target variable 1 that obviously affect the coagulation reaction process as the sample set, the characteristic matrix is ​​the raw water temperature, raw water conductivity, raw water ammonia nitrogen, raw water oxygen consumption, effluent turbidity, effluent pH, effluent oxygen consumption, inlet flow rate, the target variable is FeCl3 dosage, the matrix has characteristic values ​​as rows and time as columns;

[0060] Step 3.1.2, send the above preprocessed sample set to the TPOT regressor, and set the parameters of the TPOT regressor, including: setting the number of iterations generations to 50, generating a new model pipeline through each iteration, and selecting it according to performance, that is, using a genetic algorithm to search and evaluate different machine learning algorithms, and further adjust its hyperparameters to find the model that best suits the current data; setting the number of model pipelines population_size retained by the genetic algorithm in each iteration to 8, so that the appropriate population size can increase diversity and help to search the search space extensively; setting the cross-validation strategy cv to 10-fold validation repeated 3 times, obtaining the average of the performance of the three groups of models and using it as the final estimate to evaluate the generalization ability of the model, reduce accidental errors caused by data partitioning, and improve the credibility of model selection and parameter tuning; the amount of information ver output by the TPOT regressor at runtime bosity is set to 2 to provide more iteration progress information (among which, iteration progress information includes the current number of iterations, population size, performance score of the current optimal pipeline, etc., pipeline evaluation information, outputting relevant information about pipeline training, such as performance score on the training set; best pipeline information, after the genetic algorithm search is completed, will output relevant information about the best pipeline currently found, including the composition of the pipeline (preprocessing steps, model type, etc.), hyperparameter configuration, and performance score, etc.), and display the progress bar of information output; the scoring function used to verify model performance is set to neg_mean_squared_error, that is, in regression problems, negative mean square error (negative NMSE) is usually used as the scoring function to make the optimization direction consistent with reducing the error; the seed of the random number generator random_state is set to 42 to ensure that reproducible results are obtained each time the TPOT regressor is run. The seed of the random number generator is set to 42 (or any other fixed value) to ensure the repeatability of the experiment. That is, it ensures that no matter how many times the code is run, the generated random number sequence is the same, which helps to compare the results in different experiments or runs and eliminate the influence of randomness on the results.

[0061] Step 3.1.3: Train the model and use the optimal model for prediction;

[0062] Step 3.1.4: Further evaluate the performance of the model using root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R 2 ) as a validation indicator to test the reliability and accuracy of the prediction model;

[0063] RMSE represents the mean of the square root of the error between the predicted value and the true value, represents the degree of sample dispersion, is sensitive to outliers in the data, and is used to measure the accuracy of the model. The calculation formula of RMSE is as follows:

[0064]

[0065] MAE represents the average error between the predicted value and the true value. Its value is in the range of [0, +∞). When MAE is close to 0, the model performance is higher. The calculation formula of MAE is as follows:

[0066]

[0067] R 2 It is used to quantify the degree of fit of the model to the data and to evaluate the robustness and reliability of the model. The closer it is to 1, the higher the degree of explanation of the independent variable on the dependent variable, the better the model fit, and the smaller the corresponding error. 2 The calculation formula is as follows:

[0068]

[0069] Among them, y i and j are the true value and predicted value of the sample, respectively. is the average of the actual values ​​of the samples, and n is the number of samples.

[0070] Step 3.1.5, export the results to Excel and use Origin software to visualize the predicted and actual values, such as Figure 5 As shown in the figure, the training and testing results of the AutoML:RF model in predicting FeCl3 dosage are shown. Figure 5 From the scatter density plots (c) and (d), it can be seen that the actual value and predicted value of FeCl3 dosage in the test set are basically located on the diagonal line, and the potential deviation of the model is small.

[0071] Step 3.2: Use the accurate prediction model of coagulant dosage based on TOPT regressor to predict the actual dosage of PACl. The specific steps are as follows:

[0072] Step 3.2.1, according to the actual environment to be analyzed, select the characteristic matrix 2 and the target variable 2 that obviously affect the coagulation reaction process as the sample set, the characteristic matrix is ​​FeCl3 dosage, raw water temperature, raw water turbidity, raw water pH value, raw water conductivity, raw water ammonia nitrogen, effluent turbidity, effluent pH value, inlet flow rate, and the target variable is PACl coagulant dosage; (the factor index here is compared with the FeCl3 coagulant dosing model, the standard

[0073] Step 3.2.2, send the above preprocessed sample set (including input parameter matrix and target variable) to TPOT regressor, and set the parameters of TPOT regressor, including: set the number of iterations generations to 50, each generation will generate a new model pipeline, and select it according to performance; the number of model pipelines retained by the genetic algorithm in each generation, population_size, is set to 8, and an appropriate population size can increase diversity and help to search the search space extensively; the cross-validation strategy cv is set to 10 folds and repeated 3 times, which is used to evaluate the generalization ability of the model, reduce accidental errors caused by data partitioning, and improve the credibility of model selection and parameter tuning; control the amount of information output by TPOT at runtime, verbosity is set to 2, which will provide more information and display a progress bar; the scoring function used to evaluate model performance is set to neg_mean_squared_error. In regression problems, negative mean square error (negative NMSE) is usually used as a scoring indicator to make the optimization direction consistent with reducing errors; the seed of the random number generator, random_state, is set to 42 to ensure that reproducible results can be obtained each time the TPOT regressor is run.

[0074] Step 3.2.3: Train the model and use the optimal model for prediction;

[0075] Step 3.2.4: Further verify the performance of the model. The evaluation indicators are the same as those of the FeCl3 prediction model, namely, root mean square error (RMSE), mean absolute error (MAE), and determination coefficient (R 2 );

[0076] Step 3.2.5: Export the validation results to Excel and use Origin software to visualize the predicted and actual values. Figure 6 The training and testing results of the AutoML:ERT model in predicting PACl dosage are shown. Figure 6 The scatter density plots (c) and (d) show that the actual value and predicted value of PACl dosage in the test set are basically located on the diagonal line, and the potential deviation of the model is small;

[0077] Step 4: Optimize the above-mentioned prediction of FeCl3 coagulant dosage and PACl coagulant dosage, predict the optimized FeCl3 dosage and PACl dosage of two water sources (Yangtze River water and Luanhe River water), set the effluent water quality to the target value, that is, take the raw water quality parameters and the target effluent water quality parameters as characteristic variables (the effluent turbidity of the Yangtze River water is 0.2, the effluent pH value is 8, and the effluent oxygen consumption is 1.2; the effluent turbidity of the Luanhe River water is 0.3, the effluent pH value is 8, and the effluent oxygen consumption is 1. 5. The dosage is used as the target variable, and the optimal coagulant dosage accurate prediction model selected by automatic machine learning is used for prediction. Specifically, the dosage of ferric chloride and polyaluminium chloride coagulants is predicted for different water sources. Compared with manual experience judgment, it can more accurately predict the optimal dosage for the effluent to meet the standard. When the raw water quality exceeds a certain threshold, manual judgment often results in excessive dosage. However, through model prediction, accurate dosage can be achieved while meeting the effluent standard, saving the cost of the agent.

[0078] like Figure 7 As shown in the figure, (a) is the dosage of the two optimized coagulants, and (b) is the optimized FeC l3 Dosage, (c) and (d) are optimized PACl dosage), the water plant's production capacity is 15wt / d, the unit price of FeCl3 is 0.858 yuan / kg, and after calculation, the Yangtze River water predicted by the model (water inflow time is March-November each year) saves 94.5kg / d of drugs, saving 22,000 yuan / year; Luanhe River water (water inflow time is December-January each year) saves 165kg / d of drugs, saving 13,000 yuan / year. The unit price of PACl in the water plant is 0.814 yuan / kg. After calculation, the Yangtze River water predicted by the model (water inflow time is March-November each year) saves 319.5kg / d of drugs, saving 70,000 yuan / year; Luanhe River water (water inflow time is December-January each year) saves 199.5kg / d of drugs, saving 15,000 yuan / year.

[0079] In summary, the present invention combines the basic data such as the process conditions of the water plant, the process parameters of each process link and the water quality data of each process, the dosage data of the reagents, and the mechanism of the coagulation reaction process, and through pretreatment and Spearman analysis, explores the inherent laws of the coagulation process and an intelligent dual coagulant dosing strategy. The present invention adopts a multi-factor control strategy to achieve real-time monitoring of water quality conditions. On this basis, the coagulation reaction mechanism and influencing factors are considered, and the Spearman analysis method is used for in-depth correlation exploration, and then a method for accurate prediction of dual coagulants in water plants based on automatic machine learning to select the optimal algorithm is constructed. In order to verify the prediction effect, the root mean square error (RMSE), mean absolute error (MAE), and correlation coefficient (R 2) three evaluation indicators were comprehensively evaluated, and the optimal algorithm was selected to predict and optimize the dosage of two coagulants to ensure the stability of effluent quality, realize the scientific and reasonable allocation of resources, and reduce labor and pharmaceutical costs. This innovative achievement provides a new idea and practical path for the field of water quality management and the accurate prediction of dual coagulants.

[0080] The TPOT automatic machine learning library described above is only a typical representative and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0081] For those skilled in the art, improvements and changes can be made according to the above invention content. Any modification, improvement and change made on the basis of the present invention should fall within the protection scope of the present invention.

Claims

1. A method for accurately predicting dual coagulants in a water plant based on automatic machine learning, characterized in that: include: S1. Collect water quality indicators and dual coagulant dosage data as the original data set, preprocess missing values ​​and random errors, and divide the preprocessed original data set into a training set and a test set; S2. Using the Spearman rank correlation coefficient method, a correlation analysis is performed between water quality indicators and the dosage of dual coagulants. According to the correlation analysis results, water quality indicators with significant correlation with dual coagulants are selected as water quality parameter prediction factors; S3, this step further includes: i) establishing a tap water dual coagulant dosage prediction model under production conditions, wherein the prediction factor is used as the input variable of the model, the TOPT regressor is used as the model subject, and the dual coagulant dosage is used as the target variable; the tap water dual coagulant dosage prediction model further includes a ferric chloride coagulant dosage prediction model and a polyaluminium chloride coagulant dosage prediction model, wherein the input variable of the ferric chloride coagulant dosage prediction model is the water quality parameter prediction factor, the input variable of the polyaluminium chloride coagulant dosage prediction model is the ferric chloride dosage and the water quality parameter prediction factor, and the output variables of the two models are both coagulant dosage; ii) performing hyperparameter tuning on the TOPT regressor; iii) sending the pre-processed sample set to the TPOT regressor after hyperparameter tuning; using the training set to train the tap water dual coagulant dosage prediction model, using the root mean square error, mean absolute error, and determination coefficient as verification indicators to verify the accuracy of the model, optimizing the FeCl3 coagulant and PACl coagulant dosage prediction model, and combining the automatic machine learning method to screen out the optimal model; S4. Set the effluent water quality as the target value, take the dosage as the target variable, and use the optimal model to optimize the prediction of the dual coagulant dosage.

2. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The water quality parameter prediction factors further include raw water temperature, conductivity, ammonia nitrogen, oxygen consumption, effluent turbidity, pH value and inlet flow rate.

3. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The S2 is analyzed using the Spearman correlation coefficient method, which is relatively less sensitive to nonlinear relationships and outliers, as shown in the following formula: Among them, D i is the rank difference corresponding to the two variables, and n is the sample size.

4. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The sample set is a feature matrix and target variables that have a significant impact on the coagulation reaction process and are selected based on actual production conditions.

5. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The hyperparameter optimization of the TOPT regressor includes: setting the number of iterations generations to 50, the number of model pipelines retained by the genetic algorithm in each generation population_size to 8, the cross-validation strategy cv to 10 folds repeated 3 times, the amount of information output by TPOT at runtime verbosity to 2, the scoring function scoring used to evaluate model performance to neg_mean_squared_error, and the seed of the random number generator random_state to 42.

6. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The optimal model further includes an optimized FeCl3 coagulant dosage prediction model and a PACl coagulant dosage prediction model.

7. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 2, characterized in that: Combining the automatic machine learning method to screen out the optimal model further includes using the optimized FeCl3 coagulant dosage prediction model and the PACl coagulant dosage prediction model to predict the optimized FeCl3 and PACl dosages of the two water sources, setting the effluent water quality as the target value, that is, taking the raw water quality parameters and the target effluent water quality parameters as feature variables, and taking the dosage as the target variable, and screening out the optimal algorithm through automatic machine learning.

8. The method for accurately predicting dual coagulants in a water plant based on automatic machine learning as claimed in claim 1, characterized in that: The automatic machine learning method adopts the TOPT automatic machine learning library.

Citation Information

Patent Citations

  • Intelligent coagulation dosing method and device for water purification plant

    CN113683169A

  • Real-time control method for dosing pump of sewage treatment plant based on machine learning

    CN117555303A

  • Water purification plant coagulant intelligent dosing method based on machine learning

    CN118335216A

  • Method for establishing coagulation intelligent monitoring linkage system

    WO2024021150A1

Cited By

  • Chemical adding control method, device, product and equipment in water treatment process

    CN120398235A

  • Intelligent low-carbon coagulation dosing method based on multi-stage machine learning and dynamic feedback

    CN120483356A

  • Intelligent low-carbon coagulation dosing method based on multi-stage machine learning and dynamic feedback

    CN120483356B

  • Automatic regulation and control dosing method and system for oil well

    CN120867685A

  • An oil well automatic control method and system for adding chemicals

    CN120867685B