Water quality prediction method, device, computer equipment, storage medium and computer program product

By combining the water quality data and feature extraction, and using a pre-trained water quality prediction model for detection, the problem of low accuracy caused by subjective factors in traditional water quality detection methods is solved, and higher detection accuracy and reliability are achieved.

CN118885914BActive Publication Date: 2024-12-17GUANGDONG SHUNKONG ZIHUA TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411367360.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-17
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

Traditional water quality testing methods rely on manual testing, and subjective factors lead to low detection accuracy, making it difficult to ensure the accuracy of water pollution control.

Method used

By obtaining the water quality data of the tail water to be tested, performing combination processing and feature extraction, generating target feature vectors, and using multiple pre-trained water quality prediction models to predict, screen and weight sum, obtaining target water quality prediction results and improving detection accuracy sex.

Benefits of technology

No manual intervention is required, which improves the accuracy and reliability of water quality detection, reduces subjective errors, and enhances the accuracy of water quality detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885914B_ABST
    Figure CN118885914B_ABST
Patent Text Reader

Abstract

The present application relates to a water quality prediction method, device, computer equipment, storage medium and computer program product, which can be used in the field of computer technology. The method includes: obtaining water quality data of tail water to be tested; combining the water quality data to obtain combined data, and performing feature extraction processing to obtain a feature vector of the water quality data and a feature vector of the combined data; splicing the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector; inputting the target feature vector into a water quality prediction model to obtain a water quality prediction result of each water quality prediction model, and a prediction probability corresponding to each water quality prediction result; from each water quality prediction result, screening out the screened water quality prediction result whose corresponding prediction probability is greater than a preset prediction probability; performing weighted sum processing on the screened water quality prediction results to obtain a target water quality prediction result of the tail water to be tested. The present method can improve the detection accuracy of water quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a water quality prediction method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] At present, in order to ensure the smooth progress of water pollution control, it is crucial to accurately test the water quality.

[0003] In traditional technology, manual testing is generally used in the process of water quality testing; however, this method has subjective factors and is prone to errors, resulting in low accuracy in water quality testing. Summary of the invention

[0004] Based on this, it is necessary to provide a water quality prediction method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of water quality detection in response to the above technical problems.

[0005] In a first aspect, the present application provides a water quality prediction method, comprising:

[0006] Obtain water quality data of tail water to be tested;

[0007] Performing combination processing on the water quality data to obtain combination data corresponding to the water quality data;

[0008] Performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data;

[0009] Performing concatenation processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data;

[0010] Inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining a water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and a prediction probability corresponding to each water quality prediction result;

[0011] From each of the water quality prediction results, a water quality prediction result having a corresponding prediction probability greater than a preset prediction probability is selected as the selected water quality prediction result;

[0012] The water quality prediction results after screening are weighted and summed to obtain the target water quality prediction results of the tail water to be tested.

[0013] In one embodiment, the step of obtaining the water quality data of the tail water to be tested includes:

[0014] Determine the source information of the tail water to be tested;

[0015] According to the source information of the tail water to be tested, query the corresponding relationship between the source information and the preset index, and obtain the preset index corresponding to the source information of the tail water to be tested as the preset index of the tail water to be tested;

[0016] The water quality data of the tail water to be tested under the preset index is obtained as the water quality data of the tail water to be tested.

[0017] In one embodiment, the performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data includes:

[0018] Preprocessing the water quality data and the combined data respectively to obtain preprocessed water quality data and preprocessed combined data;

[0019] The pre-processed water quality data is used as main data, and the pre-processed combined data is used as auxiliary data, and inputted into a feature extraction model to obtain a feature vector of the water quality data;

[0020] The pre-processed combined data is used as main data, and the pre-processed water quality data is used as auxiliary data, which are input into a feature extraction model to obtain a feature vector of the combined data.

[0021] In one embodiment, the weighted summation of the screened water quality prediction results to obtain the target water quality prediction results of the tail water to be tested includes:

[0022] Determining a target water quality prediction model corresponding to the screened water quality prediction result;

[0023] Obtaining the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the screened water quality prediction result;

[0024] Determining a model weight of the target water quality prediction model corresponding to the water quality prediction result after screening according to the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction result after screening;

[0025] According to the model weight of the target water quality prediction model corresponding to the screened water quality prediction result, the screened water quality prediction result is weighted and summed to obtain the target water quality prediction result of the tail water to be tested.

[0026] In one embodiment, the combining process of the water quality data to obtain the combined data corresponding to the water quality data includes:

[0027] Determining a target combination method corresponding to the water quality data;

[0028] According to the target combination method, determining the water quality data to be combined corresponding to the water quality data;

[0029] The water quality data and the water quality data to be combined are combined to obtain combined data corresponding to the water quality data.

[0030] In one embodiment, the pre-trained water quality prediction model is trained in the following manner:

[0031] Obtain sample water quality data of sample tail water;

[0032] Performing combination processing on the sample water quality data to obtain sample combination data corresponding to the sample water quality data;

[0033] Performing feature extraction processing on the sample water quality data and the sample combination data to obtain a feature vector of the sample water quality data and a feature vector of the sample combination data;

[0034] Performing concatenation processing on the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a sample target feature vector of the sample water quality data;

[0035] Inputting the sample target feature vector into the water quality prediction model to be trained to obtain the water quality prediction result of the sample tail water;

[0036] The actual water quality result of the sample tail water is obtained, and according to the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water, the water quality prediction model to be trained is iteratively trained to obtain the pre-trained water quality prediction model.

[0037] In one embodiment, after performing weighted sum processing on the screened water quality prediction results to obtain the target water quality prediction results of the tail water to be tested, the method further includes:

[0038] Inputting the target water quality prediction result into a pre-trained water quality grade prediction model to obtain the prediction probability of the target water quality prediction result under multiple water quality grades;

[0039] From the multiple water quality levels, screen out the water quality level with the largest prediction probability as the target water quality level of the tail water to be tested;

[0040] Generating tail water treatment instructions corresponding to the tail water to be tested according to the target water quality level;

[0041] The tail water to be tested is treated according to the tail water treatment instruction.

[0042] In a second aspect, the present application also provides a water quality prediction device, comprising:

[0043] A data acquisition module, used to obtain water quality data of tail water to be tested;

[0044] A data combination module, used for combining the water quality data to obtain combined data corresponding to the water quality data;

[0045] A feature extraction module, used for performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data;

[0046] A vector concatenation module, used for concatenating the characteristic vector of the water quality data and the characteristic vector of the combined data to obtain a target characteristic vector of the water quality data;

[0047] A model prediction module, used for inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result;

[0048] A result screening module, used to screen out the water quality prediction results whose corresponding prediction probability is greater than a preset prediction probability from each of the water quality prediction results as the screened water quality prediction results;

[0049] The result determination module is used to perform weighted summation processing on the water quality prediction results after screening to obtain the target water quality prediction result of the tail water to be tested.

[0050] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0051] Obtain water quality data of tail water to be tested;

[0052] Performing combination processing on the water quality data to obtain combination data corresponding to the water quality data;

[0053] Performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data;

[0054] Performing concatenation processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data;

[0055] Inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining a water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and a prediction probability corresponding to each water quality prediction result;

[0056] From each of the water quality prediction results, a water quality prediction result having a corresponding prediction probability greater than a preset prediction probability is selected as the selected water quality prediction result;

[0057] The water quality prediction results after screening are weighted and summed to obtain the target water quality prediction results of the tail water to be tested.

[0058] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0059] Obtain water quality data of tail water to be tested;

[0060] Performing combination processing on the water quality data to obtain combination data corresponding to the water quality data;

[0061] Performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data;

[0062] Performing concatenation processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data;

[0063] Inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining a water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and a prediction probability corresponding to each water quality prediction result;

[0064] From each of the water quality prediction results, a water quality prediction result having a corresponding prediction probability greater than a preset prediction probability is selected as the selected water quality prediction result;

[0065] The water quality prediction results after screening are weighted and summed to obtain the target water quality prediction results of the tail water to be tested.

[0066] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0067] Obtain water quality data of tail water to be tested;

[0068] Performing combination processing on the water quality data to obtain combination data corresponding to the water quality data;

[0069] Performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data;

[0070] Performing concatenation processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data;

[0071] Inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining a water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and a prediction probability corresponding to each water quality prediction result;

[0072] From each of the water quality prediction results, a water quality prediction result having a corresponding prediction probability greater than a preset prediction probability is selected as the selected water quality prediction result;

[0073] The water quality prediction results after screening are weighted and summed to obtain the target water quality prediction results of the tail water to be tested.

[0074] The above-mentioned water quality prediction method, device, computer equipment, storage medium and computer program product first obtain water quality data of the tail water to be tested, and combine the water quality data to obtain combined data corresponding to the water quality data, then perform feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data, and perform splicing processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data, then, input the target feature vector into multiple pre-trained water quality prediction models to obtain the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result, then, from each of the water quality prediction results, screen out the water quality prediction result whose corresponding prediction probability is greater than the preset prediction probability as the screened water quality prediction result, and finally, perform weighted sum processing on the screened water quality prediction results to obtain the target water quality prediction result of the tail water to be tested. In this way, in the process of testing water quality, the target feature vector of the water quality data is obtained by combining the water quality data of the tail water to be tested and the combined data corresponding to the water quality data, and then the target feature vector is predicted by multiple pre-trained water quality prediction models, and multiple water quality prediction results are screened and processed to obtain the target water quality prediction result of the tail water to be tested, thereby improving the accuracy and reliability of the overall prediction; moreover, the entire process does not require human intervention, avoiding the subjective factors in the manual detection method, which is prone to errors and leads to the defect of low water quality detection accuracy, and further improving the water quality detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0076] Figure 1 A schematic diagram of a water quality prediction method in one embodiment;

[0077] Figure 2 is a schematic flow chart of a water quality prediction method in another embodiment;

[0078] Figure 3 is a schematic diagram of a water quality comprehensive soft sensing method in one embodiment;

[0079] Figure 4 This is a schematic diagram of the structure of a breeding tailwater treatment system in one embodiment;

[0080] Figure 5 A schematic diagram of the training and prediction results of the LightGBM COD soft sensor model optimized based on the Bayesian algorithm on a training set in one embodiment;

[0081] Figure 6 A schematic diagram of the training and prediction results of the LightGBM TN soft sensor model optimized based on the Bayesian algorithm on a training set in one embodiment;

[0082] Figure 7 A schematic diagram of the training and prediction results of the LightGBM TP soft sensor model optimized based on the Bayesian algorithm on a training set in one embodiment;

[0083] Figure 8 is a structural block diagram of a water quality prediction device in one embodiment;

[0084] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0085] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0086] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0087] In an exemplary embodiment, Figure 1 As shown, a water quality prediction method is provided. This embodiment uses the method applied to a server as an example for illustration. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones and tablet computers; the server can be implemented as an independent server or a server cluster composed of multiple servers. In this embodiment, the method includes the following steps:

[0088] Step S101, obtaining water quality data of tail water to be tested.

[0089] Among them, the tail water to be tested refers to the treated wastewater that needs to be tested for water quality.

[0090] Among them, water quality data refers to data related to the quality of the tail water to be tested, such as influent DO (Dissolved Oxygen), influent SS (Suspended Solids), influent pH (potential of hydrogen), influent T (temperature), influent COD (Chemical Oxygen Demand), influent TP (Total Phosphorus), influent TN (Total Nitrogen), influent NH4 + -N (Ammonium Nitrogen) and other data.

[0091] Exemplarily, in response to a detection instruction for the tail water to be tested, the server obtains water quality data of the tail water to be tested under preset indicators through a water treatment system associated with the tail water to be tested as the water quality data of the tail water to be tested.

[0092] Step S102, combining the water quality data to obtain combined data corresponding to the water quality data.

[0093] Among them, combined data refers to the data obtained by combining water quality data, such as the ratio of influent COD to influent TP, influent TN to influent NH4 + -N difference, correlation coefficient between inlet SS and inlet DO, etc.

[0094] Exemplarily, the server determines the water quality data to be combined corresponding to each water quality data; then, for each water quality data, the server combines the water quality data and the water quality data to be combined corresponding to the water quality data to obtain the combined data corresponding to each water quality data.

[0095] Step S103, performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data.

[0096] The feature extraction process refers to the process of obtaining the feature vector corresponding to the data.

[0097] Among them, the characteristic vector of water quality data is used to represent the characterization vector of water quality data.

[0098] The feature vector of the combined data is used to represent the characterization vector of the combined data.

[0099] Exemplarily, the server determines the data type of the water quality data, and based on the correspondence between the data type and the feature extraction model, determines the feature extraction model corresponding to the data type of the water quality data as the feature extraction model corresponding to the water quality data; then, the server performs feature extraction processing on the water quality data through the feature extraction model corresponding to the water quality data to obtain a feature vector of the water quality data; then, the server determines the data type of the combined data, and based on the correspondence between the data type and the feature extraction model, determines the feature extraction model corresponding to the data type of the combined data as the feature extraction model corresponding to the combined data; then, the server performs feature extraction processing on the combined data through the feature extraction model corresponding to the combined data to obtain a feature vector of the combined data.

[0100] Step S104, concatenating the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data.

[0101] The splicing process refers to the process of combining feature vectors in a specific manner.

[0102] The target feature vector refers to a feature vector obtained by concatenating the feature vector of the water quality data and the feature vector of the combined data.

[0103] Exemplarily, the server determines the importance of the water quality data and the importance of the combined data; then, the server determines the splicing order of the feature vectors of the water quality data and the feature vectors of the combined data according to the importance of the water quality data and the importance of the combined data; then, the server splices the feature vectors of the water quality data and the feature vectors of the combined data according to the splicing order to obtain the target feature vectors of the water quality data.

[0104] Step S105, inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result.

[0105] Among them, the water quality prediction model refers to a network model that can use the target feature vector to obtain the water quality prediction result of the tail water to be tested and the prediction probability corresponding to the water quality prediction result, such as the LightGBM (Light Gradient Boosting Machine) model, XGBoost (eXtreme Gradient Boosting) model and RF (Random Forest) model.

[0106] Among them, the water quality prediction results are used to characterize the water quality prediction of the tail water to be tested, including data such as effluent COD, effluent TP and effluent TN.

[0107] The prediction probability is used to represent the possibility that the water quality prediction model believes that its output water quality prediction result is correct, such as 90%.

[0108] Exemplarily, the server obtains multiple pre-trained water quality prediction models, and inputs the target feature vector into the multiple pre-trained water quality prediction models, and obtains the water quality prediction result corresponding to the target feature vector output by each pre-trained water quality prediction model as the water quality prediction result of the tail water to be tested; then, the server uses the prediction probability of the water quality prediction result corresponding to the target feature vector output by each pre-trained water quality prediction model as the prediction probability corresponding to each water quality prediction result.

[0109] Step S106, from each water quality prediction result, a water quality prediction result whose corresponding prediction probability is greater than a preset prediction probability is selected as the selected water quality prediction result.

[0110] Here, the preset prediction probability refers to a pre-set prediction probability threshold, such as 80%.

[0111] Among them, the water quality prediction result after screening refers to the water quality prediction result whose corresponding prediction probability is greater than the preset prediction probability.

[0112] Exemplarily, the server screens out the water quality prediction results whose corresponding prediction probabilities are greater than the preset prediction probabilities from each water quality prediction result as the screened water quality prediction results; for example, the prediction probability corresponding to water quality prediction result 1 is 90%, the prediction probability corresponding to water quality prediction result 2 is 85%, the prediction probability corresponding to water quality prediction result 3 is 70%, and the prediction probability corresponding to water quality prediction result 4 is 80%. When the preset prediction probability is 80%, water quality prediction results 1 and water quality prediction results 2 are used as the screened water quality prediction results.

[0113] Step S107, performing weighted summation processing on the screened water quality prediction results to obtain the target water quality prediction result of the tail water to be tested.

[0114] Among them, the target water quality prediction result refers to the screened water quality prediction result after weighted summation processing.

[0115] Exemplarily, the server performs weighted summation processing on the screened water quality prediction results to obtain the processed screened water quality prediction results as the target water quality prediction results of the tail water to be tested; for example, in water quality prediction result 1, the effluent COD is 9.30 mg / L, the effluent TP is 0.46 mg / L, and the effluent TN is 1.22 mg / L, and in water quality prediction result 2, the effluent COD is 8.70 mg / L, the effluent TP is 0.44 mg / L, and the effluent TN is 1.08 mg / L. Then, in the target water quality prediction results of the tail water to be tested, the effluent COD is 9.00 mg / L, the effluent TP is 0.45 mg / L, and the effluent TN is 1.15 mg / L.

[0116] In the above-mentioned water quality prediction method, the water quality data of the tail water to be tested is first obtained, and the water quality data is combined and processed to obtain the combined data corresponding to the water quality data, and then the water quality data and the combined data are feature extracted to obtain the feature vector of the water quality data and the feature vector of the combined data, and the feature vector of the water quality data and the feature vector of the combined data are spliced ​​to obtain the target feature vector of the water quality data, and then the target feature vector is input into a plurality of pre-trained water quality prediction models to obtain the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result is obtained, and then, from each water quality prediction result, the water quality prediction result whose corresponding prediction probability is greater than the preset prediction probability is screened out as the screened water quality prediction result, and finally, the screened water quality prediction results are weighted summed to obtain the target water quality prediction result of the tail water to be tested. In this way, in the process of testing water quality, the target feature vector of the water quality data is obtained by combining the water quality data of the tail water to be tested and the combined data corresponding to the water quality data, and then the target feature vector is predicted by multiple pre-trained water quality prediction models, and multiple water quality prediction results are screened and processed to obtain the target water quality prediction result of the tail water to be tested, thereby improving the accuracy and reliability of the overall prediction; moreover, the entire process does not require human intervention, avoiding the subjective factors in the manual detection method, which is prone to errors and leads to the defect of low water quality detection accuracy, and further improving the water quality detection accuracy.

[0117] In an exemplary embodiment, the above step S101, obtaining water quality data of the tail water to be tested, specifically includes the following contents: determining the source information of the tail water to be tested; according to the source information of the tail water to be tested, querying the correspondence between the source information and the preset index, and obtaining the preset index corresponding to the source information of the tail water to be tested as the preset index of the tail water to be tested; obtaining the water quality data of the tail water to be tested under the preset index as the water quality data of the tail water to be tested.

[0118] Among them, the source information refers to the origin of the tail water to be tested, such as fish ponds, factories, etc.

[0119] The corresponding relationship between the source information and the preset indicators is used to characterize the association information between the source information and the preset indicators. For example, when the source information is a fish pond, the corresponding preset indicators are indicator a, indicator b, and indicator c, and when the source information is a factory, the corresponding preset indicators are indicator a and indicator d.

[0120] Among them, the preset indicators refer to the pre-set indicator information, such as influent DO, influent SS, influent pH, influent T, influent COD, influent TP, influent TN or influent NH4 + -N and other indicators.

[0121] Exemplarily, the server determines the source information of the tail water to be tested; then, the server queries the correspondence between the source information and the preset indicators based on the source information of the tail water to be tested, and obtains the preset indicators corresponding to the source information of the tail water to be tested as the preset indicators of the tail water to be tested; then, the server obtains the water quality data of the tail water to be tested under the preset indicators, and uses these water quality data as the water quality data of the tail water to be tested.

[0122] In this embodiment, by determining the preset indicators corresponding to the source information of the tail water to be tested and obtaining the water quality data of the tail water to be tested under the preset indicators, the use of inappropriate indicators for data acquisition is avoided, which leads to interference from irrelevant data, and the acquired water quality data more accurately reflects the actual condition of the tail water to be tested, which is conducive to improving the accuracy of determining the water quality data of the tail water to be tested.

[0123] In an exemplary embodiment, the above step S103 performs feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data, which specifically includes the following contents: preprocessing the water quality data and the combined data respectively to obtain preprocessed water quality data and preprocessed combined data; using the preprocessed water quality data as the main data and the preprocessed combined data as the auxiliary data, and inputting them into the feature extraction model to obtain the feature vector of the water quality data; using the preprocessed combined data as the main data and the preprocessed water quality data as the auxiliary data, and inputting them into the feature extraction model to obtain the feature vector of the combined data.

[0124] The pre-processed water quality data refers to the water quality data after pre-processing.

[0125] The preprocessed combined data refers to the combined data after preprocessing.

[0126] Among them, the main data may refer to data with a larger corresponding weight.

[0127] Among them, auxiliary data may refer to data with a smaller corresponding weight.

[0128] Among them, the feature extraction model refers to a network model that can obtain the feature vector corresponding to the data, such as the transformer model.

[0129] Exemplarily, the server preprocesses the water quality data and the combined data respectively to obtain the preprocessed water quality data and the preprocessed combined data; for example, the server identifies and removes outliers on the water quality data and the combined data respectively, and performs data normalization processing to obtain the preprocessed water quality data and the preprocessed combined data; then, the server uses the preprocessed water quality data as the main data and the preprocessed combined data as the auxiliary data, and inputs them into the feature extraction model for feature extraction processing to obtain the feature vector of the water quality data; for example, the server determines that the first weight corresponding to the preprocessed water quality data is 0.8, and the second weight corresponding to the preprocessed combined data is 0.2, and fuses the preprocessed water quality data and the preprocessed combined data according to the first weight and the second weight to obtain the first fusion. Combined data, and input the first fused data into the feature extraction model for feature extraction processing, to obtain the feature vector of the first fused data as the feature vector of the water quality data; then, the server uses the preprocessed combined data as the main data and the preprocessed water quality data as the auxiliary data, and inputs them into the feature extraction model to obtain the feature vector of the combined data; for example, the server determines that the third weight corresponding to the preprocessed combined data is 0.8, and the fourth weight corresponding to the preprocessed water quality data is 0.2, and according to the third weight and the fourth weight, the preprocessed combined data and the preprocessed water quality data are fused to obtain the second fused data, and the second fused data is input into the feature extraction model for feature extraction processing, to obtain the feature vector of the second fused data as the feature vector of the combined data.

[0130] In this embodiment, by preprocessing the water quality data and the combined data, noise, outliers and inconsistencies can be removed, which is beneficial to improving the quality of the water quality data and the combined data; moreover, by combining the preprocessed combined data and the preprocessed water quality data for feature extraction processing, the information in the data can be more comprehensively utilized, which is beneficial to improving the quality and representativeness of the feature vector.

[0131] In an exemplary embodiment, the above-mentioned step S107 performs weighted summation processing on the water quality prediction results after screening to obtain the target water quality prediction results of the tail water to be tested, which specifically includes the following contents: determining the target water quality prediction model corresponding to the water quality prediction results after screening; obtaining the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction results after screening; determining the model weight of the target water quality prediction model corresponding to the water quality prediction results after screening according to the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction results after screening; performing weighted summation processing on the water quality prediction results after screening according to the model weight of the target water quality prediction model corresponding to the water quality prediction results after screening to obtain the target water quality prediction results of the tail water to be tested.

[0132] Among them, the target water quality prediction model refers to the water quality prediction model corresponding to the water quality prediction result after output screening.

[0133] Among them, the prediction accuracy is used to characterize the proximity between the predicted value and the actual value of the target water quality prediction model.

[0134] Among them, prediction efficiency is used to characterize the time required for the target water quality prediction model to make predictions.

[0135] Among them, the model weight is used to characterize the importance of the target water quality prediction model.

[0136] Exemplarily, the server determines the water quality prediction model corresponding to the water quality prediction result after screening from each water quality prediction model as the target water quality prediction model; then, the server obtains the prediction accuracy and prediction efficiency of the target water quality prediction model; then, the server determines the model weight of the target water quality prediction model according to the prediction accuracy and prediction efficiency of the target water quality prediction model; for example, the prediction accuracy of the target water quality prediction model A is 0.9, and the prediction efficiency after standardization is 0.7; the prediction accuracy of the target water quality prediction model B is 0.8, and the prediction efficiency after standardization is 0. 9. When the importance coefficient of prediction accuracy is 0.6 and the importance coefficient of prediction efficiency is 0.4, the model weight of the target water quality prediction model A is 0.9*0.6+0.7*0.4=0.82, and the model weight of the target water quality prediction model B is 0.8*0.6+0.9*0.4=0.84; then, the server performs weighted summation processing on the screened water quality prediction results according to the model weights of the target water quality prediction models corresponding to the screened water quality prediction results, and obtains the processed screened water quality prediction results as the target water quality prediction results of the tail water to be tested.

[0137] In this embodiment, by simultaneously considering the prediction accuracy and prediction efficiency, the model weight of the target water quality prediction model is determined, so that the water quality prediction results corresponding to the target water quality prediction model with higher prediction accuracy and prediction efficiency occupy a larger proportion in the weighted summation processing, which is beneficial to improving the prediction accuracy of the target water quality prediction results of the tail water to be tested.

[0138] In an exemplary embodiment, the above step S102 combines the water quality data to obtain combined data corresponding to the water quality data, which specifically includes the following contents: determining a target combination method corresponding to the water quality data; determining water quality data to be combined corresponding to the water quality data according to the target combination method; and combining the water quality data and the water quality data to be combined to obtain combined data corresponding to the water quality data.

[0139] Among them, the target combination method is used to characterize the corresponding rules for specific combination processing of water quality data. For example, the influent COD and influent TP can be combined to obtain the ratio of influent COD to influent TP, and the ratio of influent TN to influent NH4 + -N can be combined to obtain influent TN and influent NH4 + -N difference, the inlet SS and inlet DO can be combined to obtain the correlation coefficient of inlet SS and inlet DO.

[0140] The water quality data to be combined refers to the water quality data that can be combined. For example, the water quality data to be combined corresponding to the influent COD is the influent TP, and the water quality data to be combined corresponding to the influent TN is the influent NH4 + -N, the water quality data to be combined corresponding to the inlet water SS is the inlet water DO.

[0141] Exemplarily, the server determines a target combination method corresponding to the water quality data; then, the server determines the water quality data to be combined corresponding to each water quality data according to the target combination method; then, for each water quality data, the server combines the water quality data and the water quality data to be combined corresponding to the water quality data to obtain the combined data corresponding to the water quality data, and further obtains the combined data corresponding to each water quality data.

[0142] In this embodiment, the original water quality data can be purposefully integrated and transformed through the target combination method, thereby creating more expressive combined data; moreover, through the specific target combination method, the defect of generating a large amount of meaningless or irrelevant combined data, which leads to increased complexity of subsequent data analysis, is avoided.

[0143] In an exemplary embodiment, the water quality prediction method provided by the present application also includes a training step of a pre-trained water quality prediction model, which specifically includes the following contents: obtaining sample water quality data of sample tail water; combining the sample water quality data to obtain sample combination data corresponding to the sample water quality data; performing feature extraction processing on the sample water quality data and the sample combination data to obtain a feature vector of the sample water quality data and a feature vector of the sample combination data; concatenating the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a sample target feature vector of the sample water quality data; inputting the sample target feature vector into the water quality prediction model to be trained to obtain a water quality prediction result of the sample tail water; obtaining the actual water quality result of the sample tail water, and iteratively training the water quality prediction model to be trained based on the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water to obtain a pre-trained water quality prediction model.

[0144] The sample tail water refers to the tail water used to train the water quality prediction model to be trained.

[0145] Among them, sample water quality data refers to the water quality data of sample tail water.

[0146] The sample combination data refers to the combination data obtained by combining the sample water quality data.

[0147] The sample target feature vector refers to a feature vector obtained by concatenating the feature vector of the sample water quality data and the feature vector of the sample combination data.

[0148] The water quality prediction result of the sample tail water refers to the prediction value corresponding to the sample tail water output by the water quality prediction model to be trained.

[0149] The actual water quality result of the sample tail water refers to the actual value of the sample tail water output by the water quality prediction model to be trained.

[0150] Exemplarily, in response to a model training instruction for a water quality prediction model to be trained, the server obtains water quality data of sample tail water from a database as sample water quality data; then, the server performs combination processing on the sample water quality data to obtain combination data corresponding to the sample water quality data as sample combination data; then, the server inputs the sample water quality data and the sample combination data into a feature extraction model respectively, performs feature extraction processing on the sample water quality data and the sample combination data through the feature extraction model, and obtains a feature vector of the sample water quality data and a feature vector of the sample combination data; then, the server performs concatenation processing on the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a target vector of the sample water quality data The server inputs the sample target feature vector into the water quality prediction model to be trained to obtain the water quality prediction result of the sample tail water; then, the server obtains the actual water quality result of the sample tail water, and obtains the loss value according to the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water; then, the server adjusts the model parameters of the water quality prediction model to be trained according to the loss value; then, the server retrains the water quality prediction model after the model parameters are adjusted until the loss value obtained by the trained water quality prediction model is less than the loss value threshold, then stops the training, and uses the trained water quality prediction model as the pre-trained water quality prediction model.

[0151] In this embodiment, by pre-training the water quality prediction model, it is convenient to predict the target water quality prediction result of the tail water to be tested after obtaining the water quality data of the tail water to be tested in actual application; moreover, the water quality prediction model receives new data in each round of iteration, and performs internal improvements and optimizations on the model, so as to facilitate more effective predictions, which is beneficial to improving the prediction accuracy of the water quality prediction model.

[0152] In an exemplary embodiment, the above-mentioned step S107, after weighted summing up the screened water quality prediction results to obtain the target water quality prediction results of the tail water to be tested, specifically includes the following contents: inputting the target water quality prediction results into a pre-trained water quality grade prediction model to obtain the prediction probability of the target water quality prediction results under multiple water quality grades; from multiple water quality grades, screening out the water quality grade with the largest prediction probability as the target water quality grade of the tail water to be tested; generating tail water treatment instructions corresponding to the tail water to be tested according to the target water quality grade; and processing the tail water to be tested according to the tail water treatment instructions.

[0153] The water quality grade prediction model refers to a network model that can use the target water quality prediction results to obtain the prediction probabilities of the target water quality prediction results under multiple water quality grades.

[0154] Among them, water quality grade is used to characterize the grade information corresponding to water quality, such as first-level water quality, second-level water quality, unqualified water quality, etc.

[0155] Among them, the target water quality level refers to the water quality level of the tail water to be tested.

[0156] The tail water treatment instruction refers to the instruction information corresponding to the treatment of the tail water to be tested.

[0157] Exemplarily, the server inputs the target water quality prediction result into a pre-trained water quality grade prediction model, and obtains multiple water quality grades corresponding to the target water quality prediction result and the prediction probability of the target water quality prediction result under multiple water quality grades through the water quality grade prediction model; then, the server selects the water quality grade with the largest prediction probability from the multiple water quality grades as the target water quality grade of the tail water to be tested; then, the server generates a tail water treatment instruction corresponding to the target water quality grade according to the target water quality grade as the tail water treatment instruction corresponding to the tail water to be tested; for example, in the case where the target water quality grade is first-level water quality, the tail water to be tested corresponds to The tailwater treatment instruction is "periodically inspect and maintain the tailwater discharge pipeline". When the target water quality level is level 2, the tailwater treatment instruction corresponding to the tailwater to be tested is "investigate and control the sources that may affect the tailwater quality". When the target water quality level is unqualified, the tailwater treatment instruction corresponding to the tailwater to be tested is "immediately stop tailwater discharge". Finally, the server processes the tailwater to be tested according to the tailwater treatment instruction. For example, the server determines the tailwater treatment equipment corresponding to the tailwater treatment instruction, and sends the tailwater treatment instruction to the tailwater treatment equipment, so that the tailwater treatment equipment processes the tailwater to be tested.

[0158] In this embodiment, corresponding tailwater treatment instructions are generated according to different target water quality levels, which is equivalent to adopting different treatment methods and techniques for water quality problems of different levels, thereby improving the pertinence and effectiveness of the tailwater treatment to be tested, and is conducive to improving the treatment accuracy of the tailwater to be tested.

[0159] In an exemplary embodiment, Figure 2 As shown, another water quality prediction method is provided, and the method is applied to a server as an example, which specifically includes the following steps:

[0160] Step S201, determine the source information of the tail water to be tested; according to the source information of the tail water to be tested, query the correspondence between the source information and the preset index, obtain the preset index corresponding to the source information of the tail water to be tested, and use it as the preset index of the tail water to be tested; obtain the water quality data of the tail water to be tested under the preset index, and use it as the water quality data of the tail water to be tested.

[0161] Step S202, determining a target combination method corresponding to the water quality data; determining water quality data to be combined corresponding to the water quality data according to the target combination method; combining the water quality data and the water quality data to be combined to obtain combined data corresponding to the water quality data.

[0162] Step S203, preprocessing the water quality data and the combined data respectively to obtain preprocessed water quality data and preprocessed combined data.

[0163] Step S204, the preprocessed water quality data is used as the main data, and the preprocessed combined data is used as the auxiliary data, and is input into the feature extraction model to obtain the feature vector of the water quality data; the preprocessed combined data is used as the main data, and the preprocessed water quality data is used as the auxiliary data, and is input into the feature extraction model to obtain the feature vector of the combined data.

[0164] Step S205, concatenating the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data.

[0165] Step S206, inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result.

[0166] Step S207 , from each water quality prediction result, a water quality prediction result whose corresponding prediction probability is greater than a preset prediction probability is selected as the selected water quality prediction result.

[0167] Step S208, determining the target water quality prediction model corresponding to the water quality prediction result after screening; obtaining the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction result after screening.

[0168] Step S209, determining the model weight of the target water quality prediction model corresponding to the screened water quality prediction result according to the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the screened water quality prediction result.

[0169] Step S210, performing weighted sum processing on the screened water quality prediction results according to the model weight of the target water quality prediction model corresponding to the screened water quality prediction results, to obtain the target water quality prediction results of the tail water to be tested.

[0170] In the above-mentioned water quality prediction method, in the process of testing the water quality, the target feature vector of the water quality data is obtained by combining the water quality data of the tail water to be tested and the combined data corresponding to the water quality data, and then the target feature vector is predicted by multiple pre-trained water quality prediction models, and multiple water quality prediction results are screened and processed to obtain the target water quality prediction result of the tail water to be tested, thereby improving the accuracy and reliability of the overall prediction; moreover, the entire process does not require human intervention, avoiding the subjective factors in the manual detection method, which is prone to errors and leads to the defect of low water quality detection accuracy, and further improving the water quality detection accuracy.

[0171] In an exemplary embodiment, in order to more clearly illustrate the water quality prediction method provided by the embodiment of the present application, the water quality prediction method is specifically described below with a specific embodiment. In one embodiment, the present application also provides a LightGBM water treatment process water quality soft measurement method based on Bayesian algorithm optimization. In the process of water quality detection, a plurality of real-time water quality data in the water treatment process read by the water quality online sensor constitute the original data set, and the isolation forest algorithm is used to identify and remove the outliers in the original data set, and then the recursive feature elimination algorithm is used to select the input features. The selected data set is used as the model sample data set, and the sample data set is used to train the LightGBM model, and then the Bayesian optimization algorithm is used to optimize the model hyperparameters of the LightGBM to obtain the best hyperparameter combination of the LightGBM model. Finally, the optimal hyperparameter combination is substituted into the LightGBM algorithm to establish the chemical oxygen demand, total nitrogen, and total phosphorus soft measurement models respectively, and the trained soft measurement models are stacked to form a water quality soft measurement method for the water treatment process. Specifically including the following contents:

[0172] like Figure 3As shown in Figure 1, the method includes the acquisition of water quality online monitoring data, identification and elimination of outliers, elimination of input variable features and model training, and optimization of model hyperparameters. Figure 4 This embodiment specifically includes the following steps:

[0173] (1) Original data acquisition: The water quality indicators of the water treatment system monitored online daily are collected and stored as the model input data, and the manually detected water quality data are used as the model output data. The original database is formed according to the sampling time.

[0174] All data in this embodiment are collected during the daily operation of the processing device, including DO inf SS inf The data are obtained from the water quality online monitoring instrument installed in the fish pond tailwater treatment system, COD inf TP inf and TN inf The target variables such as COD, TN, TP, etc. in the water quality during the treatment process are obtained by the water quality laboratory technicians according to the national standard monitoring method, and the unit is mg / L (milligrams per liter).

[0175] (2) Data preprocessing: Use algorithms to identify and remove outliers: By randomly selecting data features and randomly dividing points within the feature range, a binary tree is gradually constructed. The path length of the sample in the tree is used to measure its degree of abnormality. A shorter average path length indicates a higher degree of abnormality. By randomly constructing multiple binary trees and calculating the average path length of each sample in these trees, samples with higher abnormality scores are finally regarded as outliers and removed. The data after removing the outliers is normalized and the processed data is limited to the range of [0,1]. The mathematical expression is:

[0176] , formula (1)

[0177] Where x is the original data of the feature variable, x norm is the data after the feature variable is normalized, max(x) and min(x) are the maximum and minimum values ​​in x.

[0178] In this embodiment, data collection work starts after the processing system is started and runs stably, and the data collection work required for the model is completed for 89 days, and 152 groups of original data are obtained. After outliers are identified and eliminated from the collected data, a total of 133 groups of valid original data are obtained, and 133 groups of data are used for actual modeling, as shown in Table 1 below.

[0179] Table 1 Part of the original data of the test set used

[0180]

[0181] (3) Data feature selection: Use the RFE (Recursive Feature Elimination) algorithm to optimize model variable selection. After the model algorithm is determined, use all feature subsets S to train the model and calculate the relative importance score R = {r1, r2, ···, r k} and sort them, k is the number of features contained in the feature subset S, remove the lowest ranked features, and thus reduce the size of the feature set. The remaining feature variables form a new feature subset S i , for each variable subset S i (i=1,...,S), retrain the model using the reduced feature set, calculate the importance of each feature variable again and rank them. Repeat the above steps, retraining the model on the reduced feature set each iteration, and 2 >0.8 is used as the performance indicator for stopping the iteration, and the feature set when the iteration stops is selected as the final feature selection result.

[0182] In this embodiment, the RFE algorithm is used for model feature selection. The normalized data is used to train the LightGBM model. The number of times all features are used as split points is counted, and the feature relative importance score R={r1, r2, ···, r8} is calculated to evaluate the accuracy of the current LightGBM model. The feature with the least importance in the current set is removed, and the model is re-iterated for training and evaluation. The model R 2 >0.8 is used as the performance indicator for stopping iteration, and the input feature is finally determined to be DO inf , SS inf , COD inf ,TP inf , T.N. inf .

[0183] (4) Model learning and training: The model training process includes randomly dividing the model sample data set into a training set and a test set in a ratio of 8:2, which are used for model training and testing respectively. The model uses 10-fold cross validation on the training set, and no longer sets a separate validation set. The Bayesian algorithm is used to optimize the hyperparameters of the LightGBM model. The hyperparameters to be found include the learning rate learning_rate, the tree depth max_depth, the number of leaf nodes num_leaves, and the feature ratio feature_fraction. The Gaussian process is used as the probability proxy model in the optimization process, and the acquisition function is the PI function. The specific optimization steps are as follows:

[0184] S1, randomly initialize n0 points x init={x0,x1,···,x n0-1}.

[0185] S2, get the corresponding function value f(x init ), the initial point set D0={x init ,f(x init )}.

[0186] S3, let t = 1, D t-1 = D0.

[0187] S4: When t≤N, execute step S5.

[0188] S5: Construct a proxy model g(x) based on the current set of evaluation points.

[0189] S6, based on g(x), maximize the acquisition function a(x|D) and get the next evaluation point: x t =arg min a(x|D).

[0190] S7, get x t The function value f(x t ), add it to the current evaluation point set D t = D t-1 U{x t ,f(x t )}, get x t The corresponding actual value, and according to x t The difference between the function value and the actual value of x t The corresponding loss value.

[0191] S8, t=t+1, when t≤N, return to step S5, when t>N, end.

[0192] S9, output: filter out the x with the smallest loss value in S7 t , and the x t The corresponding function value f(x t ), and get the optimal candidate evaluation point: {x t ,f(x t )}, and obtain the optimal hyperparameter set of the LightGBM model based on the optimal candidate evaluation point.

[0193] The input is the number of initialization points n0, the maximum number of iterations N, the proxy model g(x), the acquisition function a(x|D), and the output is the optimal candidate evaluation point: { x t ,f(x t )}.

[0194] This embodiment uses the feature-selected data set as the training set to train the LightGBM model, and uses the Bayesian algorithm to optimize the model hyperparameters. The hyperparameters to be optimized are the learning rate (learning_rate), tree depth (max_depth), number of leaf nodes (num_leaves), and feature ratio (feature_fraction). The hyperparameter search ranges are set to 0.5~1 for the learning rate, 1~20 for the tree depth, 10~100 for the number of leaf nodes, and 0.1~1 for the feature ratio. This embodiment uses the ten-fold cross-validation average accuracy as the objective function for hyperparameter optimization, optimizes the four hyperparameters, sets the number of iterations to 30 times, and substitutes the optimal hyperparameter combination obtained by the above method into the model, and finally obtains the COD, TN, and TP soft measurement models of the trained LightGBM model based on Bayesian optimization.

[0195] (5) The COD, TN, and TP soft-sensing models of the Bayesian optimization-based LightGBM model trained in step (4) are stacked and combined. The model stacking order is sorted from small to large according to the cumulative sum of hyperparameters. The soft-sensing model with the smallest cumulative sum of hyperparameter values ​​among the three soft-sensing models is placed at the top layer of the comprehensive system, and the largest is placed at the bottom layer, forming a COD, TN, and TP comprehensive soft-sensing model. For the comprehensive soft-sensing model, the input vector is X=[X1,X2,X3,X4,X5], which represent DO, inf SS inf 、COD inf TP inf and TN inf , the output vector is Y=[Y1,Y2,Y3], representing COD, TN and TP respectively.

[0196] In this embodiment, the trained individual COD, TN, and TP soft-sensing models are stacked to form a COD, TN, and TP comprehensive soft-sensing method. The input vector of the stacked comprehensive soft-sensing model system remains unchanged, and the output becomes a vector set composed of COD, TN, and TP values, that is, Y=[Y1, Y2, Y3], which represent COD, TN, and TP, respectively, thereby realizing the multi-input and multi-output process and function of the comprehensive soft-sensing method.

[0197] After the algorithm removes outliers from the original data set, a total of 133 sets of data are used as the model sample database. The LightGBM model based on Bayesian optimization is trained and tested for each water quality index. The model training and testing results are shown in Figure 5 , Figure 6 and Figure 7As can be seen from the figure, after optimization by the Bayesian algorithm, the correlation between the COD prediction value and the measured true value of the soft sensor model is 0.902, the correlation between the TN prediction value and the measured true value is 0.874, and the correlation between the TP prediction value and the measured true value is 0.887. The model prediction effect is good.

[0198] In the above embodiment, during the process of testing water quality, the target feature vector of the water quality data is obtained by combining the water quality data of the tail water to be tested and the combined data corresponding to the water quality data, and then the target feature vector is predicted by multiple pre-trained water quality prediction models, and multiple water quality prediction results are screened and processed to obtain the target water quality prediction result of the tail water to be tested, thereby improving the accuracy and reliability of the overall prediction; moreover, the entire process does not require human intervention, avoiding the defect of low water quality detection accuracy caused by subjective factors and prone to errors in manual detection, thereby further improving the water quality detection accuracy.

[0199] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0200] Based on the same inventive concept, the embodiment of the present application also provides a water quality prediction device for implementing the water quality prediction method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more water quality prediction device embodiments provided below can refer to the limitations of the water quality prediction method above, and will not be repeated here.

[0201] In an exemplary embodiment, Figure 8 As shown, a water quality prediction device is provided, including: a data acquisition module 801, a data combination module 802, a feature extraction module 803, a vector splicing module 804, a model prediction module 805, a result screening module 806 and a result determination module 807, wherein:

[0202] The data acquisition module 801 is used to acquire the water quality data of the tail water to be tested.

[0203] The data combination module 802 is used to perform combination processing on the water quality data to obtain combined data corresponding to the water quality data.

[0204] The feature extraction module 803 is used to perform feature extraction processing on the water quality data and the combined data to obtain the feature vector of the water quality data and the feature vector of the combined data.

[0205] The vector concatenation module 804 is used to concatenate the characteristic vector of the water quality data and the characteristic vector of the combined data to obtain the target characteristic vector of the water quality data.

[0206] The model prediction module 805 is used to input the target feature vector into multiple pre-trained water quality prediction models to obtain the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result.

[0207] The result screening module 806 is used to screen out the water quality prediction results whose corresponding prediction probabilities are greater than the preset prediction probabilities from each water quality prediction result as the screened water quality prediction results.

[0208] The result determination module 807 is used to perform weighted summation processing on the screened water quality prediction results to obtain the target water quality prediction results of the tail water to be tested.

[0209] In an exemplary embodiment, the data acquisition module 801 is also used to determine the source information of the tail water to be tested; based on the source information of the tail water to be tested, query the correspondence between the source information and the preset indicators, obtain the preset indicators corresponding to the source information of the tail water to be tested, as the preset indicators of the tail water to be tested; obtain the water quality data of the tail water to be tested under the preset indicators, as the water quality data of the tail water to be tested.

[0210] In an exemplary embodiment, the feature extraction module 803 is also used to preprocess the water quality data and the combined data, respectively, to obtain preprocessed water quality data and preprocessed combined data; the preprocessed water quality data is used as the main data, and the preprocessed combined data is used as the auxiliary data, which are input into the feature extraction model to obtain the feature vector of the water quality data; the preprocessed combined data is used as the main data, and the preprocessed water quality data is used as the auxiliary data, which are input into the feature extraction model to obtain the feature vector of the combined data.

[0211] In an exemplary embodiment, the result determination module 807 is also used to determine the target water quality prediction model corresponding to the screened water quality prediction result; obtain the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the screened water quality prediction result; determine the model weight of the target water quality prediction model corresponding to the screened water quality prediction result based on the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the screened water quality prediction result; perform weighted sum processing on the screened water quality prediction result based on the model weight of the target water quality prediction model corresponding to the screened water quality prediction result to obtain the target water quality prediction result of the tail water to be tested.

[0212] In an exemplary embodiment, the data combination module 802 is also used to determine a target combination method corresponding to the water quality data; determine the water quality data to be combined corresponding to the water quality data according to the target combination method; and combine the water quality data and the water quality data to be combined to obtain the combined data corresponding to the water quality data.

[0213] In an exemplary embodiment, the water quality prediction device also includes a model training module, which is used to obtain sample water quality data of sample tail water; combine the sample water quality data to obtain sample combination data corresponding to the sample water quality data; perform feature extraction processing on the sample water quality data and the sample combination data to obtain a feature vector of the sample water quality data and a feature vector of the sample combination data; concatenate the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a sample target feature vector of the sample water quality data; input the sample target feature vector into the water quality prediction model to be trained to obtain a water quality prediction result of the sample tail water; obtain the actual water quality result of the sample tail water, and iteratively train the water quality prediction model to be trained based on the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water to obtain a pre-trained water quality prediction model.

[0214] In an exemplary embodiment, the water quality prediction device also includes a tailwater treatment module, which is used to input the target water quality prediction result into a pre-trained water quality grade prediction model to obtain the prediction probability of the target water quality prediction result under multiple water quality grades; from the multiple water quality grades, the water quality grade with the largest prediction probability is screened out as the target water quality grade of the tailwater to be tested; according to the target water quality grade, a tailwater treatment instruction corresponding to the tailwater to be tested is generated; and according to the tailwater treatment instruction, the tailwater to be tested is treated.

[0215] Each module in the above-mentioned water quality prediction device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0216] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store water quality data, combined data, etc. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a water quality prediction method is implemented.

[0217] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0218] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0219] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0220] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0221] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0222] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0223] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A water quality prediction method, characterized in that: The method comprises: Obtain water quality data of tail water to be tested; Performing combination processing on the water quality data to obtain combination data corresponding to the water quality data; Performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data; Performing concatenation processing on the feature vector of the water quality data and the feature vector of the combined data to obtain a target feature vector of the water quality data; Inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining a water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and a prediction probability corresponding to each water quality prediction result; From each of the water quality prediction results, a water quality prediction result having a corresponding prediction probability greater than a preset prediction probability is selected as the selected water quality prediction result; Determining a target water quality prediction model corresponding to the screened water quality prediction result; Obtaining the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the screened water quality prediction result; Determining a model weight of the target water quality prediction model corresponding to the water quality prediction result after screening according to the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction result after screening; According to the model weight of the target water quality prediction model corresponding to the screened water quality prediction result, the screened water quality prediction result is weighted and summed to obtain the target water quality prediction result of the tail water to be tested; The pre-trained water quality prediction model is trained in the following way: Obtain sample water quality data of sample tail water; Performing combination processing on the sample water quality data to obtain sample combination data corresponding to the sample water quality data; Performing feature extraction processing on the sample water quality data and the sample combination data to obtain a feature vector of the sample water quality data and a feature vector of the sample combination data; Performing concatenation processing on the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a sample target feature vector of the sample water quality data; Inputting the sample target feature vector into the water quality prediction model to be trained to obtain the water quality prediction result of the sample tail water; The actual water quality result of the sample tail water is obtained, and according to the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water, the water quality prediction model to be trained is iteratively trained to obtain the pre-trained water quality prediction model.

2. The method according to claim 1, characterized in that The step of obtaining the water quality data of the tail water to be tested comprises: Determine the source information of the tail water to be tested; According to the source information of the tail water to be tested, query the corresponding relationship between the source information and the preset index, and obtain the preset index corresponding to the source information of the tail water to be tested as the preset index of the tail water to be tested; The water quality data of the tail water to be tested under the preset index is obtained as the water quality data of the tail water to be tested.

3. The method according to claim 1, characterized in that The performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data includes: Preprocessing the water quality data and the combined data respectively to obtain preprocessed water quality data and preprocessed combined data; The pre-processed water quality data is used as the main data, and the pre-processed combined data is used as the auxiliary data, and inputted into the feature extraction model to obtain the feature vector of the water quality data; The pre-processed combined data is used as main data, and the pre-processed water quality data is used as auxiliary data, which are input into the feature extraction model to obtain a feature vector of the combined data.

4. The method according to claim 1, characterized in that: The combining and processing the water quality data to obtain combined data corresponding to the water quality data includes: Determining a target combination method corresponding to the water quality data; According to the target combination method, determining the water quality data to be combined corresponding to the water quality data; The water quality data and the water quality data to be combined are combined to obtain combined data corresponding to the water quality data.

5. The method according to any one of claims 1 to 4, characterized in that After performing weighted sum processing on the screened water quality prediction results to obtain the target water quality prediction results of the tail water to be tested, the method further includes: Inputting the target water quality prediction result into a pre-trained water quality grade prediction model to obtain the prediction probability of the target water quality prediction result under multiple water quality grades; From the multiple water quality levels, screen out the water quality level with the largest prediction probability as the target water quality level of the tail water to be tested; Generating tail water treatment instructions corresponding to the tail water to be tested according to the target water quality level; The tail water to be tested is treated according to the tail water treatment instruction.

6. A water quality prediction device, characterized in that: The device comprises: A data acquisition module, used to obtain water quality data of tail water to be tested; A data combination module, used for combining the water quality data to obtain combined data corresponding to the water quality data; A feature extraction module, used for performing feature extraction processing on the water quality data and the combined data to obtain a feature vector of the water quality data and a feature vector of the combined data; A vector concatenation module, used for concatenating the characteristic vector of the water quality data and the characteristic vector of the combined data to obtain a target characteristic vector of the water quality data; A model prediction module, used for inputting the target feature vector into a plurality of pre-trained water quality prediction models, obtaining the water quality prediction result of the tail water to be tested output by each pre-trained water quality prediction model, and the prediction probability corresponding to each water quality prediction result; A result screening module, used to screen out the water quality prediction results whose corresponding prediction probability is greater than a preset prediction probability from each of the water quality prediction results as the screened water quality prediction results; A result determination module is used to determine the target water quality prediction model corresponding to the water quality prediction result after screening; obtain the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction result after screening; determine the model weight of the target water quality prediction model corresponding to the water quality prediction result after screening according to the prediction accuracy and prediction efficiency of the target water quality prediction model corresponding to the water quality prediction result after screening; perform weighted sum processing on the water quality prediction result after screening according to the model weight of the target water quality prediction model corresponding to the water quality prediction result after screening to obtain the target water quality prediction result of the tail water to be tested; The device also includes a model training module, which is used to obtain sample water quality data of sample tail water; perform combination processing on the sample water quality data to obtain sample combination data corresponding to the sample water quality data; perform feature extraction processing on the sample water quality data and the sample combination data to obtain a feature vector of the sample water quality data and a feature vector of the sample combination data; perform splicing processing on the feature vector of the sample water quality data and the feature vector of the sample combination data to obtain a sample target feature vector of the sample water quality data; input the sample target feature vector into the water quality prediction model to be trained to obtain a water quality prediction result of the sample tail water; obtain the actual water quality result of the sample tail water, and iteratively train the water quality prediction model to be trained according to the difference between the water quality prediction result of the sample tail water and the actual water quality result of the sample tail water to obtain the pre-trained water quality prediction model.

7. The device according to claim 6, characterized in that The data acquisition module is also used to determine the source information of the tail water to be tested; according to the source information of the tail water to be tested, query the correspondence between the source information and the preset index, obtain the preset index corresponding to the source information of the tail water to be tested, as the preset index of the tail water to be tested; obtain the water quality data of the tail water to be tested under the preset index, as the water quality data of the tail water to be tested.

8. The device according to claim 6, characterized in that The feature extraction module is also used to preprocess the water quality data and the combined data respectively to obtain preprocessed water quality data and preprocessed combined data; use the preprocessed water quality data as main data and the preprocessed combined data as auxiliary data, input them into the feature extraction model to obtain the feature vector of the water quality data; use the preprocessed combined data as main data and the preprocessed water quality data as auxiliary data, input them into the feature extraction model to obtain the feature vector of the combined data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Optimization method and device of water quality prediction model and network equipment

    CN115829136A

  • Aquaculture water quality evaluation method based on comprehensive water quality indexes

    CN117589762A

  • Water quality evaluation machine learning Bayesian model based on suspended particulate matter density

    CN118568595A