Microbial flocculant flocculation efficiency prediction method and device based on decision tree regression
By using decision tree regression to screen feature variables and optimize model structure, the problem of unpredictable flocculation efficiency of bioflocculators was solved, achieving efficient and accurate prediction of flocculation efficiency, reducing water treatment costs, and promoting the development of green water treatment technology.
Patent Information
- Application Number
- CN202510173616.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-02-18
AI Technical Summary
Existing technologies cannot accurately predict the flocculation efficiency of bioflocculators under different water quality conditions, and traditional methods are costly and difficult to promote on a large scale.
A decision tree-based regression approach was adopted, using Pearson correlation coefficient and F-value to select feature variables, performing data standardization, constructing a CART decision tree model, and optimizing the model structure through a pruning algorithm to generate an efficient and accurate flocculation efficiency prediction model.
This has improved the accuracy and stability of predicting the flocculation efficiency of bioflocculators, reduced treatment costs, and promoted the development of green water treatment technologies.
Smart Images

Figure CN119646763B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of coagulation efficiency prediction technology, specifically to a method and apparatus for predicting the coagulation efficiency of microbial flocculants based on decision tree regression. Background Technology
[0002] With global population growth and rising living standards, the aquaculture industry has developed rapidly, becoming an important source of food supply. However, the large amount of pollutants generated during aquaculture, such as feed residue and fish excrement, can lead to a significant increase in the concentration of particulate matter, organic matter, and nutrients in the aquaculture water, resulting in water quality deterioration. This not only affects the healthy growth of aquatic organisms but also poses a potential threat to the surrounding ecological environment.
[0003] In the field of water treatment, coagulation technology is one of the key processes for removing suspended particles and impurities from water. While traditional chemical coagulants (such as iron and aluminum salts) are widely used, they have many limitations when treating high-turbidity aquaculture effluent. For example, excessive addition of chemical coagulants can lead to pH imbalances in the water and even cause heavy metal ion exceedances, adversely affecting the quality of aquatic products and the ecological environment. In contrast, bioflocculants, as an emerging green water treatment material, are gradually gaining attention due to their biodegradability, non-toxicity, and environmental friendliness. Bioflocculants are mainly composed of microbial metabolites and can achieve efficient water purification without introducing harmful chemicals.
[0004] Despite the significant environmental advantages of bioflocculants, their application in practical engineering still faces numerous challenges. On the one hand, the relatively high production cost of bioflocculants limits their large-scale promotion; on the other hand, the flocculation efficiency of bioflocculants is affected by various factors, such as water temperature, pH value, and flocculant dosage. The interactions between these factors are complex and difficult to predict accurately using traditional empirical methods.
[0005] In recent years, machine learning technology has been increasingly applied in environmental science, providing new insights for the prediction and optimization of complex systems. Machine learning algorithms can analyze large amounts of experimental data to uncover the potential relationships between input parameters and output results, thereby achieving accurate predictions of unknown operating conditions. Currently, although there are a few studies applying machine learning to predict the dosage of chemical coagulants, research on predicting the flocculation efficiency of bioflocculators is still relatively limited, especially in terms of feature selection and model construction, where a systematic approach is lacking. The mechanisms of action of bioflocculators differ from those of traditional chemical coagulants, and their performance under different water quality conditions requires further investigation. Developing an efficient and accurate method for predicting the flocculation efficiency of bioflocculators by combining machine learning technology is of significant practical importance for optimizing the application of bioflocculators, reducing water treatment costs, and promoting the development of green water treatment technologies.
[0006] In view of the above, this application is hereby submitted. Summary of the Invention
[0007] This invention provides a method and apparatus for predicting the flocculation efficiency of microbial flocculants based on decision tree regression, which can at least partially improve the above-mentioned problems.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression, comprising:
[0010] Obtain the flocculant data to be predicted and the preset target prediction value, and calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset;
[0011] The input dataset is standardized to generate a prediction dataset;
[0012] The prediction dataset is used as input data and fed into a pre-trained prediction model to generate prediction results.
[0013] The present invention also provides a device for predicting the flocculation efficiency of microbial flocculants based on decision tree regression, comprising:
[0014] The preprocessing unit is used to acquire the flocculant data to be predicted and the preset target prediction value, and to calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset;
[0015] A standardization unit is used to standardize the input dataset to generate a prediction dataset;
[0016] The prediction unit is used to input the prediction dataset as input data into a pre-trained prediction model to generate prediction results.
[0017] In summary, this invention proposes a highly efficient and accurate method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression. This method utilizes decision tree regression technology to achieve intelligent analysis and prediction of the flocculation process. Specifically, key water quality parameters are obtained experimentally, and statistical analysis is used to screen out factors that significantly affect flocculation efficiency. Based on this, a prediction model with strong generalization ability is constructed using data standardization and a scientific model training strategy. This method not only effectively improves prediction accuracy but also reduces the risk of overfitting by optimizing the model structure, ensuring the stability of the model in practical applications. Finally, the superior performance of the model is verified through rigorous evaluation indicators, providing strong technical support for the widespread application of bioflocculators in the field of water treatment and promoting the development of environmental water treatment technology. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression provided in the first embodiment of the present invention.
[0019] Figure 2 This is a Pearson correlation coefficient graph provided in an embodiment of the present invention;
[0020] Figure 3 This is a subplot of the F-test values of the input features provided in this embodiment of the invention;
[0021] Figure 4 This is a schematic diagram illustrating the effect of the pruning parameter α on the model MSE provided in this embodiment of the invention;
[0022] Figure 5 This is a schematic diagram of the prediction results of the dataset provided in an embodiment of the present invention;
[0023] Figure 6 This is a schematic diagram of the module of the microbial flocculant flocculation efficiency prediction device based on decision tree regression provided in the second embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0025] refer to Figure 1 As shown, the first embodiment of the present invention discloses a method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression. This method can be executed by a microbial flocculant flocculation efficiency prediction device based on decision tree regression (hereinafter referred to as the prediction device), specifically by one or more processors within the prediction device, to implement the following method:
[0026] S1, acquire the flocculant data to be predicted and the preset target prediction value, and calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset;
[0027] Specifically, step S1 includes: according to the formula Calculate the Pearson correlation coefficient between the flocculant data and the target predicted value, where r is the Pearson correlation coefficient, n is the sample size, and x is the target predicted value. i Let y be the observed value of variable X. i For the observed values of variable Y, Let X be the sample mean of variable X. Let Y be the sample mean of the variable Y;
[0028] According to the formula Calculate the F-values of the flocculant data and the target predicted value, and filter out the flocculant data with F-values greater than a preset value to generate an input dataset. Here, the explained variance represents the change in the target variable predicted by the feature variables, and the unexplained variance represents the change in the target variable that the feature variables failed to predict.
[0029] In this embodiment, it is first necessary to obtain relevant data on the flocculant to be predicted and the preset target prediction value. This data is typically obtained experimentally, for example, by using a beaker stirring experiment (Jar Test) to simulate the flocculation process and recording various parameters during the experiment, such as raw water turbidity, temperature, pH value, and Ca2+. 2+ The concentration and dosage of the bioflocculator were also considered. Simultaneously, the turbidity of the water after flocculation was experimentally measured, and the flocculation efficiency was calculated as a target prediction value. These data will serve as the basis for subsequent analyses.
[0030] A correlation analysis was performed on the acquired flocculant data and the target predicted values. Specifically, the Pearson correlation coefficient was calculated to quantify the strength of the linear relationship between each input feature and flocculation efficiency. By calculating the Pearson correlation coefficient, feature variables with strong correlations to flocculation efficiency can be preliminarily screened.
[0031] To further filter feature variables, the F-value between the flocculant data and the target predicted value needs to be calculated. Calculating the F-value allows for a more accurate assessment of the explanatory power of each feature variable for the target predicted value. In this embodiment, a preset value is set, and flocculant data with F-values greater than this preset value are selected, thereby generating the input dataset for subsequent modeling. This feature filtering method based on Pearson correlation coefficient and F-value effectively removes feature variables with low correlation to the target predicted value, reduces the dimensionality of the model input, and improves the model's training efficiency and prediction accuracy. Simultaneously, by using scientific statistical analysis methods to filter feature variables that significantly affect flocculation efficiency, a solid foundation is laid for building an accurate and reliable prediction model.
[0032] S2, standardize the input dataset to generate a prediction dataset;
[0033] Specifically, step S2 includes: standardizing the input dataset to convert the data in the input dataset into standard normal distribution data with a mean of 0 and a standard deviation of 1, wherein the standardization formula is: μ is the mean, σ is the standard deviation, z is the standardized normal distribution data, and x represents the distribution to be standardized.
[0034] Based on the standardized normal distribution data, a prediction dataset is generated.
[0035] In this embodiment, standardization of the obtained input dataset is a crucial step. This process aims to transform the data into a standard normal distribution with a mean of 0 and a standard deviation of 1, thereby eliminating the potential impact of differences in dimensions and orders of magnitude between different features on model training. Specifically, for each feature value in the input dataset, a standardization formula is applied. Standardization ensures that each feature is compared and analyzed on the same scale, preventing certain features from dominating model training due to their large numerical range, while also improving the model's convergence speed and prediction accuracy.
[0036] After standardization, the processed standard normally distributed data is integrated to generate a prediction dataset. This dataset will serve as the basic input for subsequent model training and prediction, providing standardized data support for building an efficient and accurate predictive model for bioflocculation efficiency.
[0037] Preferably, before inputting the prediction dataset as input data into the pre-trained prediction model, the method further includes:
[0038] S01, Obtain JarTest experimental data, calculate the Pearson correlation coefficient and F-value between the JarTest experimental data and the target predicted value, and obtain the experimental dataset;
[0039] S02, Standardize the experimental dataset to generate training and test sets;
[0040] Specifically, step S02 includes: standardizing the experimental dataset to convert the data in the input dataset into standard normal distribution data with a mean of 0 and a standard deviation of 1;
[0041] All standardized normal distribution data were divided into two sets: 80% of the data was used as the training set and 20% was used as the test set.
[0042] In this embodiment, to construct an efficient and accurate predictive model for bioflocculation efficiency, high-quality data must first be obtained experimentally. Specifically, experimental data related to the bioflocculation process are acquired through a beaker stirring test (Jar Test). This data includes, but is not limited to, raw water turbidity, temperature, pH value, and Ca2+. 2+ Key parameters such as concentration and dosage of bioflocculator were selected. Simultaneously, the turbidity of the water after flocculation was experimentally measured to calculate the flocculation efficiency as a target predicted value. Based on these data, the Pearson correlation coefficient and F-value between the flocculation efficiency and the target predicted value were calculated to identify characteristic variables that significantly affect flocculation efficiency, thus forming the experimental dataset.
[0043] Next, after obtaining the experimental dataset, the data was further standardized. This process was achieved by converting each feature value in the experimental dataset into data conforming to a standard normal distribution with a mean of 0 and a standard deviation of 1. Standardization not only eliminates the dimensional differences between different features but also ensures that the data is analyzed on the same scale, thus providing a fairer and more accurate data foundation for subsequent model training. Furthermore, standardization significantly improves the model's convergence speed and numerical stability, and reduces potential anomalies during model training.
[0044] After standardization, the processed standard normally distributed data is divided into training and test sets. Specifically, 80% of the data is used as the training set for model training and parameter optimization; the remaining 20% is used as the test set to evaluate the model's performance and generalization ability. This division ensures that the model can learn the main patterns in the data during training, while the test set provides objective validation of the model's predictive ability.
[0045] S03, Construct a CART decision tree model based on the training set, and perform training preprocessing on the CART decision tree model;
[0046] Specifically, step S03 includes: constructing a CART decision tree model based on the training set, and during the construction process, selecting the feature and split point with the smallest mean square error after splitting from each split node of the CART decision tree model;
[0047] Split Standard MSE split The calculation formula is: Where S is the set of samples in the current node, S1 and S2 are both subsets of the set of samples in the current node after splitting S, |S1| and |S2| are the number of samples in the two subsets S1 and S2 after splitting, and MSE(S1) and MSE(S2) are the mean squared errors within subsets S1 and S2.
[0048] According to the formula Calculate the output value of each leaf node of the CART decision tree model, where the output value is the mean of the target values of its internal samples, S t Let y be the set of samples from leaf node t. i Let i be the true value of the i-th sample. It represents the average predicted value of all samples within leaf node t.
[0049] In the construction of the CART decision tree model, the node loss is recorded based on the cost complexity pruning algorithm, and the node cost complexity α is selected. tThe smallest node is pruned until the pruning path terminates, and the pruning parameter α is obtained.
[0050] Among them, the node cost complexity α t The calculation formula is: R(t) is the error at node t, R(T) t Let |T) represent the subtree error rooted at node t. t | represents the number of leaf nodes in the subtree rooted at node t;
[0051] Train the decision tree model corresponding to each pruning parameter α to obtain multiple decision tree sets T(α1), T(α2), ..., T(αk) with different complexities, and make predictions on the preset validation set time to calculate the corresponding mean square error.
[0052] The cost complexity function is given by: C(T) = R(T) + α·|T|, where C(T) is the total loss of the decision tree. Let |T| be the training error of the model, |T| be the number of leaf nodes in the tree, and α be the pruning parameter.
[0053] In this embodiment, a CART (Classification and Regression Tree) decision tree modeling method was used to construct the CART decision tree model. The core of this method lies in constructing a decision tree model using training set data and optimizing the model's splitting nodes and pruning strategies during the construction process to ensure that the model has good accuracy and generalization ability when predicting the flocculation efficiency of bioflocculators.
[0054] Specifically, a CART decision tree model is constructed based on the training set data. During model construction, for each split node, the feature and split point with the smallest mean squared error (MSE) after the split are selected. This process involves calculating the splitting standard MSE. split This is achieved by selecting the split point with the smallest mean squared error, which allows the model to better capture patterns in the data, thereby improving prediction accuracy.
[0055] In the construction of the decision tree, the output value of each leaf node is defined as the mean of the target values of its internal samples. This effectively reduces the model's dependence on individual samples, improving its stability and robustness. Furthermore, to prevent overfitting, a cost-complexity pruning algorithm is introduced during construction. This algorithm records node losses and selects the node with the lowest cost complexity for pruning until the pruning path terminates. This allows the model to significantly reduce its complexity while maintaining high prediction accuracy, thereby improving its generalization ability.
[0056] Finally, after pruning, a corresponding decision tree model is trained for each pruning parameter, resulting in multiple decision tree sets with varying complexities. These models are then used to make predictions on a predefined validation set, and their mean squared error (MSE) is calculated. By evaluating the model performance for different pruning parameters on the validation set, the optimal pruning parameters can be selected, thus determining the final decision tree model. Here, α is the pruning parameter used to control model complexity.
[0057] S04, based on the test set, predict the decision tree model corresponding to each pruning parameter α in the CART decision tree model to obtain the optimal decision tree regression model;
[0058] Specifically, step S04 includes: predicting the decision tree model corresponding to each pruning parameter α based on the test set, and calculating its corresponding mean square error;
[0059] The decision tree model corresponding to the pruning parameter α with the smallest mean square error is selected as the optimal decision tree regression model.
[0060] In this embodiment, a test set-based model evaluation and selection strategy is used to determine the most suitable decision tree regression model for predicting the flocculation efficiency of bioflocculators. The core of this strategy is to predict the decision tree model corresponding to each pruning parameter using the test set, and then select the optimal model based on the mean squared error (MSE) of the prediction results. This approach not only effectively evaluates the model's performance on unseen data but also ensures that the model has good generalization ability, thus providing reliable prediction results in practical applications.
[0061] Specifically, in this embodiment, after constructing and pruning the CART decision tree model, a series of decision tree models with different complexities are obtained, each corresponding to a specific pruning parameter. To evaluate the performance of these models, the previously partitioned test set is input into each decision tree model for prediction. The test set is data independent of the training set, used to simulate unknown situations that the model may encounter in real-world applications; therefore, the prediction results on the test set can truly reflect the model's generalization ability. During the prediction process, the mean squared error (MSE) of each decision tree model on the test set is calculated. The mean squared error is a commonly used metric to measure the difference between the model's predicted value and the true value; the smaller the value, the higher the model's prediction accuracy. By calculating the MSE of each model, the performance differences of the models under different pruning parameters can be quantitatively compared.
[0062] Subsequently, the decision tree model with the smallest pruning parameters was selected from all models and identified as the optimal decision tree regression model. This selection process is based on a simple yet effective principle: the model that performs best on the test set usually provides the most accurate predictions in real-world applications. This approach not only ensures the model's fit to the training data but, more importantly, validates it on the test set, ensuring its predictive ability on unknown data.
[0063] S05, based on the coefficient of determination R 2 The root mean square error and the mean relative error are used to evaluate the optimal decision tree regression model to obtain a trained prediction model.
[0064] Specifically, step S05 includes: according to the formula The optimal decision tree regression model is evaluated, and evaluation results are generated, where RMSE is the root mean square error and MAPE is the mean relative error. y1 represents the actual average flocculation efficiency. i This represents the actual value of the flocculation efficiency. is the corresponding predicted flocculation efficiency value, and n is the sample size.
[0065] In this embodiment, the index determination coefficient (R²) is used. 2 The calculation and analysis of root mean square error (RMSE) and mean relative error (MAPE) quantify the predictive performance of the model from different perspectives, thereby providing a scientific basis for the final application of the model.
[0066] Specifically, first calculate the coefficient of determination (R²). 2 R 2 R is an important indicator for measuring the goodness of fit of a model, reflecting the degree of correlation between the model's predicted values and the actual values. 2 The closer the value is to 1, the better the model fits the data, and the smaller the deviation between the predicted and actual values. By calculating R... 2 This allows for an intuitive understanding of the model's predictive ability for the flocculation efficiency of bioflocculators, as well as the model's effectiveness in capturing the inherent patterns in the data.
[0067] Secondly, calculate the root mean square error (RMSE). RMSE is a commonly used metric for evaluating the accuracy of model predictions. It reflects the square root of the mean of the sum of the squares of the differences between predicted and actual values. The smaller the RMSE value, the smaller the model's prediction error, and the closer the prediction result is to the actual value. By evaluating RMSE, the error level of the model in the prediction process can be quantified, thus providing a reference for model optimization.
[0068] Finally, the Mean Relative Error (MAPE) is calculated to assess the relative deviation between the model's predictions and the actual values. APE, by calculating the ratio of the prediction error to the actual value, provides a more intuitive reflection of the model's relative accuracy. Unlike RMSE, MAPE is unaffected by data units, making it more suitable for comparisons between different datasets. Evaluating MAPE allows for a deeper understanding of the model's prediction bias in practical applications, particularly its performance when dealing with data of different units or sizes.
[0069] By comprehensively utilizing R 2 The three evaluation metrics, RMSE and MAPE, can comprehensively and objectively evaluate the performance of the optimal decision tree regression model. 2 It provides a macro-level perspective on model goodness of fit, with RMSE quantifying the absolute error level of the model and MAPE reflecting the relative error. This multi-dimensional evaluation method not only helps users gain a deeper understanding of the model's performance in different aspects but also provides strong guidance for model optimization and improvement.
[0070] Please see Figure 4 , Figure 5 S3, the prediction dataset is used as input data and input into the pre-trained prediction model to generate prediction results.
[0071] Specifically, in this embodiment, taking the experiment using a beaker stirring device (JarTest) as an example, the raw water turbidity, raw water pH, temperature, and Ca2+ of each experiment are recorded. 2+ The concentration and dosage of the bioflocculator are used to determine the turbidity of the water after flocculation and sedimentation, and the flocculation efficiency is calculated. The formula is: A total of 115 sets of data were collected in this experiment, and the data input characteristics are shown in Table 1.
[0072] Table 1 Input Feature Description Table
[0073] describe Example raw water temperature 25(℃) raw water turbidity 125 (NTU) <![CDATA[Ca in water 2+ concentration]]> 100 (mg / L) Bio-flocculant dosage 4 (mL) raw water pH 7.0
[0074] Calculate the Pearson correlation coefficients and F-values of the five input features with the target predicted value. The results are as follows: Figure 2 and Figure 3 As shown, due to the low correlation coefficient and F-score of temperature, raw water turbidity, raw water pH, and Ca were selected as the optimal parameters. 2+ Concentration and bioflocculant dosage were used as input features.
[0075] The dataset is divided into a training set and a test set in a ratio of 8:2, i.e., 92 groups in the training set and 23 groups in the test set.
[0076] A decision tree regression model is established, and the pruning complexity parameter α is selected. Multiple decision tree models are built by traversing different α values. The range of the pruning parameter α is automatically generated by the pruning path of the decision tree model. A series of subtrees are constructed by traversing all possible α values. Through iterative iteration, decision tree models with different pruning levels are trained sequentially, and evaluated on a test set. The model with the smallest mean squared error (MSE) is selected as the optimal model. The root mean squared error (RMSE) of the training and test sets is as follows: Figure 4 As shown, α was finally determined to be 0.000101332. The optimal model was then used to predict on the training and test sets, and the prediction results are as follows. Figure 5 As shown in Table 2, the R2, RMSE, and MAPE values were calculated to evaluate the model.
[0077] Table 2 Evaluation Table of Decision Tree Regression Model
[0078] <![CDATA[R 2 ]]> RMSE MAPE training set 0.9809 0.0272 2.8592 test set 0.7889 0.1116 18.2778
[0079] In summary, the proposed method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression aims to optimize the application of bioflocculators in water treatment through machine learning technology. By employing scientifically sound feature selection and data preprocessing, it improves the model's training efficiency and prediction accuracy; by optimizing the construction and pruning strategies of the decision tree model, it significantly enhances the model's generalization ability; and by using a comprehensive evaluation index system, it ensures the model's reliability and stability in practical applications. Ultimately, this invention provides an efficient and accurate prediction method for the application of bioflocculators in water treatment, effectively improving flocculation efficiency, reducing treatment costs, and minimizing environmental impact, thus possessing significant practical application value and broad application prospects.
[0080] Please see Figure 6 The second embodiment of the present invention provides a microbial flocculant flocculation efficiency prediction device based on decision tree regression, which includes:
[0081] The preprocessing unit 201 is used to acquire the flocculant data to be predicted and the preset target prediction value, and to calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset;
[0082] Standardization unit 202 is used to standardize the input dataset to generate a prediction dataset;
[0083] The prediction unit 203 is used to input the prediction dataset as input data into a pre-trained prediction model to generate prediction results.
[0084] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression, characterized in that, include: Obtain the flocculant data to be predicted and the preset target prediction value, and calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset; The input dataset is standardized to generate a prediction dataset; The prediction dataset is used as input data and fed into a pre-trained prediction model to generate prediction results; Before inputting the predicted dataset as input data into the pre-trained prediction model, the process also includes: A CART decision tree model is constructed based on the training set, and the CART decision tree model is preprocessed for training, specifically as follows: A CART decision tree model is constructed based on the training set, and during the construction process, the feature and split point with the smallest mean square error after splitting are selected from each split node of the CART decision tree model. Split Standard MSE split The calculation formula is: Where S is the set of samples in the current node, S1 and S2 are both subsets of the set of samples in the current node after splitting S, |S1| and |S2| are the number of samples in the two subsets S1 and S2 after splitting, and MSE(S1) and MSE(S2) are the mean squared errors within subsets S1 and S2. According to the formula Calculate the output value of each leaf node of the CART decision tree model, where the output value is the mean of the target values of its internal samples, S t Let y be the set of samples from leaf node t. i Let i be the true value of the i-th sample. This represents the average predicted value of all samples within leaf node t; In the construction of the CART decision tree model, the node loss is recorded based on the cost complexity pruning algorithm, and the node cost complexity α is selected. t The smallest node is pruned until the pruning path terminates, and the pruning parameter α is obtained. Among them, the node cost complexity α t The calculation formula is: R(t) is the error at node t, R(T) t Let |T) represent the subtree error rooted at node t. t | represents the number of leaf nodes in the subtree rooted at node t; Train the decision tree model corresponding to each pruning parameter α to obtain multiple decision tree sets T(α1), T(α2), ..., T(αk) with different complexities, and make predictions on the preset validation set time to calculate the corresponding mean square error. The cost complexity function is given by: C(T) = R(T) + α·|T|, where C(T) is the total loss of the decision tree. Let |T| be the training error of the model, |T| be the number of leaf nodes in the tree, and α be the pruning parameter; Based on the test set, the optimal decision tree regression model is obtained by predicting the decision tree model corresponding to each pruning parameter α in the CART decision tree model, as follows: Based on the test set, predict the decision tree model corresponding to each pruning parameter α, and calculate its corresponding mean square error; The decision tree model with the smallest mean square error corresponding to the pruning parameter α is selected as the optimal decision tree regression model. The Pearson correlation coefficient and F-value of the flocculant data and the target predicted value are calculated to obtain the input dataset, specifically: According to the formula Calculate the Pearson correlation coefficient between the flocculant data and the target predicted value, where r is the Pearson correlation coefficient, n is the sample size, and x is the target predicted value. i Let y be the observed value of variable X. i For the observed values of variable Y, Let X be the sample mean of variable X. Let Y be the sample mean of the variable Y; According to the formula Calculate the F-values of the flocculant data and the target predicted value, and filter out the flocculant data with F-values greater than a preset value to generate an input dataset. Here, the explained variance is the part of the target variable that is predicted by the feature variable, and the unexplained variance is the part of the target variable that is not predicted by the feature variable. The input dataset is standardized to generate a prediction dataset, specifically as follows: The input dataset is standardized to transform the data into a standard normal distribution with a mean of 0 and a standard deviation of 1. The standardization formula is as follows: μ is the mean, σ is the standard deviation, z is the standardized normal distribution data, and x represents the distribution to be standardized. Based on the standardized normal distribution data, a prediction dataset is generated by integrating the data; the test set R 2 It can reach 0.7889.
2. The method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression according to claim 1, characterized in that, Before inputting the predicted dataset as input data into the pre-trained prediction model, the process also includes: Acquire Jar Test experimental data, calculate the Pearson correlation coefficient and F-value between the Jar Test experimental data and the target predicted value, and obtain the experimental dataset; The experimental dataset is standardized to generate training and test sets; A CART decision tree model is constructed based on the training set, and the CART decision tree model is preprocessed for training. Based on the test set, predict the decision tree model corresponding to each pruning parameter α in the CART decision tree model to obtain the optimal decision tree regression model; According to the coefficient of determination R 2 The root mean square error and the mean relative error are used to evaluate the optimal decision tree regression model to obtain a trained prediction model; the flocculant data to be predicted consists of 115 sets.
3. The method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression according to claim 2, characterized in that, The experimental dataset is standardized to generate training and test sets, specifically as follows: The experimental dataset is standardized to convert the data in the input dataset into a standard normal distribution with a mean of 0 and a standard deviation of 1. All standardized normal distribution data were divided into two sets: 80% of the data was used as the training set and 20% was used as the test set.
4. The method for predicting the flocculation efficiency of microbial flocculants based on decision tree regression according to claim 2, characterized in that, According to the coefficient of determination R 2 The root mean square error and the mean relative error are used to evaluate the optimal decision tree regression model to obtain a trained prediction model, specifically: According to the formula The optimal decision tree regression model is evaluated, and evaluation results are generated, where RMSE is the root mean square error and MAPE is the mean relative error. y1 represents the actual average flocculation efficiency. i This represents the actual value of the flocculation efficiency. is the corresponding predicted flocculation efficiency value, and n is the sample size.
5. A device for predicting the flocculation efficiency of microbial flocculants based on decision tree regression, characterized in that, include: The preprocessing unit is used to acquire the flocculant data to be predicted and the preset target prediction value, and to calculate the Pearson correlation coefficient and F value of the flocculant data and the target prediction value to obtain the input dataset; A standardization unit is used to standardize the input dataset to generate a prediction dataset; The prediction unit is used to input the prediction dataset as input data into a pre-trained prediction model to generate prediction results; Before inputting the predicted dataset as input data into the pre-trained prediction model, the process also includes: A CART decision tree model is constructed based on the training set, and the CART decision tree model is preprocessed for training, specifically as follows: A CART decision tree model is constructed based on the training set, and during the construction process, the feature and split point with the smallest mean square error after splitting are selected from each split node of the CART decision tree model. Split Standard MSE split The calculation formula is: Where S is the set of samples in the current node, S1 and S2 are both subsets of the set of samples in the current node after splitting S, |S1| and |S2| are the number of samples in the two subsets S1 and S2 after splitting, and MSE(S1) and MSE(S2) are the mean squared errors within subsets S1 and S2. According to the formula Calculate the output value of each leaf node of the CART decision tree model, where the output value is the mean of the target values of its internal samples, S t Let y be the set of samples from leaf node t. i Let i be the true value of the i-th sample. This represents the average predicted value of all samples within leaf node t; In the construction of the CART decision tree model, the node loss is recorded based on the cost complexity pruning algorithm, and the node cost complexity α is selected. t The smallest node is pruned until the pruning path terminates, and the pruning parameter α is obtained. Among them, the node cost complexity α t The calculation formula is: R(t) is the error at node t, R(T) t Let |T) represent the subtree error rooted at node t. t | represents the number of leaf nodes in the subtree rooted at node t; Train the decision tree model corresponding to each pruning parameter α to obtain multiple decision tree sets T(α1), T(α2), ..., T(αk) with different complexities, and make predictions on the preset validation set time to calculate the corresponding mean square error. The cost complexity function is given by: C(T) = R(T) + α·|T|, where C(T) is the total loss of the decision tree. Let |T| be the training error of the model, |T| be the number of leaf nodes in the tree, and α be the pruning parameter; The Pearson correlation coefficient and F-value of the flocculant data and the target predicted value are calculated to obtain the input dataset, specifically: According to the formula Calculate the Pearson correlation coefficient between the flocculant data and the target predicted value, where r is the Pearson correlation coefficient, n is the sample size, and x is the target predicted value. i Let y be the observed value of variable X. i For the observed values of variable Y, Let X be the sample mean of variable X. Let Y be the sample mean of the variable Y; According to the formula Calculate the F-values of the flocculant data and the target predicted value, and filter out the flocculant data with F-values greater than a preset value to generate an input dataset. Here, the explained variance is the part of the target variable that is predicted by the feature variable, and the unexplained variance is the part of the target variable that is not predicted by the feature variable. The input dataset is standardized to generate a prediction dataset, specifically as follows: The input dataset is standardized to transform the data into a standard normal distribution with a mean of 0 and a standard deviation of 1. The standardization formula is as follows: μ is the mean, σ is the standard deviation, z is the standardized normal distribution data, and x represents the distribution to be standardized. Based on the standardized normal distribution data, a prediction dataset is generated.
Citation Information
Patent Citations
Coagulation dosage prediction method based on random forest regression
CN119047614A